users@jax-rpc.java.net

ServiceFactory.createService() giving NullPointerException

From: Mark D. Hansen <khookguy_at_YAHOO.COM>
Date: Thu, 17 Jul 2003 13:18:42 -0400

I'm having trouble generating a Service instance using ServiceFactory. I keep getting NPEs. The server side is no problem. The ties get generated OK and deploy with no problem on Tomcat. But, I can't seem to generate the Service on the client side from the WSDL without getting NPEs.

Any suggestions will be much appreciated.

Here is the code for instantiation.

      String wsdlURL = "http://localhost:8080/jaxrpc-OrderProcessor/orderproc?WSDL";
      String namespaceURI = "http://www.xyzcorp.com/css/wsdl";
      String serviceName = "orderProcessingService";
      URL urlWSDL = new URL(wsdlURL);
      QName qnameService =
        new QName(namespaceURI, serviceName);
      log.info("urlWSDL = " + urlWSDL + NL +
               "qnameService = " + qnameService);
      Service orderService =
        serviceFac.createService(urlWSDL, qnameService);

Here is part of the WSDL:

<wsdl:definitions
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:xyz="http://www.xyzcorp.com/xyzcorp.xsd"
  xmlns:oms="http://www.xyzcorp.com/oms/order.xsd"
  xmlns:tns="http://www.xyzcorp.com/css/wsdl"
  targetNamespace="http://www.xyzcorp.com/css/wsdl">
  <wsdl:types>
    <schema ...>
       ....
    </schema>
  </wsdl:types>
  <wsdl:message name="order">
    <wsdl:part name="body" element="oms:SalesOrder"/>
    <wsdl:part name="messagetypeHeader" element="xyz:typeofmessage"/>
  </wsdl:message>
  <wsdl:portType name="orderProcessingPortType">
    <wsdl:operation name="orderProcessingInput">
      <wsdl:input message="tns:order"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="orderProcessingBinding" type="tns:orderProcessingPortType">
    <soapbind:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="orderProcessingInput">
      <wsdl:input>
        <soapbind:body parts="body" use="literal"/>
        <soapbind:header message="tns:order" part="messagetypeHeader" use="literal"/>
      </wsdl:input>
      <soapbind:operation style="document"/>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="orderProcessingService">
    <wsdl:port name="orderProcessingPort" binding="tns:orderProcessingBinding">
      <soapbind:address location="http://javector-server:8080/css/orders"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>