Getting DispatchException: Missing operation for soapAction [xyz] and body element [null]
I am stuck with one exception while trying to achieve a scenario using SoapUI(open source version 5.6.0) tool. The scenario is like below:
I have an external application client which is sending a Soap message with attachment(pdf document) to SoapUI. I have a mock server running in SoapUI tool to receive the message and in the OnRequest script I am able to receive the message and the received message is in the form of ByteArrayInputStream. I am able to read the XML and attachment content and store them successfully. The problem is when the tool finishes the execution of OnRequest script and when it moves on to execute the Dispatch script I am getting below exception and this exception occurs even before executing the dispatch script.
Thu Sep 02 09:20:25 EDT 2021:ERROR:com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing operation for soapAction [xyz] and body element [null] with SOAP Version [SOAP 1.1]
com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing operation for soapAction [xyz] and body element [null] with SOAP Version [SOAP 1.1]
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchPostRequest(WsdlMockDispatcher.java:236)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchRequest(WsdlMockDispatcher.java:114)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:144)
at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:606)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835)
Modifications that I have tried to solve the issue:
In MockResponse properties I have set Enable MTOM = true and Enable multiparts = true
In MockService properties I have set Match SOAP Version = false and Require SOAP Action = false
But none of the above configurations solved the exception.
My OnRequest Script logic:
def attachments = mockRequest.getRequestAttachments();
log.info "Number of attachments received: " + attachments.size(); //array size is 2, 1st index being the XML and 2nd index being the attachment(pdf)
def inputStream1
def inputStream2
if(attachments.size() > 0){
inputStream1 = attachments[0].getInputStream() //able to get the XML correctly
inputStream2 = attachments[1].getInputStream() //able to get the attachment(pdf) correctly
def receivedXml = inputStream1.getText("UTF-8")
def attachmentContent = inputStream2.getText()
log.info "Incoming XML is: " + receivedXml
log.info "attachment content is: " + attachmentContent
}
else{
log.info 'No attachments found!!!'
}
Can someone help me out with the solution to handle this exception? Also why this exception is thrown before executing the Dispatch script?