XML text file to response Object

Hi,

For one of my soap Request I get a response with special characters for < and > signs.
Because the response has these special characters, I could not run command like WS.getElementPropertyValue and get the correct value.
So I googled and found a way to change special chars to < > signs and also changed the file in pretty format. My question is now how do I go back from this
xml text file to response Object so I can run the command WS.getElementPropertyValue?

Thanks in advance

SOAP messages carry XML documents. A XML document contains a lot of < and > characters. In XML, < and > are nothing special.

I do not understand what you wrote. Please show us more info: your XML data, your test script, error log, etc.

1 Like

Hi again,

Thank you for a quick response.

If the response didn’t have any special characters, I will do the following to get the value of Success Tag.

def locator1 = “GetUploadFeedbackResponse.Return.Transaction_Summary.Success”
response = findTestObject(‘ABC/GetTransactions’)))
String strMessageResponse = WS.getElementPropertyValue(response, locator1)

Here’s a response after I replace the special characters with <>. However this is in a text file test.xml now.
How do I get the <Success? tag value from the text file. 0

  <?xml version="1.0" encoding="UTF-8"?><soap:Envelope 
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body> 
     <dex420c:GetUploadFeedbackResponse xmlns:dex420c="http://metadata.dod.mil/mdr/ns/NECC-AP/FPJ-JDS/1.0.1.6/dex"> 
          <Return> <DEX_Feedback>
                     <AsOf>2022-06-15T13:14:43</AsOf>                        
                     <Transaction_Summary>
                          <Total>1</Total>
                          <Pending>1</Pending>
                          <Success>0</Success>
                          <Success_with_warnings>0</Success_with_warnings>
                          <Rejected>0</Rejected>
                     </Transaction_Summary>
                </DEX_Feedback>
           </Return> 
     </dex420c:GetUploadFeedbackResponse> 
    </soap:Body>
 </soap:Envelope>

@mqamar I can’t speak to your existing code but I can tell you I find dealing with XML much easier using GPathResult.

More info here:

https://www.baeldung.com/groovy-xml

Web search:

https://duckduckgo.com/?t=ffab&q=GPathResult&atb=v267-1&ia=web

Still I do not understand your problem.

Please show us the raw response BEFORE you do any character replacement.