amir
8 years agoNew Contributor
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">
<ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"><CompletionCode>0000</CompletionCode><TransactionId>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 ='<ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"><CompletionCode>0000</CompletionCode><TransactionId>123 ....';
assert expectedResponse =='<ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"><CompletionCode>0000</CompletionCode><TransactionId>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,
<ConnectResponse xmlns="http://www.xyz.com/ConnectResponse"><CompletionCode>0000</CompletionCode><TransactionId>123 .....
Is there a correct way to do this?
Any help on this will be much appreciated.
Thanks.