Skip to content

Instantly share code, notes, and snippets.

@ApigeeSamples
Forked from evera/assign_message.xml
Created August 21, 2012 11:50
Show Gist options
  • Save ApigeeSamples/3414852 to your computer and use it in GitHub Desktop.
Save ApigeeSamples/3414852 to your computer and use it in GitHub Desktop.
Assign Message policy examples
<AssignMessage name="create1">
<AssignTo type="[request]/response" createNew="[true]/false">sc.request</AssignTo>
<IgnoreUnresolvedVariables>true/[false]</IgnoreUnresolvedVariables>
// allow any order
<Copy source="request"> // if no children do copy all
<Headers>
<Header name="h1"/>
<Header name="h2"/>
</Headers>
<QueryParams>
<QueryParam name="q1"/>
<QueryParam name="q2"/>
</QueryParams>
<FormParams>
<FormParam name="f1"/>
<FormParam name="f2"/>
</FormParams>
<Payload>true/[false]</Payload>
<Verb>true/[false]</Verb>
<Path>true/[false]</Path>
</Copy>
<Remove> // if no children do remove all
<Headers>
<Header name="h1"/>
<Header name="h2"/>
</Headers>
<QueryParams>
<QueryParam name="q1"/>
<QueryParam name="q2"/>
</QueryParams>
<FormParams>
<FormParam name="f1"/>
<FormParam name="f2"/>
</FormParams>
<Payload>true</Payload>
</Remove>
<Add>
<Headers>
<Header name="h1">my{variable.v1}</Header>
</Headers>
<QueryParams>
<QueryParam name="q1">my{variable.v1}</QueryParam>
</QueryParams>
<FormParams>
<FormParam name="f1">my{variable.v1}</FormParam>
</FormParams>
</Add>
<Set>
<Headers>
<Header name="h1">my{variable.v1}</Header>
</Headers>
<QueryParams>
<QueryParam name="q1">my{variable.v1}</QueryParam>
</QueryParams>
<FormParams>
<FormParam name="f1">my{variable.v1}</FormParam>
</FormParams>
<Payload contentType="text/xml">
<root>this is my payload {variable.v1}</root>
</Payload>
<Verb>${variable.v1}</Verb>
<Path>abc/def/{varaiable.v1}/d</Path>
</Set>
<AssignVariable>
<Name>response.header.xyz</Name>
<Ref>request.queryparam.abc</Ref>
<Value>hello!</Value>
</AssignVariable>
</AssignMessage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment