Forum Discussion

amir's avatar
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,


    <Output name="BureauResponse">
&lt;ConnectResponse xmlns=""&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 ..... </Output>



And I was logging the response as,



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");;

def expectedResponse ='&lt;ConnectResponse xmlns=""&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 ....';
assert expectedResponse =='&lt;ConnectResponse xmlns=""&gt;&lt;CompletionCode&gt;0000&lt;/CompletionCode&gt;&lt;TransactionId&gt;123 ...';


this prints in the console,


<ConnectResponse xmlns=""><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=""&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.


No RepliesBe the first to reply