Forum Discussion

Premier2k's avatar
Premier2k
Occasional Contributor
9 years ago

Pulling a value from SOAP response into a property

Hi all,

 

I'm really struggling with this and must have tried a 100 ways now all resulting in failure.

I'm trying to pull out a value from a SOAP response message.

This is part of the response:

 

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <OTPAddRs xmlns="http://www.fnf.com/xes">
         <Status xmlns="urn:ifxforum-org:XSD:1">
            <StatusCode>0</StatusCode>
            <Severity>Info</Severity>
            <StatusDesc>Success</StatusDesc>
            <AdditionalStatus>
               <ServerStatusCode>0</ServerStatusCode>
               <Severity>Info</Severity>
               <StatusDesc>TRANSACTION PROCESSING COMPLETE.</StatusDesc>
            </AdditionalStatus>
         </Status>
         <OTPRec>
            <OTPKeys>
               <OTPCode>123456782</OTPCode>
            </OTPKeys>

I'm trying to get at the <OTPCode>. I've tried several different ways and each time it ends up as null.

 

This was my latest attempt:

 

declare namespace s='http://schemas.xmlsoap.org/soap/envelope/';
//s:Envelope/s:Body/OTPAddRs/OTPRec/OTPKeys/OTPCode

 

How on earth do I do this?

 

Premier2k

1 Reply

  • Premier2k's avatar
    Premier2k
    Occasional Contributor

    Finally figured it out!

     

    declare namespace i='http://www.fnf.com/xes';
    //i:OTPAddRs[1]/i:OTPRec[1]/i:OTPKeys[1]/i:OTPCode[1]