Forum Discussion

erki's avatar
erki
Occasional Contributor
12 years ago

setting operation manually in mock

i am doing some webservice testing and several of those webservices and requests to those (from UI to mock) services are broken. The problem is that i am receiving
Missing operation for soapAction [] and body element [...]
, because incoming requests don't have soapAction defined nor using namespaces the way that mock could decide which operation it is.
Now i have the corresponding responses in mock, but how can I tell the mock that some certain request corresponds to certain operation that should be handled by mock.

I have already tried setting the soapAction in OnRequest script of mock service using
mockRequest.setSoapAction(action)
, where action is the action that i get when I run the request using SoapUI itself (so it should be correct one), but still it is not working and i get the same DispatchException.

Second thing I would like to try is to set the
mockRequest.setMockOperation(operation)
, but i cant figure how to properly initiate
com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation
. Can anybody help me with this?

At the moment I am using in OnRequest:

if(mockRequest.requestContent.contains("some_unique_stuff")){
def content = """ string content of the request that works """
mockRequest.setRequestContent(content);
}

This is working, but it is really ugly.
No RepliesBe the first to reply