Reputation: 465
I am hoping that someone can help me using a Web Service with SoapUI?
I have created TestSteps to authenticate the user, do a search for data and then export that data into an Excel file. The problem I am having is that I am only getting one row of data each time whereas I need the full 100 records that are provided in the XML Response file.
When I make the SOAP Request, the responding XML file contains fields of data within the UID tags that I want to extract:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:searchResponse xmlns:ns2="http://woksearch.v3.wokmws.thomsonreuters.com">
<return>
<queryId>1</queryId>
<recordsFound>3648</recordsFound>
<recordsSearched>38406647</recordsSearched>
<records><records xmlns="http://scientific.thomsonreuters.com/schema/wok5.4/public/Fields">
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:A1993LC48100001</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:A1993LE28400012</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:000239231100002</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:000225797900011</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:000249142800001</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:000071234000001</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:000292046900004</UID><static_data></static_data><dynamic_data><cluster_related> </cluster_related></dynamic_data></REC>
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:A1992JR22700001</UID> ....etc.
I am trying to use a Property Transfer to take all these UID values as a list and insert them into another SOAP Request between uid tags. The response to this SOAP Request will then give me detailed data about each record.
Unfortunately, whatever I try, it will only ever return and pass on one record rather than the full 100.
At the moment the XPath I have as the Source in Property Transfer is:
declare namespace ns1='http://scientific.thomsonreuters.com/schema/wok5.4/public/Fields';
declare namespace ns2='http://woksearch.v3.wokmws.thomsonreuters.com';
//ns2:searchResponse[1]/return[1]/records[1]/ns1:records[1]/ns1:REC/ns1:UID[1]
Under the records tag, each UID value is stored in a separate REC tag, so I need to iterate through the REC tags, selecting the UID value each time.
The image below shows the hierarchical layout of the file and position of the UID values nested within the REC values:
*Turns out I can't post images because my reputation is too low! The nesting is like this:
<searchResponse>
<return>
<records>
<records>
<REC>
<UID>WOS: DDKJ7898dIJH</UID>
</REC>
<REC>
<UID>WOS: OIJS897JBSSS</UID>
</REC>
etc...
Does anyone know how I can get all these values to pass into another SOAP Request? I have tried a number of different XPath variations to no avail. I also tried using a DataSink to pull all the UID values into a spreadsheet and then import them into the other request with DataSource, but I could still only transfer one value at a time!
Any help is greatly appreciated!
Thank you for your time,
John
Upvotes: 0
Views: 3033
Reputation: 10329
One possible approach goes like this:
Upvotes: 0
Reputation: 745
A solution that utilizes Property transfer would be (make sure to check XQuery):
declare namespace ns1='http://scientific.thomsonreuters.com/schema/wok5.4/public/Fields';
declare namespace ns2='http://woksearch.v3.wokmws.thomsonreuters.com';
<UID>
{
for $id in //ns1:UID
return string($id)
}
</UID>
The output would be in the format:
<UID>WOS:A1993LC48100001 WOS:A1993LE28400012 WOS:000239231100002 WOS:000225797900011 WOS:000249142800001 WOS:000071234000001 WOS:000292046900004</UID>
Upvotes: 1