Forum Discussion

Randell90's avatar
Randell90
New Contributor
5 years ago

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>
<a:Document>
              <a:DocumentState 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>
       </a:Document>
</a:Records>

Anyone who can assist me on this?

3 Replies

  • Flo's avatar
    Flo
    Contributor

    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

    • Randell90's avatar
      Randell90
      New Contributor

      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's avatar
        Flo
        Contributor

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