Retrieve Value from SOAP response

Hi All,

Currently I’m working in some SOAP request Scripts using API, I would like to know how to store some value from the response data.
Example: I’m Looking to obtain the value “SessionID” from the response and use it as a variable.

Here is my Response:
<soap:Envelope xmlns:soap=“http://schemas.xmlsoap.org/soap/envelope/”>

soap:Body..

  <ns2:signinResponse xmlns:ns2="http://com.ge.b2ewebservice/B2EService/">
     <signinReturn> 
        <result>SUCCESS</result>
        <userStatus>VERIFIED</userStatus>
        <challengeQuestionId>Q1.8</challengeQuestionId>
        <EventRiskPolicy>CHALLENGE</EventRiskPolicy>
        <userAttributes>
           <sessionId>7135-:2cd9bd8fb51:f4ab01a1||1494550638016</sessionId>
           <transactionId>6135-:2cd9bd8fb51:f4ab01a1_TRX</transactionId>
        </userAttributes>
        <userAnswers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
        <eventRiskFacts>
           <item>
              <name>REASON</name>
              <value>AuthDevNotBound</value>
           </item>
        </eventRiskFacts>
     </signinReturn>
  </ns2:signinResponse>

Thanks in advance and appreciate all the help. :smile_cat:

Hi @ivan_jimenez - I couldn’t find an example from the New Relic documentation but I found an example on StackOverflow which you should be able to use. Once you have the response object you should be able to extract your SessionId.

1 Like