Forum Discussion

AbdelwahabSadek's avatar
AbdelwahabSadek
Occasional Contributor
9 years ago

Creating soap request in Groovy script

Hi,   I have the following scenario that I am trying to replicate in Soap UI:   1-Client initate request. 2-Service resposes with an empty soap message 3-Service invokes another request based o...
  • rupert_anderson's avatar
    9 years ago

    Hi,

     

    It sounds like you might be trying to mock up a kind of async calback type scenario?

     

    If so, one way to trigger the request via your mock is to invoke a TestCase which makes the Request - for an example please see:

     

    http://community.smartbear.com/t5/SoapUI-Open-Source/How-to-simulate-an-asynchronous-web-service-with-mock-services/m-p/98348#M17494

     

    Of course you can also programatically make the SOAP call from your mock, heres an example of making a SOAP request programtically:

     

    http://community.smartbear.com/t5/SoapUI-Open-Source/How-to-get-parameter-of-SOAP-operation/m-p/99768#M17648

     

    Or something similar is shown here for programatically creating a REST call:

     

    community.smartbear.com/t5/SoapUI-Open-Source/How-to-create-REST-project-using-Groovy-script/m-p/99305#M17568

     

    One advantage of the first approach (triggering a TestCase) is that the Mock can dispatch its response before the callback SOAP request is made. 

     

    Hope this helps give you some ideas,

     

    Rupert

  • rupert_anderson's avatar
    rupert_anderson
    9 years ago

    Hi Abdelwahab,

     

    If this is your first task with SoapUI, then I would say your homework is going well, its seems you have picked things up quickly! :-)

     

    If you do get my book, I would love to hear how you found it, any good and bad points, could help me to improve. 

     

    Yes, a kind of routing - the basis of our discussion here is from a recipe in the book, the topic is how to test & mock a SOAP async callbacks. The replyTo is in reference to the WS-Addressing standard, and its value is taken from the request like you say.

     

    In the recipe, there is a SoapUI situation someting like:

    1. Client TestRequest to mock (passing ReplyTo and messageId)

    2. Mock responds with acknowledgement.

    3. Mock triggers callBack to address in ReplyTo (after some delay) 

    4. SOAP Mock Response TestStep recieves callback and runs Assertions

     

    Best Regards,

    Rup