Ask a Question

How to transfer request received in Mock Service into a test step

SOLVED
zkhopekar
New Contributor

How to transfer request received in Mock Service into a test step

Hi,

 

I am using a mock service in SoapUI to test the request to request transformation of a webservice.

 

Can someone please tell me how can i capture the request that is received in the mockservice and add it to a test step in my test suit where i have triggered this SOAP request.

 

Any help is HIGHLY appreciated. Thanks

3 REPLIES 3
rupert_anderson
Valued Contributor

Hi,

 

As I can't remember if it is possible to access a mock request using a property expansion (it may be, but I never have and someone else may be able to help?), my first thought was to:

 

In the mock's OnRequest script

 

1.Capture the request data e.g. something like def requestData = mockRequest.requestContent

 

2.Store it in a Global property e.g. 

 

import com.eviware.soapui.SoapUI

SoapUI.globalProperties.setPropertyValue( "requestData", requestData)

 

3. You can then access this property elsewhere (outside mock scipts etc) using

 

import com.eviware.soapui.SoapUI

def requestData = SoapUI.globalProperties.getPropertyValue( "requestData")

 

Does this sound of any use?

 

A related, but slightly different mock data transfer situation, including more options for storage, was discussed a while ago in this post: http://community.smartbear.com/t5/SoapUI-Open-Source/Need-to-use-response-elements-from-one-mock-ope...

 

Cheers,

Rupert

Author of SoapUI Cookbook

Thank you Rupert! that helped me immensely to update the script i had. Also thanks for the related article im sure ill be using it at some point.

 

Cheers,

Zaid

Hi Zaid,

 

No problem, happy to have helped! 🙂

 

Thanks for the reply and marking the solution as accepted,

 

Cheers,

Rup

Author of SoapUI Cookbook
cancel
Showing results for 
Search instead for 
Did you mean: