Forum Discussion

kralston's avatar
kralston
Occasional Contributor
12 years ago

Transfer from XML Response

I am attempting to transfer the Id value in an xml response to a suite property using a Property Transfer step.

The response looks like the following:

<Response xmlns="http://cltp10-serviceqa05.arbfile.org/afapi/rest/documents">
<error/>
<documents>
<e>
<Date null="true"/>
<barcode>H000000000365201</barcode>
<cover null="true"/>
<Base null="true"/>
<Relative null="true"/>
<Id>365201</Id>
<Status>NOTRCVD</Status>
<Size null="true"/>
</e>
</documents>
<return>200</status>
</Response>

Transfer Step config
1. Source set to the Rest Request step and it's property to Response
2. Entered - /Response/documents/e/Id
3. Target set to the Test Suite and property set to DocId

Executing this transfer generates the following error - Unexpected element: CData.

I have also set the source property to ResponseAsXml
but this gives an error also - Missing match for Source XPath...

I have also attempted to declare a namespace and altered the /Response/documents/e/Id in a variety of ways but without success.

I have cut and pasted the Response XML into the Altova XMLSpy tool entered the same XPath - /Response/documents/e/Id
and the value 365201 is properly returned.

More puzzling is that this test suite ran several months ago without error. This is a fresh checkout from our subversion repository and has not been edited in sometime.

Any help on this would be greatly appreciated.

1 Reply

  • kralston's avatar
    kralston
    Occasional Contributor
    Resolved - I found that I had to add namespace declarations for my xpath.

    We were on an earlier version perhaps there was a change when I went to 4.6.4.

    A bit inconvenient with a couple of hundred tests with transfer structures that will have to be changed but on the plus side it's fixed.