A simple question I hope; I am trying to implement a simple stub where I hard-code a response via an assign policy.
My policy looks like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="false" enabled="true" name="TestStub2"> <DisplayName>TestStub2</DisplayName> <FaultRules/> <Properties/> <Set> <Headers/> <QueryParams/> <FormParams/> <Payload>
{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }} </Payload>
<!-- <Verb>GET</Verb> --> <Path/> </Set> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>
I am facing two issues:
Response looks like:
{ "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()", "Open", "onclick": "OpenDoc()", "Close", "onclick": "CloseDoc()" ] } }}
Is an assign the way to do what I am trying to do, and if yes, do I need to escape the hard-coded response?
thanks
jim
Solved! Go to Solution.
Answer my own question: precede all { braces with backslash \\ so that they are not treated as variables. Hope this is useful for others!