cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract a value from a SOAP response and Pass it to another SOAP Request

Highlighted
New Contributor

How to extract a value from a SOAP response and Pass it to another SOAP Request

I'm trying to pass a specific Value from a SOAP Response to a different SOAP Request Field.

What I'm trying to achieve is to get the TransID's FieldValue. I'm trying to achieve this using the Property Transfer but I'm failing.

<a:Records>
<aSmiley Very Happyocument>
              <aSmiley Very HappyocumentState i:nil="true"/>
              <a:Fields>
                  <a:Field>
                      <a:FieldName>IndNo</a:FieldName>
                      <a:FieldValue>43</a:FieldValue>
                  </a:Field>
                  <a:Field>
                      <a:FieldName>DocNo</a:FieldName>
                      <a:FieldValue>-1</a:FieldValue>
                  </a:Field>
                    <a:Field>
                      <a:FieldName>TransID</a:FieldName>
                      <a:FieldValue>5had-asde-123n-fdf4</a:FieldValue>
                  </a:Field>
                    <a:Field>
                      <a:FieldName>AccountType</a:FieldName>
                      <a:FieldValue>Existing</a:FieldValue>
                  </a:Field>
              </a:Fields>
       </aSmiley Very Happyocument>
</a:Records>

Anyone who can assist me on this?

3 REPLIES 3
Flo
Contributor

Re: How to extract a value from a SOAP response and Pass it to another SOAP Request

Hi

I think you should use Xpath in property transfer to get value of TransID.

On property transfer window, select the source test case, Property = Response and Path Language = XPath

The XPath should be as follow

//a:Field[a:FieldName="TransID"]/a:FieldValue

Then select target you wish.

 

Let me know if you still have issues

New Contributor

Re: How to extract a value from a SOAP response and Pass it to another SOAP Request

I'm getting the Error bellow

 

[net.sf.saxon.trans.XPathException: XPath syntax error at char 10 on line 2 in {\n//a:Field[a:FieldName}: Prefix a has not been declared]

 

and when I try to replace the a: with the *:

//*:Field[*:FieldName="TransID"]/*:FieldValue

Flo
Contributor

Re: How to extract a value from a SOAP response and Pass it to another SOAP Request

You can try to remove a: in the example I gave to you

New Here?
Join us and watch the welcome video:
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win