Forum Discussion

amir's avatar
amir
New Contributor
8 years ago

Why does soap response unescape xml while printing?

When I was trying to print the content of soap response in the console my response xml get unescaped.

 

My soap response contains,

 

<response>
    <Output name="BureauResponse">
&lt;ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 ..... </Output>
</response>

 

 

And I was logging the response as,

 

import com.eviware.soapui.support.XmlHolder

def soapResponse = context.expand('${getReportData#Response}' );
def soapResponseXMLHolder = new XmlHolder( soapResponse );
def responseXMLString = soapResponseXMLHolder.getNodeValue("Envelope/Body/ReportDataResponse/Application");
def responseXML = new XmlHolder(responseXMLString);
def response= responseXML.getNodeValue("/Application/Source/data/response");
log.info(response);

def expectedResponse ='&lt;ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 ....';
assert expectedResponse =='&lt;ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 ...';

 

this prints in the console,

  

<ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"><CompletionCode>0000<CompletionCode><TransactionId>123.. 

What I was expecting is to see response in the console when i log it to print, 

 

&lt;ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 .....

 

 Is there a correct way to do this? 

Any help on this will be much appreciated.

Thanks.

No RepliesBe the first to reply