Forum Discussion

zkhopekar's avatar
zkhopekar
New Contributor
9 years ago
Solved

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 mockser...
  • rupert_anderson's avatar
    9 years ago

    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-operation-in-another/m-p/98305#M17486

     

    Cheers,

    Rupert