Hi guys I have some issue with soap message.
I am extracting books, author id from query params and generating an soap payload using Assign Message. When I hit the url and check the cURL from request sent to target server section in trace, I get,
curl -X POST -H 'Authorization: *****' -H 'Cache-Control: no-cache' -H 'Content-Type: application/xml' -H 'X-Forwarded-Port: 80' -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><Search><books><bookid>205</bookid><bookid>201</bookid><bookid>203</bookid> </books><author><authorid>PMS-425-01</authorid><authorid>PMS-425-02</authorid><authorid>PMS-425-03</authorid> </author> </Search> </soapenv:Body> </soapenv:Envelope>' 'http://url/path'
Due to which I do not get desired output. I copied the soap message from cURL and beautified it and checked in normal postman then I get desired output.
So how/what can I do in Assign message policy to get each in new line?
This is my Assign message policy, <Set> <Payload content-type="application/xml"> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <Search> <books> <bookid>{bookids}</bookid> <bookid>{bookids2}</bookid> <bookid>{bookids3}</bookid> </books> <author> <authorid>{authorids}</authorid> <authorid>{authorids2}</authorid> <authorid>{authorids3}</authorid> </author> </Search> </soapenv:Body> </soapenv:Envelope> </Set>
So desired cURL should be something like this,
curl -X POST -H 'Authorization: *****' -H 'Cache-Control: no-cache' -H 'Content-Type: application/xml' -H 'X-Forwarded-Port: 80' -d <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <Search> <books> <bookid>{bookids}</bookid> <bookid>{bookids2}</bookid> <bookid>{bookids3}</bookid> </books> <author> <authorid>{authorids}</authorid> <authorid>{authorids2}</authorid> <authorid>{authorids3}</authorid> </author> </Search> </soapenv:Body> </soapenv:Envelope>
Solved! Go to Solution.
Guys I think, I got an temporary solution for now,
I have added <![CDATA[ <soap body> ]]>
If there is any better solution kindly let me know.
@Barahalikar Siddharth , Are you saying in postman it works but not in CURL ?
No, I want the soap message in cURL to be sent as it is mentioned in last code block(not scrambled).
I think that can be done by adding \n in Javascript at the end of each line. But I do not know what to add in XML.
I hope it is clear.
Guys I think, I got an temporary solution for now,
I have added <![CDATA[ <soap body> ]]>
If there is any better solution kindly let me know.