You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Eddie O'Sullivan <eo...@qad.com> on 2016/11/18 11:59:22 UTC
Dynamic XML Response Manipulation
Hi all,
We are looking to do some SOAP WSDL testing using JMeter. The scenario we
are trying to cover is as follows:
1. Req1 - GET request that returns and XML file (this may change over
time but the nodes we are interested in remain the same)
2. Modify the XML changing the values
3. Req2 - POST the modified XML into a Request
Modifying the XML can be achieved relatively easily in SOAPUI using the
Property Transfer but we would rather stick to JMeter.
Are there any plugins or suggestions on an easy way that the XML response
can be manipulated before sending in a subsequent request?
Thanks in advance,
Eddie
Re: Dynamic XML Response Manipulation
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 24.11.2016 um 17:51 schrieb Eddie O'Sullivan:
> Hi Felix,
>
> I got this working by doing the following:
Great to hear.
>
> - Set Variables I wanted to change in the dataset
> - Req 1 - GET. I stored the response in a JMeter variable via a regular
> expression
If the response is XML, you could have a look at the xpath extractor. It
might be easier and less error prone.
> - Beashell code to dynamically change the Nodes in the XML to my JMeter
> Variable values storing the results in the JMeter variable extracted from
> Req1
As JMeter includes groovy as a JSR223 language, you could that groovy
power to manipulate XML snippets with it. For example (as attached):
import groovy.xml.XmlUtil
def personOne = new XmlParser().parseText(vars.get('personOne'))
personOne.value = 'Changed'
vars.put('personOneChanged', XmlUtil.serialize(personOne))
Where the var personOne was extracted from the xml snippet
<root><person id="1">Joe</person><person id="2">Jane</person></root>
with the xpath
//person[@id='1'] and placed in the var named 'personOne'
> - Req 2 - Send my updated JMeter Variable to the Post
That should be easy.
I don't know if it is faster than your solution, but I guess it looks
simpler.
Regards,
Felix
>
> Regards,
> Eddie
>
>
> On 19 November 2016 at 19:41, Felix Schumacher <
> felix.schumacher@internetallee.de> wrote:
>
>> Am 18.11.2016 um 12:59 schrieb Eddie O'Sullivan:
>>
>>> Hi all,
>>>
>>> We are looking to do some SOAP WSDL testing using JMeter. The scenario we
>>> are trying to cover is as follows:
>>>
>>> 1. Req1 - GET request that returns and XML file (this may change over
>>> time but the nodes we are interested in remain the same)
>>> 2. Modify the XML changing the values
>>> 3. Req2 - POST the modified XML into a Request
>>>
>>> Modifying the XML can be achieved relatively easily in SOAPUI using the
>>> Property Transfer but we would rather stick to JMeter.
>>>
>> So you get a xml result, from which you want to keep some node (with its
>> sub-nodes) and modify that, by replacing some pre-known values with other
>> values?
>>
>> The property transfer looked to me to be more like: Get a xml result.
>> Extract values from it into properties and use those to modify some
>> pre-known answer xml.
>>
>> The latter workflow can be modelled by post-processors and usage of JMeter
>> variables.
>>
>> Do you really need the former?
>>
>> Regards,
>> Felix
>>
>>> Are there any plugins or suggestions on an easy way that the XML response
>>> can be manipulated before sending in a subsequent request?
>>>
>>> Thanks in advance,
>>> Eddie
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
>>
>
Re: Dynamic XML Response Manipulation
Posted by Eddie O'Sullivan <eo...@qad.com>.
Hi Felix,
I got this working by doing the following:
- Set Variables I wanted to change in the dataset
- Req 1 - GET. I stored the response in a JMeter variable via a regular
expression
- Beashell code to dynamically change the Nodes in the XML to my JMeter
Variable values storing the results in the JMeter variable extracted from
Req1
- Req 2 - Send my updated JMeter Variable to the Post
Regards,
Eddie
On 19 November 2016 at 19:41, Felix Schumacher <
felix.schumacher@internetallee.de> wrote:
> Am 18.11.2016 um 12:59 schrieb Eddie O'Sullivan:
>
>> Hi all,
>>
>> We are looking to do some SOAP WSDL testing using JMeter. The scenario we
>> are trying to cover is as follows:
>>
>> 1. Req1 - GET request that returns and XML file (this may change over
>> time but the nodes we are interested in remain the same)
>> 2. Modify the XML changing the values
>> 3. Req2 - POST the modified XML into a Request
>>
>> Modifying the XML can be achieved relatively easily in SOAPUI using the
>> Property Transfer but we would rather stick to JMeter.
>>
> So you get a xml result, from which you want to keep some node (with its
> sub-nodes) and modify that, by replacing some pre-known values with other
> values?
>
> The property transfer looked to me to be more like: Get a xml result.
> Extract values from it into properties and use those to modify some
> pre-known answer xml.
>
> The latter workflow can be modelled by post-processors and usage of JMeter
> variables.
>
> Do you really need the former?
>
> Regards,
> Felix
>
>>
>> Are there any plugins or suggestions on an easy way that the XML response
>> can be manipulated before sending in a subsequent request?
>>
>> Thanks in advance,
>> Eddie
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>
>
--
Eddie O'Sullivan
Senior Performance Engineer
+353 61 21 3616
eos@qad.com
QAD,
Hamilton House,
National Technological Park,
Limerick, Ireland
http://www.qad.com
QAD - Our Passion. Your Advantage
Re: Dynamic XML Response Manipulation
Posted by Felix Schumacher <fe...@internetallee.de>.
Am 18.11.2016 um 12:59 schrieb Eddie O'Sullivan:
> Hi all,
>
> We are looking to do some SOAP WSDL testing using JMeter. The scenario we
> are trying to cover is as follows:
>
> 1. Req1 - GET request that returns and XML file (this may change over
> time but the nodes we are interested in remain the same)
> 2. Modify the XML changing the values
> 3. Req2 - POST the modified XML into a Request
>
> Modifying the XML can be achieved relatively easily in SOAPUI using the
> Property Transfer but we would rather stick to JMeter.
So you get a xml result, from which you want to keep some node (with its
sub-nodes) and modify that, by replacing some pre-known values with
other values?
The property transfer looked to me to be more like: Get a xml result.
Extract values from it into properties and use those to modify some
pre-known answer xml.
The latter workflow can be modelled by post-processors and usage of
JMeter variables.
Do you really need the former?
Regards,
Felix
>
> Are there any plugins or suggestions on an easy way that the XML response
> can be manipulated before sending in a subsequent request?
>
> Thanks in advance,
> Eddie
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org