AnsweredAssumed Answered

XML returned by 'Call web service' not parsed correctly

Question asked by amchargue on Mar 11, 2015

I have a web service that returns a response in the form

 

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <soap:Body>

      <GetItemByIdResponse xmlns="http://tempuri.org/">

         <GetItemByIdResult><![CDATA[<?xml version="1.0" encoding="utf-16"?>

<Item xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <item>99999</item>

  <itemdate>2015-03-06T06:13:00</itemdate>

  <begtime>2015-03-08T00:00:00</begtime>

  <endtime>2015-03-09T00:00:00</endtime>

  <execution>SAMPLE EXECUTION TYPE</execution>

  <itemstatus>Confirmed</itemstatus>

  <counterparty>Simon &amp; Simon</counterparty>

  <swapstatus>Non-Swap</swapstatus>

</Item>]]></GetItemByIdResult>

      </GetItemByIdResponse>

   </soap:Body>

</soap:Envelope>

 

Notice that the GetItemByIdResult element contains a CDATA and, in this case, the counterparty element contains &amp;

 

Using the Nintex action 'Call web service' I store the result in a variable XmlResult, checking "Specify elements" and selecting the GetItemByIdResult node. With verbose enabled, I can see that XmlResult contains & not &amp; 

 

When I then use a Query XML action (source=XML and XML is {Workflow:Variable:XmlResult}), I get the bizarre result that any output gets set to the entire XmlResult. I have several outputs to extract the data, such as a XPath output with the xpath=/Item/counterparty.

 

For any item where the counterparty does NOT contain &amp; this does not happen; the Query XML action behaves normally.

 

So I think the 'Call web service' action does not properly encode the ampersand, and the Query XML action should just fail if it is seeing bad XML (?).

 

My workaround for this is to set XmlResult = fn-Replace(TradeResultXml,&,&amp;). Then it works fine.

 

I just thought I would throw this out there to see if you think it is a bug, or if I am missing something.

 

Regards,

a

Outcomes