How to deserialize XML

Hello Team,
Kindly assist me deserilzed the script below:
I want the retrieve the following elements.

  1. ResponseMessage
  2. ResponseCode
  3. ErrorCode
  4. ErrorMessage

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope

xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/>

<soapenv:Header>

    <ent:ServiceHeader

        xmlns:ent=http://xmlns.hjhlhl.com/SOAFramework/CommonResources1/WSDL/ServiceCatalog/Entities>

        <RequestId>07849806-deb6-4385-9876-3d50hgfd6c</RequestId>

        <Source>Siebel</Source>

        <Username>SOAP_UI</Username>

        <ReplyExpected>Now</ReplyExpected>

    </ent:ServiceHeader>

</soapenv:Header>

<soapenv:Body>

    <ent:ServiceReply

        xmlns:ent=http://xmlns.hjhlhl.com/SOAFramework/CommonResources1/WSDL/ServiceCatalog/Entities>

        <ResponseCodes>

            <ResponseCode>-700</ResponseCode>

            <ResponseMessage>CustCare App Error</ResponseMessage>

            <ExternalError>

                <ErrorCode>INT-001</ErrorCode>

                <ErrorMessage>Customer Exists.</ErrorMessage>

                <System>CVM</System>

            </ExternalError>

        </ResponseCodes>

    </ent:ServiceReply>

</soapenv:Body>

</soapenv:Envelope>

Best Regards,
Akpeko

Hi,

In this case, we can get these value simply using Descendants method as the following.

Sample20220502-3.zip (3.2 KB)

Regards,

1 Like

@AKPEKO_DENNIS_ZIGAH
have a look here at how we handle XML Namespaces:

1 Like

Just what I needed. Gracias @Yoichi

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.