Combine Payload, with policies and consumer.

Not applicable

Hi friends, I consuming a rest service that receives a json with 4 parameters. I try to pass 3 parameters with AssignMessage and 1 parameters from postman.

this is my payload in AssignMessage policies

<Payload contentType="application/json; charset=utf-8">
{
"Message": "Josh",
"DataId": 2,
"id": 999,
"desc": "desc",
}
</Payload>

When consuming my service with only AssignMessage in trace section the params are the same.

But when i put one param in postman in trace section only see the param from postman.

How i can to combine the payloads postman 1 param + 3 params from AssignMessage.

0 2 109
2 REPLIES 2

Hi, I'd like to be able to help you , but I don't understand the problem.

You are saying "when i put one param in postman in trace section only see the param from postman." I don't understand what that means?

Can you please elaborate or clarify?

Also I don't understand how that relates to this question:

How i can to combine the payloads postman 1 param + 3 params from AssignMessage.

The Payload element in AssignMessage is a message template. That means ... variable references will be replaced with the values of the variables. For example, this Payload element:

<Payload contentType="application/json; charset=utf-8">
{
  "Message": "{request.queryparam.foo}"
}
</Payload>

...when the inbound request contains a body with a query parameter named foo with value = "bar", will result in an actual payload like this:

{
  "Message": "bar"
}

If you would like to produce a payload that combines "hard coded" parameters with some parameters from the inbound request, you could do something like this:

<Payload contentType="application/json; charset=utf-8">
{
"Message": "Josh",
"DataId": 2,
"id": 999,
"desc": "{request.queryparam.description}"
}
</Payload>