Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Ampersands (&) breaking SOAP message

tbalestreri3
Mega Contributor

Hi All,

I am using soap messaging to send tickets from instance to instance. The problem I am running into is that ampersands are breaking the soap message. When an "&" is in the message in any text field, the message will not be sent. I am opening a ticket with HI but am curious to see if anyone has a work around or some sort of scripting fix for this.

Thanks
Tony

3 REPLIES 3

john_andersen
Tera Guru

Have you tried either escaping the ampersand using HTML codes, or wrapping the contents of each tag with CDATA statements?


tbalestreri3
Mega Contributor

No I have not.

Can we do this in a business rule?


You can do escaping or CDATA wrapping in whatever script is posting the SOAP message (typically a business rule).

If you go the CDATA route, then you could also add the CDATA in your SOAP Message template for each of the concerned tags instead of scripting it in.

A sample SOAP Message template could look like this if you do put the CDATA right into the template:

[code lang='xml']



<__encoded_query xsi:type="xsd:string">${encoded_query}<br/>
</__encoded_query>



[/code]