Groovy in SOAP UI

Property Transfer in SOAP UI

Posted by: devakara on: October 8, 2008

Property transfers become crucial steps in scenarios where validations are done mostly using derived data.

Lets say after some Groovy script execution we end up setting a property value in Properties step while testing an application’s functionality. And most of the times we would be in need of the obtained result out of that groovy step. As we have it in Properties Step we can access it using Property Expansion technique and also using Property Transfer Step.

Property Transfer Step shall be in between the Properties Step and SOAP request Step, but before placing the Transfer Step have Properties and SOAP request Steps in place. Property Transfer window would something like this:

Property Transfer Step

Property Transfer Step

After creating a new Property Transfer in the above window say ‘RefNumTransfer‘, select source, in this case it would be the ‘Properties’ Step, this inturn provides the list of all properties defined under that Step, select the property you wish to transfer.

Now come to Target block, where we would have our SOAP request to catch the property transfer. Initially declare all the namespaces that your request would use, separating each of them with ‘;’ and then provide the XPath of the target node which should capture the transfered value. 

For example if the SOAP request as is below

SOAP request to catch tranfered Property

SOAP request to catch tranfered Property

then the target block of Property Transfer should contain details like this:

Declaring namespaces and adding target XPath

Declaring namespaces and adding target XPath

Try running the Property Transfer step, you see the ‘Transfer Name’ and ‘Transfered Value’ in the Transfer Log, and also correspondingly that value is reflected in the SOAP request at the target XPath.

 

(Please feel free to get back if u have any trouble…as I am just a mail away…leave otherwise a comment)

10 Responses to "Property Transfer in SOAP UI"

Hi,
i wanted to know if proeprty transfer can be done across the test cases. because what i have found that if you want to transfer the prop. you can do that to only a step in teh same tase case . but what if i have two cases in test suit and want to use the response of 1st in 2nd … i tried that but when you create a transfer prop. in teh target you can only see the items related to that test case and not the next case . please correct me if i am wrong

Hi,

If you want to transfer/use any result from one test case to another, set it as a property at TestSuite level.
And you can access the same as explained in http://groovyinsoapui.wordpress.com/2008/09/04/properties-in-soapui/.
This enables that property (which could hold the response of first test case as u said) to be flexibly used across the TestCases.

Please get back if more help is needed.

Thanks,
Devakara.

Hi,

As mentioned above in Property Transfer in SOAPUI, same i did for request, I am sending to my webservice, which results the value transferrred in request xml(test step) and Removes all code inside the request that is all tags and also removes the question mark (? where in I was expecting the value to be filled).

then If i run the test it failed, Please suggest

Hi,

Verify whether the Target option is populated properly (with appropriate value from its dropdown list)

And you didnt mention anything regarding the property’s where abouts which you are actually tranferring!

And basically to use PropertyTransfer functionality, we should have the ‘Properties‘ step as one of the TestSteps under the same TestCase.

Hope this helps!

Thanks,
Devakara.

Hi Devkara! I am having a heck of a time trying to implement a property transfer of a response node value to a request in soap ui. So I was hoping you could enlighten me! As my source I have the in the response to a calculate step, an Id value that I need to input to a request to save the corresponding Id value..so it is a fetch and save chain. I have the calc request the the pty transfer then the save request. Would I first need to pty transfer the response node value to a property and then transfer that property to the request node? Ive tried chaining the response directly to the request and it fails. When I try to invoke the xpath dialog for the target request I am prohibited from doing so. Any advice? Thanx much!!
Joan

Hi Joan,

Sorry for the delayed response…

This is what I understood abt the prob: You need to set some request node’s value using the value of some node from the response whch you previously obtained….

For this, get the value of that response node and set it to some property of the Properties step (you probably might have created one), using Property Transfer OR Groovy Script Step. After setting the property value, directly access the property value using the Property Accessing technique as explained in http://groovyinsoapui.wordpress.com/2008/09/16/accessing-properties-in-soap-request/

Actually you could also directly transfer the response node’s value to the request node, using just the property transfer method. If it didnt work for you, could you just send your request, response xmls and Property Transfer step…I shall try locally to help you out.

Hope this helps!

Thanks,
Devakara.

Hi Devkara! This site is very helpful!! But I’m having problems with property transfer – I can select the Source but when I select Response in the Property drop down, it doesn’t allow it to be selected and the drop down remains blank.

Would you know why this is? Am I missing a step or something?

Many thanks!

Chrissy

Hi Devkara. Is there a way to use Property Transfer where it will match the value from the Response and select the identifier for that defined value?

Thank you.

Cheers
Kathy

Hi Devkara, I am trying to use a datapool from a dat file in my soapUI script. I am creating users and I need to create a unique urename and email address…My username is also the email (eg. user=user1001 and email=user1001@email.com)

The username and email fields in the form are pulling the a unique username from a .csv file using a DataSource/DataSourceLoop Step.

When I run the test it fails because the form field did not actually populate data from the datasource…it is left blank during test run…I populate the properties before I run the test by pressing the green arrow in the DataSource properties screen

Any ideas why the message does not get data expected?

Leave a Reply