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.
request.queryparam.email
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.
@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
- request.queryparam.email
- {request.queryparam.email}
- Extract query param using extract policy and set it in emails, then refer that in java callout like:
{emails}
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");
@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.