On Thu July 23 2009 11:22:30 am Bram de Kruijff wrote:
> Daniel Kulp wrote:
> > >   <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.
>
> Aha! Overlooked this simple attribute being blinded by the difference
> In the structure :o Indeed simply removing it results in a usable stub
> as well.
>
> However, now I have two questions instead of one 8)
>
> 1) If the code generators cannot unwrap it. Why is the CXF runtime
> doing it causing the incompatibility?
>
> Looks very strange to me. What am I missing here..

The runtime is a bit more forgiving than the code generators.   The runtime 
has to deal with all kinds of "java-first" cases and migrations from XFire and 
other type of situations where the code that is being used was not actually 
generated from the wsdl.   In those cases, the runtime tries to be  a bit 
smarted and allows some things that the code generators are not allowed to do 
(per spec).    This is one case.   Another case is elements by ref in the 
wrapper sequences.    There are a couple others.   


> 2) How do I get rid of the nillable attribute being generated by the
> CXF runtime?

THAT is a good question.  I'm not sure where that nillable is coming from.   
It COULD be coming from JAXB.    In that case, updating to JAXB 2.1.12 may 
actually fix it.   I'm working on updating CXF to 2.1.12 and noticed a couple 
of tests are failing cause 2.1.9 generated some nillable=true things on some 
root wrapper elements and 2.1.12 is not.  Thus, you MAY be hitting that.


> I think you have answered this question a few times before indicating
> that only JAX-WS 2.2 will really solve this right?
>
> http://www.nabble.com/CXF---JAXB-%22Java-first-approach%22---remove-minOccu
>rs%3D%220%22-td21692084.html

Correct.

Dan


>
> For now I guess I should stick with manually editing the generated WSDL.
>
> thanks!
> Bram
>
> > 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.ja
> >
> > va:
> > >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

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to