facebook

Null Pointer Exception generating client stubs

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #267661 Reply

    Ian Otto
    Member

    I am getting a null pointer exception when trying to generate a web service client from moderately complex wsdl generated from WCF under .NET 3.

    The WSDL passes the WS-I Basic profile check using the java tool from ws-i.org. Using MyEclipse: 20070123-5.5.0-Milestone1, I get a null pointer exception in both the WSDL Validation and Code Generation.

    
    !ENTRY com.genuitec.eclipse.ws.xfire 4 0 2007-03-20 12:09:06.359
    !MESSAGE Error generating services
    !STACK 0
    java.lang.NullPointerException
        at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.getExceptionClass(AbstractServiceGenerator.java:294)
        at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generateFaults(AbstractServiceGenerator.java:273)
        at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generateOperation(AbstractServiceGenerator.java:238)
        at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generate(AbstractServiceGenerator.java:119)
        at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generate(AbstractServiceGenerator.java:63)
        at org.codehaus.xfire.gen.jsr181.ServiceInterfaceGenerator.generate(ServiceInterfaceGenerator.java:48)
        at org.codehaus.xfire.gen.jsr181.AbstractServiceGenerator.generate(AbstractServiceGenerator.java:50)
        at org.codehaus.xfire.gen.Wsdl11Generator.generate(Wsdl11Generator.java:164)
        at com.genuitec.eclipse.ws.xfire.generator.WSGenJob.run(WSGenJob.java:209)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
    
    

    It appears that the problem is somehow related to the handling of SOAP faults. In an effort to discern more, I called the Wsdl11Generator directly using something close to the following code:

    
    
            org.codehaus.xfire.gen.Wsdl11Generator gen = new org.codehaus.xfire.gen.Wsdl11Generator();
            gen.setWsdl("http://dotnetbox/s002/Service.svc?wsdl");
            
            gen.setOutputDirectory("c:\\gen");
            gen.setDestinationPackage("s002.stubs");
            gen.setGenerateServerStubs(false);
            try {
                gen.generate();
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
    

    This ran through without error and appears to have generated correct code, although I am yet to test it against the .NET service.

    Is there something that WsGenJob sets which my little code snippet doesn’t which is essential for the proper generation of the stubs?

    Ian Otto
    Department of Industry, Tourism, and Resources
    Canberra, Australia
    http://www.industry.gov.au

    #267715 Reply

    Riyad Kalla
    Member

    Ian,
    I’ve asked someone from our WS team to follow up with you.

    #268125 Reply

    gpinkham
    Member

    Could I get in on the follow up? I have the same issue.

    Same log errors.. And I too have a custom Fault being returned.. (I think I saw another posting where the person had issues with a pojo that returned a custom fault…)

    Gary

    #268128 Reply

    Riyad Kalla
    Member

    Guys I asked one of our WS devs and he had no ideas… can you both posts some WSDLs that we could see?

    #268131 Reply

    gpinkham
    Member

    On extra Note.. When I removed all references to the Fault.. I could generate the client. With the Faults in the WSDL I recieved the errors from above messages

    
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions xmlns:tns="urn:services-foo-com:aaa" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:services-foo-com:aaa" name="AAAService">
        <types>
            <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:services-foo-com:aaa" elementFormDefault="unqualified" attributeFormDefault="unqualified">
                <xsd:element name="AuthenticateInput">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="Name" type="xsd:string"/>
                            <xsd:element name="Password" type="xsd:string"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="AuthenticateOutput">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="IsAuthenticated" type="xsd:boolean"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
                <xsd:element name="AAAServiceFault">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="Message" type="xsd:string"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:schema>
        </types>
        <message name="AuthenticateInput">
            <part name="parameters" element="tns:AuthenticateInput"/>
        </message>
        <message name="AuthenticateOutput">
            <part name="parameters" element="tns:AuthenticateOutput"/>
        </message>
        <message name="AAAServiceFault">
            <part name="fault" element="tns:AAAServiceFault"/>
        </message>
        <portType name="AAAPortType">
            <operation name="Authenticate">
                <input message="tns:AuthenticateInput"/>
                <output message="tns:AuthenticateOutput"/>
                <fault name="AAAServiceFault" message="tns:AAAServiceFault"/>
            </operation>
        </portType>
        <binding name="AAABinding" type="tns:AAAPortType">
            <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <operation name="Authenticate">
                <soap:operation soapAction="/Authenticate" style="document"/>
                <input>
                    <soap:body use="literal"/>
                </input>
                <output>
                    <soap:body use="literal"/>
                </output>
                <fault name="AAAServiceFault">
                    <soap:fault name="AAAServiceFault" use="literal"/>
                </fault>
            </operation>
        </binding>
        <service name="AAAService">
            <port name="AAAPort" binding="tns:AAABinding">
                <soap:address location="http://localhost/foo/services/AAAService"/>
            </port>
        </service>
    </definitions>
    
    
    #268206 Reply

    Brett Zamora
    Member

    Hi…

    I was recieving the same error. I removed the Faults out of my WSDL too and was able to successfully generate the stubs for the client. What’s up with this?

    Regards,

    Brett

    #268207 Reply

    Riyad Kalla
    Member

    Brett,
    I sent your guy’s findings off to our WS dev. But the dev team is 110% on product right now getting ready for the 5.5M2 release so there may be a delay until he gets a chance to look at it.

    I don’t want to leave you guys high and dry, it’s just an issue of not having resources to look at this right away. Please ping me again if you don’t hear back by end of next week and I’ll re-shuffle to the top of my deck and see if we can dig into this.

    #268221 Reply

    Ian Otto
    Member

    Hi,
    Initial testing using the workaround above in my initial post seems to produce working stubs. Still, it would be good to know if there are any hidden gotchas.
    Ian Otto
    Department of Industry, Tourism, and Resources
    Canberra, Australia
    http://www.industry.gov.au

    #270184 Reply

    I am getting the same excat errors on the webservice client creation. Did anybody get past this error. Please let me know
    Vibhi
    WS Development

    #270646 Reply

    erlaan
    Member

    I installed the XFire plugin for Eclipse and used it to generate the client (and server) stubs. That worked.

    I also filled a bug for MyEclipse 5.1 and 5.5 in the bug forum (see https://www.genuitec.com/forums/topic/5-1-amp-5-5-generating-web-service-client-results-in-npe/)

    #270671 Reply

    Riyad Kalla
    Member

    erlaan, thank you for the report, I followed up in your other thread.

    #274999 Reply

    huysmki
    Member

    I’m working with MyEclipse Enterprise Workbench Version: 6.0.0 GA Build id: 6.0.0-GA-200708 and I have exact the same problem. It seems that this bug exists sinds version 5.1. Any idea when there will be a fix?

    #275018 Reply

    Riyad Kalla
    Member

    huysmki,
    Do you have an example WSDL we can look at?

    #275037 Reply

    huysmki
    Member

    Hi Riyad,

    This is the WSDL I am using.The validation of the WSDL is successfull, but when I want to create the Client Stub I get a NullPaointerException.

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <wsdl:definitions targetNamespace=”http://webservice.rhea.be&#8221; xmlns:soapenc12=”http://www.w3.org/2003/05/soap-encoding&#8221; xmlns:tns=”http://webservice.rhea.be&#8221; xmlns:wsdl=”http://schemas.xmlsoap.org/wsdl/&#8221; xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:soap11=”http://schemas.xmlsoap.org/soap/envelope/&#8221; xmlns:wsdlsoap=”http://schemas.xmlsoap.org/wsdl/soap/&#8221; xmlns:soapenc11=”http://schemas.xmlsoap.org/soap/encoding/&#8221; xmlns:soap12=”http://www.w3.org/2003/05/soap-envelope”&gt;
    <wsdl:types>
    <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; attributeFormDefault=”qualified” elementFormDefault=”qualified” targetNamespace=”http://webservice.rhea.be”&gt;
    <xsd:complexType name=”RegistrationInfo”>
    <xsd:sequence>
    <xsd:element minOccurs=”0″ name=”bus” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”email” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”institution” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”name” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”number” type=”xsd:int”/>
    <xsd:element minOccurs=”0″ name=”phone” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”postalCode” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”product” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”remarks” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”street” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”surName” nillable=”true” type=”xsd:string”/>
    <xsd:element minOccurs=”0″ name=”town” nillable=”true” type=”xsd:string”/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:element name=”registerDemo”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”info” nillable=”true” type=”tns:RegistrationInfo”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name=”registerDemoResponse”>
    <xsd:complexType/>
    </xsd:element>
    <xsd:element name=”authorizeDownload”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”userName” nillable=”true” type=”xsd:string”/>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”password” nillable=”true” type=”xsd:string”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:complexType name=”ArrayOfString”>
    <xsd:sequence>
    <xsd:element maxOccurs=”unbounded” minOccurs=”0″ name=”string” nillable=”true” type=”xsd:string”/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:element name=”authorizeDownloadResponse”>
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs=”1″ minOccurs=”1″ name=”out” nillable=”true” type=”tns:ArrayOfString”/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:complexType name=”AuthenticationFailedException”/>
    <xsd:element name=”AuthenticationFailedException” type=”tns:AuthenticationFailedException”/>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name=”authorizeDownloadRequest”>
    <wsdl:part name=”parameters” element=”tns:authorizeDownload”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:message name=”registerDemoRequest”>
    <wsdl:part name=”parameters” element=”tns:registerDemo”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:message name=”authorizeDownloadResponse”>
    <wsdl:part name=”parameters” element=”tns:authorizeDownloadResponse”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:message name=”registerDemoResponse”>
    <wsdl:part name=”parameters” element=”tns:registerDemoResponse”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:message name=”AuthenticationFailedException”>
    <wsdl:part name=”AuthenticationFailedException” element=”tns:AuthenticationFailedException”>
    </wsdl:part>
    </wsdl:message>
    <wsdl:portType name=”CuraWebServicePortType”>
    <wsdl:operation name=”registerDemo”>
    <wsdl:input name=”registerDemoRequest” message=”tns:registerDemoRequest”>
    </wsdl:input>
    <wsdl:output name=”registerDemoResponse” message=”tns:registerDemoResponse”>
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name=”authorizeDownload”>
    <wsdl:input name=”authorizeDownloadRequest” message=”tns:authorizeDownloadRequest”>
    </wsdl:input>
    <wsdl:output name=”authorizeDownloadResponse” message=”tns:authorizeDownloadResponse”>
    </wsdl:output>
    <wsdl:fault name=”AuthenticationFailedException” message=”tns:AuthenticationFailedException”>
    </wsdl:fault>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name=”CuraWebServiceHttpBinding” type=”tns:CuraWebServicePortType”>
    <wsdlsoap:binding style=”document” transport=”http://schemas.xmlsoap.org/soap/http”/&gt;
    <wsdl:operation name=”registerDemo”>
    <wsdlsoap:operation soapAction=””/>
    <wsdl:input name=”registerDemoRequest”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:input>
    <wsdl:output name=”registerDemoResponse”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name=”authorizeDownload”>
    <wsdlsoap:operation soapAction=””/>
    <wsdl:input name=”authorizeDownloadRequest”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:input>
    <wsdl:output name=”authorizeDownloadResponse”>
    <wsdlsoap:body use=”literal”/>
    </wsdl:output>
    <wsdl:fault name=”AuthenticationFailedException”>
    <wsdlsoap:fault name=”AuthenticationFailedException” use=”literal”/>
    </wsdl:fault>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name=”CuraWebService”>
    <wsdl:port name=”CuraWebServiceHttpPort” binding=”tns:CuraWebServiceHttpBinding”>
    <wsdlsoap:address location=”http://localhost:8888/CuraWebService/services/CuraWebService”/&gt;
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

    #275215 Reply

    huysmki
    Member

    Is this WSDL helping you further? Thanks in advance.

Viewing 15 posts - 1 through 15 (of 17 total)
Reply To: Null Pointer Exception generating client stubs

You must be logged in to post in the forum log in