The variable reference request.queryparam.email in java callout property is not working.

I am facing one issue in Java callout policy wherein I am passing queryparam as value to one of the property:

I am calling following url:

http://dev-api.mycompany.com/v1/test?email=abc@gmail.com,xyz@gmail.com

Following line doesn't work for me in java callout policy.

<Property name="mailArray">request.queryparam.email</Property>

I printed the value request.queryparam.email using javascript and it printed the value passed in the queryparam.

But when I hardcode it to some value it works just fine.

Following hardcoded value works just fine:

abc@gmail.com,xyz@gmail.com

Can anyone correct me where I am going wrong.

Solved Solved
0 5 513
1 ACCEPTED SOLUTION

I went through the documents and found that only literal strings are allowed inside properties. Which ultimately means I have to update my javacode to get the variable instead of passing variable in properties.

String queryParamEmail = messageContext.getVariable("queryParam");

View solution in original post

5 REPLIES 5

@AshwiniRai, Change it to:

<Property name="mailArray">{request.queryparam.email}</Property>

Thanks @Mahammad Feroz I have already tried this. Indeed I tried below 3 options and none worked

  1. <Property name="mailArray">request.queryparam.email</Property>
  2. <Property name="mailArray">{request.queryparam.email}</Property>
  3. Extract query param using extract policy and set it in emails, then refer that in java callout like:
    <Property name="mailArray">{emails}</Property>

@Ashwini Rai

<Property name="mailArray">{emails}</Property> 

This doesn't work.

I have an assign message policy which looks like below.

 <AssignVariable>
        <Name>name</Name>
        <Value>test</Value>
 </AssignVariable>

I am passing the variable to the callout like

<Properties>
        <Property name="encrypt.utils.name">{name}</Property>
</Properties>

and the value of "encrypt.utils.name" is passed as "{name}" not "test".

Any thoughts on this?

Like I said in my above post only literal string can be passed in properties. Flow variables aren't allowed.

I went through the documents and found that only literal strings are allowed inside properties. Which ultimately means I have to update my javacode to get the variable instead of passing variable in properties.

String queryParamEmail = messageContext.getVariable("queryParam");