Forum Discussion
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:
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:
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
Thank you for answering.
However I still have issues trying to make the first solution work.
for example I get the following error:
Unable to resolve StringToObjectMap() and couldn`t find any descent solution or clear docuemntation. I am sure I am missing something here or just being stupid.
Here is what i have so far
// create XmlHolder for request content def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent ) // get arguments def synReplyTo = holder["//syn:ReplyTo"]; def synMessageId = holder["//syn:MessageId"]; // log the information log.info("Reply to: "+synReplyTo); log.info("Message Id: "+synMessageId); // create a rerquest for the reply to header def map = new StringToObjectMap() map.put("messageID", synMessageId) map.put("ReplyTo", synReplyTo) def testSuite = context.mockService.project.getTestSuiteByName("TestSuiteCallingService") def callBackTestCase = testSuite.getTestCaseByName("SOAP Request") def callBackRequest = (WsdlTestRequestStep) callBackTestCase.getTestStepsOfType(WsdlTestRequestStep.class).get(0) //callBackRequest.testRequest.setEndpoint(replyTo) callBackTestCase.run(map,true) return "EmptySoapResponse"
- AbdelwahabSadek10 years agoOccasional Contributor
I replaced StringToObjectMap() with what I assume is the full qualified name new com.eviware.soapui.support.types.StringToObjectMap() and it worked.
I`ll dig more now for more behaviors like passing parameters to the case and resolve this class WsdlTestRequestStep.
Again thank you so much for your help.
- rupert_anderson10 years agoValued Contributor
Hi,
No problem, very happy to have helped! :-)
OK, in my script I was able to resolve those classes normally - do you mean:
import com.eviware.soapui.support.types.StringToObjectMap import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
Thanks,
Rup
- AbdelwahabSadek10 years agoOccasional Contributor
Hi Rub,
yes indeed, just importing the namespaces.
This is my first task ever using Soap ui, apprently I need to do my homework :) , I`ll find a resource -most likely your book- to understand more on how does it work.
Yet I have another question if possible, about this line
callBackRequest.testRequest.setEndpoint(ReplyTo)
Are you setting the endpoint dynamically based somoe custom headers from the request ? kind of routing I presume!
Thanks and best regards,
Abdelwahab