Programmatically retrieveing SOAP request from a MockService (not from OnRequest script)
Hi guys,
I'm trying to get a Request object (see the image1.png below) from a MockService.
This woudln't be a problem to do if I was in the context of the running MockService, where it's easily available in the OnRequest script.
However, due to the structure of our tests, I needs to access the Request object from a Script TestStep.
Since it's available in the UI and I'm working directly with the object model, I believe it must be possible to do this, but even after quite thorough research of the API docs, I was unable to to achieve what I need :(
I think it should be available either from the WsdlMockService or the WsdlMockRunner object (although the request list persists atfer the mock service is stopped, so MockRunner is probably a wrong direction...).
Here is a code snippet which I started with:
import com.eviware.soapui.impl.wsdl.WsdlTestSuite; import com.eviware.soapui.impl.wsdl.WsdlProject; import com.eviware.soapui.impl.wsdl.mock.WsdlMockService; import com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner WsdlTestSuite testSuite = testRunner.runContext.testCase.testSuite; WsdlProject project = testSuite.project; WsdlMockService mockService = project.getMockServiceByName("mockServiceName"); WsdlMockRunner mockRunner = mockService.getMockRunner();
Now, I guess I should go somewhere from the "mockService" object.
Do you have any idea where?
Thanks :)
Jakub
//Edit: obviously, I need to get hold of the MessageExchange object. I'll try to go there and update if I succeed :)