If you have this configuration
<AssignMessage async="false" continueOnError="false" enabled="true" name="AM-SetPayload"> <DisplayName>AM-SetPayload</DisplayName> <Properties/> <Set> <Payload contentType="application/json"> {"user": {"id":"{jwt.Decode-JWT.decoded.claim.name}"} </Payload> <Verb>POST</Verb> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>
...you can simplify it. There's a bunch of stuff you don't need there. This is equivalent and is more easily readable, presents less stuff to understand .
<AssignMessage name="AM-SetPayload"> <Set> <Payload contentType="application/json"> {"user": {"id":"{jwt.Decode-JWT.decoded.claim.name}"} </Payload> <Verb>POST</Verb> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </AssignMessage>
Specifically regarding the "AssignTo" element... When you use this configuration:
<AssignTo createNew="false" transport="http" type="request"/>
...it doesn't do anything. If you have an empty AssignTo (there is no TEXT value for the element), then AssignMessage uses the ambient message, which is "message". It will be the request if you attach the policy in the request flow, and it will be the response if you attach the policy in the response flow. Just leave the AssignTo out, and the policy works fine. You mostly need that when creating a NEW message (createNew='true') and you want to name a variable to hold the message. That would look like this:
<AssignTo createNew="false" transport="http" type="request">myNewMessage</AssignTo>
But in general, most people are not doing that.
In Summary, Just keep the essential bits in your policy configuration, you'll be happier.