RE: cxf gen client got Nullpointer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: cxf gen client got Nullpointer

Li, Tao (Tom)
Hi all,

This bug is caused by no default value set for in/out part name when finding message part from message info.
So when there's no WebParam/WebResult annotation, the error will occurred.
Now the fix has been to use correct default value - argX for input, return for output, to find the message part.

Thanks.
tom

> -----Original Message-----
> From: James Mao [mailto:[hidden email]]
> Sent: Tuesday, November 14, 2006 7:59 PM
> To: [hidden email]
> Subject: Re: cxf gen client got Nullpointer
>
>
> Hi,
>
> The wsdl generated from the SEI is correct.
> It seems that the RT is looking for {http://cxf.com}out instead of
> {http://cxf.com}return, that cause the problem.
>
> The solution i can give is a workaround solution, you can add the
> WebResult annotation for the method.
>
> I'll looking into the RT later.
>
> Thanks,
> James.
>
> > Hi guys,
> >
> > This probably a real issue.
> >
> > I started with a simple interface, as below:
> >
> > package com.cxf;
> > import javax.jws.WebService;
> > import javax.jws.WebMethod;
> > import javax.jws.soap.SOAPBinding;
> >
> > @WebService(name="Hello", targetNamespace="http://cxf.com/")
> > public interface Hello {
> >
> >    
> >
> @SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.Paramet
> erStyle.BARE,
> > style=javax.jws.soap.SOAPBinding.Style.RPC,
> > use=javax.jws.soap.SOAPBinding.Use.LITERAL)
> >    @WebMethod(operationName="sayHi", exclude=false)
> >    String sayHi();
> > }
> >
> > Then I use java2wsdl to generate the following wsdl
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions targetNamespace="http://cxf.com/"
> > xmlns:tns="http://cxf.com/" xmlns:ns1="http://cxf.com/"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
> >  <wsdl:types>
> >    <xsd:schema targetNamespace="http://cxf.com/" version="1.0"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema">
> >
> >  <xs:element name="sayHiResponse" nillable="true" type="xs:string"/>
> > </xsd:schema>
> >  </wsdl:types>
> >  <wsdl:message name="sayHi">
> >  </wsdl:message>
> >  <wsdl:message name="sayHiResponse">
> >    <wsdl:part name="return" type="xsd:string">
> >    </wsdl:part>
> >  </wsdl:message>
> >  <wsdl:portType name="Hello">
> >    <wsdl:operation name="sayHi">
> >      <wsdl:input name="sayHi" message="tns:sayHi">
> >    </wsdl:input>
> >      <wsdl:output name="sayHiResponse" message="tns:sayHiResponse">
> >    </wsdl:output>
> >    </wsdl:operation>
> >  </wsdl:portType>
> >  <wsdl:binding name="HelloBinding" type="tns:Hello">
> >    <soap:binding style="document"
> > transport="http://schemas.xmlsoap.org/soap/http"/>
> >    <wsdl:operation name="sayHi">
> >      <soap:operation style="rpc"/>
> >      <wsdl:input name="sayHi">
> >        <soap:body use="literal"/>
> >      </wsdl:input>
> >      <wsdl:output name="sayHiResponse">
> >        <soap:body use="literal"/>
> >      </wsdl:output>
> >    </wsdl:operation>
> >  </wsdl:binding>
> >  <wsdl:service name="HelloService">
> >    <wsdl:port name="HelloPort" binding="tns:HelloBinding">
> >      <soap:address location="http://localhost:9000/Hello"/>
> >    </wsdl:port>
> >  </wsdl:service>
> > </wsdl:definitions>
> >
> > Using that wsdl, I use wsdl2java to generate the simple Server and
> > Client. I start up the server and then the client. From the client
> > site I got a NullPointerException, stack trace:
> >
> > INFO: Creating Service {http://cxf.com/}HelloService from WSDL.
> > Exception in thread "main" java.lang.NullPointerException
> >    at
> >
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializ
> eParameter(JaxWsServiceFactoryBean.java:260)
> >
> >    at
> >
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializ
> eParameter(JaxWsServiceFactoryBean.java:242)
> >
> >    at
> >
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializ
> eClassInfo(JaxWsServiceFactoryBean.java:222)
> >
> >    at
> >
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializ
> eWSDLOperation(JaxWsServiceFactoryBean.java:122)
> >
> >    at
> >
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.in
> itializeWSDLOperations(ReflectionServiceFactoryBean.java:239)
> >
> >    at
> >
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.in
> itializeServiceModel(ReflectionServiceFactoryBean.java:178)
> >
> >    at
> >
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.cr
> eate(ReflectionServiceFactoryBean.java:116)
> >
> >    at
> org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:239)
> >    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:199)
> >    at javax.xml.ws.Service.getPort(Service.java:94)
> >    at com.cxf.HelloService.getHelloPort(HelloService.java:67)
> >    at com.cxf.HelloClient.main(HelloClient.java:65)
> >
> >
> >
> >
>
>