Eviware Forum

soapUI => soapUI => Topic started by: richard mccarthy on September 01, 2008, 12:32:36 pm



Title: Null pointer exception in findOperationForRequest
Post by: richard mccarthy on September 01, 2008, 12:32:36 pm
I have a simple WSDL (see end of post) and when I create a mock service from it and try to invoke the only opertion I get the following exception stack, any ideas what could be causing this ?

SOAP UI seems to happy to create a sample response but it does not make a sample request, just an empty soap body in the envelope.

Mon Sep 01 12:05:18 BST 2008:ERROR: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.dispatchMockRequest(WsdlMockRunner.java:57)
      at com.eviware.soapui.monitor.MockEngine$ServerHandler.handle(MockEngine.java:296)
      at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
      at org.mortbay.jetty.Server.handle(Server.java:313)
      at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
      at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
      at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
      at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
      at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
      at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
      at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
   Caused by: java.lang.NullPointerException
      at com.eviware.soapui.impl.wsdl.support.soap.SoapUtils.findOperationForRequest(SoapUtils.java:187)
      at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchMockRequest(WsdlMockRunner.java:247)
      ... 11 more


The WSDL is shown below

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://abc.co.uk/DrillDownLocationResults" targetNamespace="http://abc.co.uk/DrillDownLocationResults" xmlns:sch="http://abc.co.uk/DrillDownLocationResults/types">
   <wsdl:types>
      <xs:schema targetNamespace="http://abc.co.uk/DrillDownLocationResults/types" elementFormDefault="unqualified" xmlns="http://abc.co.uk/DrillDownLocationResults/types">
         <xs:element name="abc" type="nameType"/>
         <xs:element name="abcResponse" type="nameType"/>
         <xs:complexType name="nameType">
            <xs:sequence>
               <xs:element name="firstname" type="xs:string"/>
               <xs:element name="surname" type="xs:string"/>
            </xs:sequence>
         </xs:complexType>
      </xs:schema>
   </wsdl:types>
   <wsdl:message name="abcSoapIn">
      <xs:element name="parameters" element="sch:abc"/>
   </wsdl:message>
   <wsdl:message name="abcSoapOut">
      <wsdl:part name="parameters" element="sch:abcResponse"/>
   </wsdl:message>
   <wsdl:portType name="abcSoapPortType">
      <wsdl:operation name="abc">
         <wsdl:input message="tns:abcSoapIn"/>
         <wsdl:output message="tns:abcSoapOut"/>
      </wsdl:operation>
   </wsdl:portType>
   <wsdl:binding name="abcSoapBinding" type="tns:abcSoapPortType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="abc">
         <soap:operation soapAction="http://abc.co.uk/DrillDownLocationResults/location/abc" style="document"/>
         <wsdl:input>
            <soap:body use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <soap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="LWSWebService">
      <wsdl:port name="abcSoapPort" binding="tns:abcSoapBinding">
         <soap:address location="No Target Adress"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


Title: Re: Null pointer exception in findOperationForRequest
Post by: richard mccarthy on September 02, 2008, 10:47:54 am
Doh, found the issue. My WSDL was incorrect in the message definiton for the input.

  <wsdl:message name="abcSoapIn">
      <xs:element name="parameters" element="sch:abc"/>
   </wsdl:message>

This should not contain an xs:element but a wsdl:part

Apart from my dumb mistake I am surprised that XML spy would validate the wsdl.