Creating soap request in Groovy script
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 on a custom header in the initial request.
So i figured I need to set my Mock service dispatcher to a groovy script. now is there a way to invoke a request from the Groovy script?
// create XmlHolder for request content
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
// get arguments
def replyto = holder["//replyto"]
log.info("Reply to: "+replyto);
// create a rerquest for the reply to header
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:
Of course you can also programatically make the SOAP call from your mock, heres an example of making a SOAP request programtically:
Or something similar is shown here for programatically creating a REST call:
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,
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