> <xs:element name="echo" nillable="true" type="echo" />
That's the problem. The nillable="true" thing cannot be there for a
doc/literal/wrapped endpoint. As soon as that is there, the code generators
cannot unwrap it into "String echo(String)". If you remove the
nillable="true", it should be fine.
Dan
On Thu July 23 2009 9:07:54 am Bram de Kruijff wrote:
> Hi,
>
> when I use the WSDL generated by my service to generate a stub using
> wsdl2java this stub is not usable at runtime because the signatures do not
> match the SEIClass generated from the same WSDL at runtime. Although I'm
> guessing this should be easy I got stuck!
>
> I have a simple echo service with one (string in string out) method
> endpoint registered in a (custom extension of) CXFServlet. The WSDL it
> generated contains seperate named ComplexType declarations for the
> parameters. As a consequence(?) the stub from wsdl2java define a service
> with en (bean in bean out) method. However when I try to use this code at
> runtime I get this ServiceConstructionExceptoin...
>
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException:
> Service class gxlabs.cxf.echo.service.EchoService does not implement the
> echo method.
> at
> org.apache.cxf.jaxws.JAXWSMethodDispatcher.bind(JAXWSMethodDispatcher.java:
>54)
>
> After some debugging I found out that the SEIClass does have a method name
> "echo" but is has a string in string out signature! How did that happen?
>
> I noticed that when I modify the WSDL by embedding the ComplexType
> declarations in the Element tags this changes the stub to have the string
> in string out signature as well and then does work.
>
> Well, I do not understand what happend and why the same WSDL produces
> different results using the same code? I am not using any binding or some
> at this point. Is there some way (maybe do use binding) to make wsdl2java
> generate a stub from the unmodified wsdl that will work at runtime?
>
> I have copied some relevant snippets below. Any help would be much
> appriciated! I am using CXF 2.2.2 deployed in felix.
>
> Regards,
> Bram
>
> >>> EchoService.java (server)
>
> @WebService
> public interface EchoService {
> @WebMethod String echo(@WebParam(name = "message") String message);
> }
>
> >>> EchoService?wsdl (original)
>
> ...
> <xs:complexType name="echo">
> <xs:sequence>
> <xs:element minOccurs="0" name="message" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> <xs:element name="echo" nillable="true" type="echo" />
> ...
>
> >>> EchoService.java (wsdl2java from original wsdl)
>
> @WebService(targetNamespace = "http://service.echo.cxf.gxlabs/", name =
> "EchoService")
> @XmlSeeAlso({ObjectFactory.class})
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface EchoService {
>
> @WebResult(name = "echoResponse", targetNamespace =
> "http://service.echo.cxf.gxlabs/", partName = "parameters")
> @WebMethod
> public EchoResponse echo(
> @WebParam(partName = "parameters", name = "echo", targetNamespace =
> "http://service.echo.cxf.gxlabs/")
> Echo parameters
> );
> }
>
> >>> EchoService.wsdl (modified)
>
> <xs:element name="echo">
> <xs:complexType>
> <xs:sequence>
> <xs:element minOccurs="0" name="message" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> >>> EchoService.java (wsdl2java from modified wsdl)
>
> @WebService(targetNamespace = "http://service.echo.cxf.gxlabs/", name =
> "EchoService")
> @XmlSeeAlso({ObjectFactory.class})
> public interface EchoService {
>
> @ResponseWrapper(localName = "echoResponse", targetNamespace =
> "http://service.echo.cxf.gxlabs/", className =
> "gxlabs.cxf.echo.service.EchoResponse")
> @RequestWrapper(localName = "echo", targetNamespace =
> "http://service.echo.cxf.gxlabs/", className =
> "gxlabs.cxf.echo.service.Echo")
> @WebResult(name = "return", targetNamespace = "")
> @WebMethod
> public java.lang.String echo(
> @WebParam(name = "message", targetNamespace = "")
> java.lang.String message
> );
> }
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog