Forum Discussion

Stephen_Seltzer's avatar
Stephen_Seltzer
New Contributor
17 years ago

Failed to get SOAP Version of request

Given the following:
soapUI 2.0
jboss 4.2.0
Jakarta Commons HTTP client
java version "1.5.0_07"

I have an application that is sending a message via HTTPClient using PostMethod. I have set up a mock service in soapUI using the wsdl for the webservice. To debug I have put out the message being sent to the console. When I copy that message, paste it into a request in soapUI, and submit it to the mock service, it works. When I submit the request via HTTPClient.executeMethod(), I get an error in the soapUI logs indicating that it Failed to get SOAP Version of request.

I have:
1)Ensured that the message is valid as indicated above
2)Set the HttpVersion in the HttpClientParams of the HTTPClient.

After my call, I get the following back from soapUI (appropriate given the error):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>Server</faultcode>
      <faultstring>java.lang.Exception: Failed to get SOAP Version of request</faultstring>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>
Post Request Status: HTTP/1.1 500 Internal Server Error

Any suggestions? I cannot figure out where/how to set the SOAP version.

Here is the full error text from the error log:
2008-01-02 15:08:04,281 ERROR [errorlog] com.eviware.soapui.impl.wsdl.mock.DispatchException: java.lang.NullPointerException
com.eviware.soapui.impl.wsdl.mock.DispatchException: java.lang.NullPointerException
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:264)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:50)
at com.eviware.soapui.monitor.MockEngine$ServerHandler.handle(MockEngine.java:236)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:295)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:361)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
Caused by: java.lang.NullPointerException
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRequest.initSoapVersion(WsdlMockRequest.java:96)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRequest.<init>(WsdlMockRequest.java:87)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:147)
... 11 more
2008-01-02 15:08:04,297 WARN  [jetty] EXCEPTION
java.lang.NullPointerException
at com.eviware.soapui.impl.wsdl.support.soap.SoapVersion$Utils.getSoapVersionForContentType(SoapVersion.java:81)
at com.eviware.soapui.monitor.MockEngine$ServerHandler.handle(MockEngine.java:243)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:295)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:503)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:827)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:511)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:210)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:379)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:361)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)

6 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    depending on which SOAP Version you are using you need to add the appropriate HTTP-Headers.. easiest is probably if you have a look at the HTTP log or Raw message viewers in soapUI when calling the mock-service, then see to it that the same headers are added to your HTTP-Client request;

    - for SOAP 1.1 make sure that the SOAP-Action and content-type headers are correct
    - for SOAP 1.2, the SOAP Action is part of the content-type header

    hope this helps!

    regards,

    /Ole
    eviware.com
  • Thanks for the suggestion but unfortunately I am still not able to get it going. When I submit my request from within soapUI, I checked the HTTP Log and saw:
    "POST /CaseGet HTTP/1.1[\r][\n]"
    "Content-Type: text/xml;charset=UTF-8[\r][\n]"
    "SOAPAction: "http://www.courts.state.mn.us/IS/02/CaseGetRequest"[\r][\n]"
    "User-Agent: Jakarta Commons-HttpClient/3.0.1[\r][\n]"
    "Host: 127.0.0.1:18080[\r][\n]"
    "Content-Length: 4788[\r][\n]"


    The following code excerpts show where I am setting the same:
    private String executeWebService(String url, String request) {
    PostMethod post = null;
    try {
      HttpClient client = new HttpClient();
      RequestEntity requestEntity = new StringRequestEntity(request,"text/xml","UTF-8");
      post = new PostMethod(url);
      HttpClientParams methParams = client.getParams();
      HttpVersion protoVersion = new HttpVersion(1,1);
      methParams.setVersion(protoVersion);
      client.setParams(methParams);

      post.setRequestEntity(requestEntity);
      post.addParameter("SoapAction", "http://www.courts.state.mn.us/IS/02/CaseGetRequest");
      client.executeMethod(post);
      InputStream responseIn = post.getResponseBodyAsStream();
    }
    }
  • I finally got it working. Though I hate to admit it, I have no idea what the problem was .   After making the suggested changes and not getting the call to work, I decided to clear out some code and move back to the basics. Suddenly my call worked. I am pretty sure that my current code is the same as it was earlier in the process but there are so many variables between my code and my soapUI mock service configuration that I don't really know.

    Anyway, a big thanks to omatzura for the time and suggestions!