users@jax-rpc.java.net

Re: ServiceFactory.createService() giving NullPointerException

From: Arun Gupta <arun.gupta_at_sun.com>
Date: Thu, 17 Jul 2003 11:34:10 -0700

Hi Mark,

I used a WSDL similar to yours and was able to create a Service instance
easily. Here is my WSDL excerpt ...

    <wsdl:types>
        <xsd:schema targetNamespace="http://hello.org/bp1.1/types">
            <xsd:element name="stringIn" type="xsd:string"/>
            <xsd:element name="stringHeader" type="xsd:string"/>
            <xsd:element name="stringOut" type="xsd:string"/>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="echoStringInput">
        <wsdl:part name="stringIn" element="types:stringIn"/>
        <wsdl:part name="stringHeader" element="types:stringHeader"/>
    </wsdl:message>
    <wsdl:message name="echoStringOutput">
        <wsdl:part name="stringOut" element="types:stringOut"/>
    </wsdl:message>
    <wsdl:portType name="HelloPortType">
        <wsdl:operation name="echoString">
            <wsdl:input message="tns:echoStringInput"/>
            <wsdl:output message="tns:echoStringOutput"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
        <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="echoString">
            <soap:operation/>
            <wsdl:input>
                <soap:body parts="stringIn" use="literal"/>
                <soap:header message="tns:echoStringInput"
part="stringHeader" use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
            <soap:operation style="document"/>
        </wsdl:operation>
    </wsdl:binding>

The only difference in the WSDL is that message parts in my WSDL are
simple types, where as you have complex types. I dont think will make a
difference though.

Where are you picking JAX-RPC from ?

If you can send me your war file, I can investigate further.

Thanks for your interest in JAX-RPC.

Regards,
-Arun

Mark D. Hansen wrote:

>Here is the stack trace (sorry).
>
>java.lang.NullPointerException
> at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildDocumentOperation(ServiceInfoBuilder.java:335)
> at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildOperationInfo(ServiceInfoBuilder.java:185)
> at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildPortInfo(ServiceInfoBuilder.java:171)
> at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:121)
> at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(ConfiguredService.java:58)
> at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(ConfiguredService.java:47)
> at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:38)
> at com.javector.chap5.sec1.OrderProcessor.OrderProcessorClient.<init>(OrderProcessorClient.java:93)
> at com.javector.chap5.sec1.OrderProcessor.OrderProcessorClient.main(OrderProcessorClient.java:137)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:208)
> at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:150)
> at org.apache.tools.ant.taskdefs.Java.run(Java.java:443)
> at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:163)
> at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
> at org.apache.tools.ant.Task.perform(Task.java:341)
> at org.apache.tools.ant.Target.execute(Target.java:309)
> at org.apache.tools.ant.Target.performTasks(Target.java:336)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
> at org.apache.tools.ant.Main.runBuild(Main.java:609)
> at org.apache.tools.ant.Main.start(Main.java:196)
> at org.apache.tools.ant.Main.main(Main.java:235)
>
>-----Original Message-----
>From: Public discussion on JAX-RPC
>[mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM]On Behalf Of Mark D. Hansen
>Sent: Thursday, July 17, 2003 1:19 PM
>To: JAXRPC-INTEREST_at_JAVA.SUN.COM
>Subject: ServiceFactory.createService() giving NullPointerException
>
>
>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>
>
>

--
=============================================
There is only one me, I must live myself!
There is only one today, I must live itself!
=============================================
http://members.tripod.com/~apgupta/index.html
=============================================