Discussion
How to pass XML string as an request parameter to a SOAP service
Hi All,
We are using Connect-SOAP to communicate with an external service provider. One of the request paramter expects an xml string. I have prepared an xml string using XML Stream rule and tried to pass that string as the request. In the tracer I've noticed that "<" and ">" charectors were replaced by "<" and > in the request xml string. I learnt that this is an expected behaviour as per the XML 1.0 guidelines.
(Ex: <safetyreport><occurcountry>US</occurcountry><reporttype>Spontaneous</reporttype><serious>true</serious></safetyreport>)
http://www.w3.org/TR/2008/REC-xml-20081126/#syntax
As per the guideline we need use CDATA section to pass the xml string inside an xml node. So I tried to append the request string as follows.
"<![CDATA["+Param.RequestStr+"]]>"
When I use this I am seeing the request xml as below.
<![CDATA[<safetyreport><occurcountry>US</occurcountry><reporttype>Spontaneous</reporttype><serious>true</serious></safetyreport>]]>
Can someone help me to pass the xml string in the correct format?
Hi
Symbols like "<" and ">" characters generally will be replaced by corresponding escape characters i.e. “<" and > in the request xml string and clipboard.
But when you send to external systems these chars will be sent as "<" and ">" not escape chars.
So nothing to worry.
If you print log for request xml, you will find that correct chars or ask external team what they are receiving when send these to confirm the same.
Hope it helps.