RESTMessageV2 - Not escape XML in body

Teemu1
Tera Expert

Hi,

Is there a way to send an XML payload (Content-type: application/xml or text/xml) without escaping? I know you can do this by replacing variables with command setStringVariableNoEscape, if you call a REST Message module. But I need to send scripted REST message, and I'm using command "setRequestBody(myXML_AsAString)".

If I'm sending this to ServiceNow Scripted REST API endpoint, I get an error "Not valid XML Payload" (http_status : 500) as a response.

Does anyone have any idea?

1 ACCEPTED SOLUTION

Ct111
Giga Sage

Hi ,

 

You can use something like this

 

unescapeForXMLText(str)

 

For more information refer the below link:

https://old.wiki/index.php/XMLUtilJS#unescapeForXMLText.28str.29

 

 

Mark my ANSWER as CORRECT and hELPFUL if it works.

 

View solution in original post

1 REPLY 1

Ct111
Giga Sage

Hi ,

 

You can use something like this

 

unescapeForXMLText(str)

 

For more information refer the below link:

https://old.wiki/index.php/XMLUtilJS#unescapeForXMLText.28str.29

 

 

Mark my ANSWER as CORRECT and hELPFUL if it works.