DatSupport
12 years agoNew Contributor
XQuery in propertyTransfer for multiple return elements
Hi, I am currently evaluating on the features of SOAP UI 4.5.2.
I have a scenario here that I would like to seek advise on iteration on a set of elements in a test request xml file.
Please refer to the scenario below:
Example, I have a sequence of requests whose responses have to be the request values of the following request. So far so good. Imagine, that not only single values are necessary but the response values of a specific element name <DatEquipmentId> that are returned n-times in the responses ind different nodes like that:
All those <DatEquipmentId> (hundreds of it) have to be used in the next following request within request parameter <equipment></equipment>, enclosed with its own tag.
I want to use only propertyTransfer to make it reuseable and tried it with the following code:
As a result I got the following back in the following request:
So, all results within one tag. But I want each of them enclosed in its own <equipment> tag.
So, I tried the next code:
As a result I got back only the first of all values, even enclosed in the correct tag:
So, can someone help me to solve that problem, please? For different reasons I don't want to use groovy scripts, but only propertyTransfer. Is this possible?
Regards,
Heike
I have a scenario here that I would like to seek advise on iteration on a set of elements in a test request xml file.
Please refer to the scenario below:
Example, I have a sequence of requests whose responses have to be the request values of the following request. So far so good. Imagine, that not only single values are necessary but the response values of a specific element name <DatEquipmentId> that are returned n-times in the responses ind different nodes like that:
<ns3:Equipment>
<ns3:SeriesEquipment>
<ns3:EquipmentPosition>
<ns3:DatEquipmentId>26803</ns3:DatEquipmentId>
<ns3:ManufacturerEquipmentId>4UE</ns3:ManufacturerEquipmentId>
<ns3:Description>Airbag Fahrer-/Beifahrerseite</ns3:Description>
<ns3:EquipmentGroup>AIR1</ns3:EquipmentGroup>
</ns3:EquipmentPosition>
<ns3:EquipmentPosition>
<ns3:DatEquipmentId>40000</ns3:DatEquipmentId>
<ns3:Description>Anti-Blockier-System (ABS)</ns3:Description>
<ns3:EquipmentGroup>ABS</ns3:EquipmentGroup>
</ns3:EquipmentPosition>
</ns3:SeriesEquipment>
<ns3:SpecialEquipment>
<ns3:EquipmentPosition>
<ns3:DatEquipmentId>18603</ns3:DatEquipmentId>
<ns3:ManufacturerEquipmentId>8Q5</ns3:ManufacturerEquipmentId>
<ns3:Description>Xenon-Scheinwerfer Plus adaptive light (Abbiegelicht integriert)</ns3:Description>
<ns3:EquipmentGroup>BXEL</ns3:EquipmentGroup>
</ns3:EquipmentPosition>
</ns3:SpecialEquipment>
...
<ns3:DATECodeEquipment>
<ns3:EquipmentPosition>
<ns3:DatEquipmentId>97000</ns3:DatEquipmentId>
<ns3:Description>Motor 2,0 Ltr. - 103 kW TDI</ns3:Description>
</ns3:EquipmentPosition>
...
All those <DatEquipmentId> (hundreds of it) have to be used in the next following request within request parameter <equipment></equipment>, enclosed with its own tag.
I want to use only propertyTransfer to make it reuseable and tried it with the following code:
declare namespace ...;
for $b in //ns3:EquipmentPosition
return (<equipment>
{
for $y in //ns3:DatEquipmentId[$b]/text()
return string($y)
}
</equipment>)
As a result I got the following back in the following request:
<equipment>26803 40000 70303 70600 15804 15702 25702 4305 40808 40705 27805 13202 70108 70308 25805 35003 74300 27400 75205 26109 39307 10004 26901 69902 68909 18205 504 37704 86901 18301 61906 77602 33508 26903 69801 32704 32705 30305 27500 42001 31900 38106 35301 24612 24198 15201 72600 25802 22506 37901 28901 18909 1702 49004 29404 27202 68707 19102 19000 29500 18904 22202 18603 97000 10004 75205</equipment>
So, all results within one tag. But I want each of them enclosed in its own <equipment> tag.
So, I tried the next code:
declare namespace...;
for $b in //ns3:EquipmentPosition
let $y := //ns3:DatEquipmentId[$b]
for $avtext in $y
return (<equipment>{$avtext/text()}</equipment>)
As a result I got back only the first of all values, even enclosed in the correct tag:
<equipment>26803</equipment>
So, can someone help me to solve that problem, please? For different reasons I don't want to use groovy scripts, but only propertyTransfer. Is this possible?
Regards,
Heike