Forum Discussion

elvistudio's avatar
15 years ago

Data from response to be added into request with additions

Hi!
I need to use parameter's value of response as parameter's value+some text of the following request. Is it possible to do using SoapUI?
Here is the e.g.:
1. the response is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getAdvancedCommentsResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://customer.business.ebridge.mediaspectrum.com">
<getAdvancedCommentsReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><ad id="101038"><point><x>10</x><y>8</y><number/><groupNumber>1</groupNumber><comment><username>test</username><userid>567</userid><usertype>user</usertype><date>07/15/2010 12:37:55:650 MSD</date><text>TRN0000000567-01</text><timestamp>1279183075650</timestamp></comment></point></ad>]]></getAdvancedCommentsReturn>
</ns1:getAdvancedCommentsResponse>
</soapenv:Body>
</soapenv:Envelope>
2. I need to send the request that uses parameter's value of the previous request (xml data) with inserted new data as:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://customer.business.ebridge.mediaspectrum.com">
<soapenv:Header/>
<soapenv:Body>
<cus:setAdvancedComments soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0 xsi:type="ebr:userContext" xmlns:ebr="ebridge:UserContext">
<name xsi:type="soapenc:string">test</name>
<ip xsi:type="soapenc:string"/>
<password xsi:type="soapenc:string">test</password>
<DBName xsi:type="soapenc:string">test</DBName>
</in0>
<in1 xsi:type="soapenc:long" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">${Properties#ad1}</in1>
<in2 xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><ad id="101038"><point><x>10</x><y>8</y><number/><groupNumber>1</groupNumber><comment><username>test</username><userid>567</userid><usertype>user</usertype><date>07/15/2010 12:37:55:650 MSD</date><text>TRN0000000567-01</text><timestamp>1279183075650</timestamp></comment></point></ad>]]></in2>
</cus:setAdvancedComments>
</soapenv:Body>
</soapenv:Envelope>

I need to insert one more <point> node into this request.

What I did: I created Property Transfer where I use XQuery to extract the value I need from response (//getAdvancedCommentsReturn) and inserted it in the following request's in2 (//in2). This works good but since I need these methods to repeat a lot (getAdvancedComments, then setAdvancedComments, then getAdvancedComments again etc), I have the same data repeated, but I need it to be as "some data from response"+my_data+"some data from response" i.e. I need some data (it can be static, the same every time) to be added in request.
How can I do this, any thoughts?

Thanks a lot!
  • dothebart's avatar
    dothebart
    New Contributor
    I have some similar questions. I've started out with Apache JMeter (which doesn't offer a way to validate a reply to a WSDL ), I was wondering, whether there is an easy way to have
    * a central point to configure the Endpoint for all tests (so one can switch between different installations of the same service; like 'User Defined Varables' in JMeter)
    * a way to set global defines from soap responses (like session-IDs or item IDs one wants to use in later requests, like one does with XPath-Extractors in JMeter)

    I've found the 'GetData->Project->New' which for some reason didn't seem obvious, and wasn't mentioned in most examples...
    I've seen some examples using Groovy to do Scripted requests, is that the only way to do this? Or is this a Pro-Version-Featuer?