Forum Discussion

mike12345's avatar
mike12345
New Contributor
16 years ago

mock request with null-parameter operation

Hi, I am using 2.5.1 and am trying to run a mock service based on the WSDL generated for a POJO Service originally written in Axis2 that has a simple, no-argument ping operation. eg, the service method looks something like

public MyResponse ping() { ... } 


without including the entire WSDL, snippets of the messages and portType sections look like
  
<wsdl:message name="pingRequest" />
<wsdl:message name="pingResponse">
  <wsdl:part name="parameters" element="ns:pingResponse" />
</wsdl:message>
...
<wsdl:operation name="ping">
  <wsdl:input message="axis2:pingRequest" wsaw:Action="urn:ping" />
  <wsdl:output message="axis2:pingResponse" wsaw:Action="urn:pingResponse" />
</wsdl:operation>


Note the pingRequest is empty. If I use soapUI to generate a default request from schema it produces:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header/>
  <soapenv:Body/>
</soapenv:Envelope>


But when I issue such a request the mock service throws a dispatch exception as follows:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
  <soapenv:Body>
      <soapenv:Fault>
        <faultcode>Server</faultcode>
        <faultstring>com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing content element in body</faultstring>

      </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>


specifically

Thu Apr 02 14:52:18 PDT 2009:ERROR:com.eviware.soapui.impl.wsdl.mock.DispatchException: com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing content element in body

  com.eviware.soapui.impl.wsdl.mock.DispatchException: com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing content element in body

        at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:387)
        at com.eviware.soapui.monitor.MockEngine$ServerHandler.handle(MockEngine.java:596)
        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:324)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:828)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
        at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
  Caused by: com.eviware.soapui.impl.wsdl.mock.DispatchException: Missing content element in body
        at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.findOperationForRequest(SoapUtils.java:202)
        at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchPostRequest(WsdlMockRunner.java:255)
        at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:377)
        ... 11 more


I tried using a Groovy script to verify the contents of the mockRequest and mockRequest.getContentElement() returns null, which seems expected, though there seems to be code in other areas of the processing where that will cause this or a similar exception.

I also tried using a pre-dispatch script to try to play with the contents, which causes the content element to be non-null, but then of course it cant be dispatched because there is no operation defined in the wsdl with a non-null input for ping.

Does soapUI not allow empty envelope bodies in the mock service? If not, how is a no-parameter operation invoked? This kind of soap request is handled fine in other deployment environments.

thanks in advance for any guidance,

mike

6 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Mike,


    I believe your request is not valid because it has an empty body and soapUI (mock service) doesn't handle it. I have re-read WS-I Basic Profile Messages section for compliance and it appears that empty SOAP bodies are legal.

    The support for empty SOAP body will be added.
    Thank you for reporting this bug!


    Cheers!
    /Nenad Nikolic a.k.a. Shonzilla
  • mike12345's avatar
    mike12345
    New Contributor
    Thank you Nenad for looking into and addressing this.

    I look forward to trying this out when it is available.

    thanks again,

    mike
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Mike,

    I wonder if you could attach the entire WSDL containing this operation so  I can try it out with our fix..

    regards!

    /Ole
    eviware.com
  • mike12345's avatar
    mike12345
    New Contributor
    Hi, I attached a WSDL file that exhibits this problem. Sorry for its goofy structure, I wanted to leave it as original as possible from the Axis2 source, but also wanted to remove other, irrelevant operations.

    I created a new WSDL project using this WSDL as the basis, then after the project was there added a mock service based on it, started that and issues the default ping request from the project, choosing the loopback address end point and got the soap fault.

    thanks,

    Mike
  • mike12345's avatar
    mike12345
    New Contributor
    Hi Ole, the nightly build also now works properly for me.

    Thank you very much for addressing this issue!

    Mike