cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Problem generating WSDL from Java API with CXF 2.0.3
Date Tue, 26 Feb 2008 18:25:16 GMT
On Monday 25 February 2008, Phil Weighill-Smith wrote:
> Dan,
>
> The exception happened with just using command line access - with long
> class paths ;n)
>
> Yes, I think we were getting the tooling from a 2.0.1 JAR remnant. But
> I couldn't find the tooling in the 2.1 snap...?

Which tooling?   The java2wsdl tool has been merged into the new java2ws 
tool which supports a bunch of new things.   If you just want the wsdl, 
pass the -wsdl flag.

Dan



> We can consider 1.6.0_04. To be honest, we really need to compile with
> a 1.5.x environment ideally since we probably need to support 1.5.x
> JREs.
>
> Phil :n.
>
> ----- Original Message -----
> From: "Daniel Kulp" <dkulp@apache.org>
> To: cxf-user@incubator.apache.org
> Cc: "Phil Weighill-Smith" <phil.weighill-smith@volantis.com>
> Sent: 25 February 2008 17:08:00 o'clock (GMT) Europe/London
> Subject: Re: Problem generating WSDL from Java API with CXF 2.0.3
>
>
> Hmm..
>
> Is this in maven or other build system?   It looks like its picking up
> some old jars someplace as the class:
> org.apache.cxf.tools.java2wsdl.processor.JavaToProcessor
> no longer even exists.
>
> > Note that this is both in the IDEA integration with CXF and via the
> > command line. The JDK I'm using is 1.6.0.03.
>
> If using 2.1 snapshot, you may want to flip to 1.6.0_04.   03 includes
> the 2.0 JAXWS/JAXB API's which may cause issues with the 2.1 versions
> that CXF 2.1 requires.    _04 includes the proper 2.1 versions and I
> have gone through and made sure CXF builds and runs with _04.
>
> Dan
>
> On Monday 25 February 2008, Phil Weighill-Smith wrote:
> > I've tried out the 2.1 snapshot available today and found that the
> > API has changed in some way in CXF so now trying to generate a WSDL
> > from Java code gives:
> >
> > Exception in thread "main" java.lang.NoSuchMethodError:
> > org.apache.cxf.tools.java2wsdl.processor.internal.ServiceBuilderFact
> >or y.newBuilder()Lorg/apache/cxf/service/ServiceBuilder; at
> > org.apache.cxf.tools.java2wsdl.processor.JavaToProcessor.getServiceB
> >ui lder(JavaToProcessor.java:144) at
> > org.apache.cxf.tools.java2wsdl.processor.JavaToProcessor.process(Jav
> >aT oProcessor.java:87)
> >
> > Note that this is both in the IDEA integration with CXF and via the
> > command line. The JDK I'm using is 1.6.0.03.
> >
> > Any suggestions?
> >
> > Phil :n.
> >
> > ----- Original Message -----
> > From: "Daniel Kulp" <dkulp@apache.org>
> > To: cxf-user@incubator.apache.org
> > Cc: "Phil Weighill-Smith" <phil.weighill-smith@volantis.com>
> > Sent: 22 February 2008 17:26:59 o'clock (GMT) Europe/London
> > Subject: Re: Problem generating WSDL from Java API with CXF 2.0.3
> >
> > On Friday 22 February 2008, Phil Weighill-Smith wrote:
> > > Dan, sorry it's been several weeks since you e-mailed this to me
> > > and I've not actioned it. Where do I find CXF's official JIRA app?
> >
> > https://issues.apache.org/jira/browse/CXF
> >
> > That said, the namespace issue in the WrapperClassGenerator  should
> > be fixed with the latest 2.1 snapshots.   I'll probably be doing new
> > snapshots again today since I've fixed a TON of bugs over the last
> > couple days.   That MAY also fix the other issues you note below as
> > it will totally delegate to JAXB to generate the getUserResponse
> > type in the wsdl.   Any chance you can try with the latest 2.1
> > snapshots (or wait till tomorrow/monday and try the ones I'll deploy
> > later today?)
> >
> > Dan
> >
> > > By the way, I have also hit a problem where the response parts are
> > > generated with incomplete result definitions. For example, if I
> > > have a method in my SEI like:
> > >
> > >
> > > @WebService(name = "UserModule",
> > >             targetNamespace =
> > > "http://www.volantis.com/xmlns/2008/01/mss/user-module")
> > > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
> > >              use = SOAPBinding.Use.LITERAL,
> > >              parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
> > > public interface UserModule {
> > >   User getUser(@WebParam(name="name") final String name);
> > >   ...
> > > }
> > >
> > >
> > > where User is, for example, like this:
> > >
> > >
> > > @XmlJavaTypeAdapter(UserAdapter.class)
> > > public interface User {
> > >   String getName();
> > >   String getPassword();
> > > }
> > >
> > >
> > > with an implementation like:
> > >
> > >
> > > @XmlType(name = "User")
> > > public class UserImpl implements User {
> > >   private String name;
> > >   private String password;
> > >
> > >   public void setName(final String name) {
> > >     this.name = name;
> > >   }
> > >
> > >   public String getName() {
> > >     return name;
> > >   }
> > >
> > >   public void setPassword(final String password) {
> > >     this.password = password;
> > >   }
> > >
> > >   public String getPassword() {
> > >     return password;
> > >   }
> > > }
> > >
> > >
> > > and the adapter looks like:
> > >
> > >
> > > public final class UserAdapter extends
> > >             XmlAdapter<UserImpl, User> {
> > >   @Override
> > >   public UserImpl marshal(final User user) throws Exception {
> > >     return (UserImpl) user;
> > >   }
> > >
> > >   @Override
> > >   public User unmarshal(final UserImpl user) throws Exception {
> > >     return user;
> > >   }
> > > }
> > >
> > > I get some WSDL like this:
> > >
> > >
> > > <wsdl:definitions name="UserModuleService"
> > >
> > > targetNamespace="http://com.volantis.openapi.mss.usermodule"
> > > xmlns:ns1="http://www.volantis.com/xmlns/2008/01/mss/user-module"
> > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > > xmlns:tns="http://com.volantis.openapi.mss.usermodule"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <wsdl:types>
> > >         <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > >
> > > xmlns="http://www.volantis.com/xmlns/2008/01/mss/user-module"
> > > attributeFormDefault="unqualified"
> > >                    elementFormDefault="unqualified"
> > >
> > > targetNamespace="http://www.volantis.com/xmlns/2008/01/mss/user-mo
> > >du le "> <xs:element name="getUser" type="getUser"/>
> > >             <xs:complexType name="getUser">
> > >                 <xs:sequence>
> > >                     <xs:element minOccurs="0" name="name"
> > >                                 type="xs:string"/>
> > >                 </xs:sequence>
> > >             </xs:complexType>
> > >             <xs:element name="getUserResponse"
> > > type="getUserResponse"/> <xs:complexType name="getUserResponse">
> > >                 <xs:sequence>
> > >                     <xs:element minOccurs="0" name="return"/>
> > >                 </xs:sequence>
> > >             </xs:complexType>
> > >             ...
> > >         </xs:schema>
> > >     <wsdl:types>
> > >     ...
> > >     <wsdl:message name="getUser">
> > >         <wsdl:part name="parameters" element="ns1:getUser">
> > >         </wsdl:part>
> > >     </wsdl:message>
> > >     ...
> > >     <wsdl:message name="getUserResponse">
> > >         <wsdl:part name="parameters"
> > > element="ns1:getUserResponse"> </wsdl:part>
> > >     </wsdl:message>
> > >     ...
> > >     <wsdl:portType name="UserModule">
> > >         <wsdl:operation name="getUser">
> > >             <wsdl:input name="getUser" message="ns1:getUser">
> > >             </wsdl:input>
> > >             <wsdl:output name="getUserResponse"
> > > message="ns1:getUserResponse"> </wsdl:output>
> > >         </wsdl:operation>
> > >         ...
> > >     </wsdl:portType>
> > >     <wsdl:binding name="UserModuleServiceSoapBinding"
> > > type="ns1:UserModule"> <soap:binding style="document"
> > >
> > > transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation
> > > name="getUser">
> > >             <soap:operation soapAction="" style="document"/>
> > >             <wsdl:input name="getUser">
> > >                 <soap:body use="literal"/>
> > >             </wsdl:input>
> > >             <wsdl:output name="getUserResponse">
> > >                 <soap:body use="literal"/>
> > >             </wsdl:output>
> > >         </wsdl:operation>
> > >         ...
> > >     </wsdl:binding>
> > >     <wsdl:service name="UserModuleService">
> > >         <wsdl:port name="UserModulePort"
> > >                    binding="ns1:UserModuleServiceSoapBinding">
> > >             <soap:address location="http://localhost:9090/mss"/>
> > >         </wsdl:port>
> > >     </wsdl:service>
> > > </wsdl:definitions>
> > >
> > >
> > >
> > >
> > > As you can see, the (bolded) "return" element has no type, and I
> > > get no XSD element or type definition for the User implementation
> > > for some reason. Any ideas?
> > >
> > > Phil :n.
> > >
> > > On Fri, 2008-02-01 at 22:26 -0500, Daniel Kulp wrote:
> > > > This is definitely a bug and I see where the improper code is
> > > > found.
> > > >
> > > > Line 202 of WrapperClassGenerator specifically sets the
> > > > namespace to "" for the generated class.  This needs to be
> > > > updated to either not output it or output the correct namespace.
> > > >   I'll need to experiment a bit to figure out which.
> > > >
> > > > Can you log a JIRA (feel free to assign to me) so it gets
> > > > tracked. (I'm busy with other stuff for the next couple days).  
> > > > Better yet, check out CXF from Svn, experiment a bit by editing
> > > > those lines, then attach a patch to that jira.   :-)
> > > >
> > > > Dan
> > > >
> > > > On Thursday 31 January 2008, Phil Weighill-Smith wrote:
> > > > > Regarding target namespace and the elementFormDefault
> > > > > issues...
> > > > >
> > > > > Interestingly the package-info.java approach doesn't seem to
> > > > > work. Whilst this sets the default element form to qualified,
> > > > > each element is then generated with the form="unqualified"
> > > > > attribute set. D'oh! I guess I'll have to use the XmlElement
> > > > > approach. Will let you know what happens.
> > > > >
> > > > > I've also set the XmlSchema namespace as you have suggested,
> > > > > and have explicitly set the @WebService(targetNamespace) to
> > > > > the same value but I still get a WSDL targetNamespace derived
> > > > > from the package name. How do I override this behaviour?
> > > > >
> > > > > The package-info.java has:
> > > > >
> > > > > @javax.xml.bind.annotation.XmlSchema(
> > > > >         namespace =
> > > > > "http://com.volantis.xmlns/2008/01/mss/user-module",
> > > > > elementFormDefault =
> > > > > javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package
> > > > > com.volantis.openapi.mss.usermodule;
> > > > >
> > > > > and the SEI interface has:
> > > > >
> > > > > @WebService(name = "UserModule",
> > > > >             targetNamespace =
> > > > > "http://com.volantis.xmlns/2008/01/mss/user-module")
> > > > > @SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
> > > > >              use = SOAPBinding.Use.LITERAL,
> > > > >              parameterStyle =
> > > > > SOAPBinding.ParameterStyle.WRAPPED) public interface
> > > > > UserModule {
> > > > >     ...
> > > > >     List<User> getSubscribers(
> > > > >             @WebParam(name = "application")
> > > > >             final String applicationID,
> > > > >             @WebParam(name = "subscription")
> > > > >             final String subscriptionID,
> > > > >             @WebParam(name = "includeExtensionParameters")
> > > > >             final boolean includeExtensionParameters,
> > > > >             @WebParam(name = "includeSubscriptions")
> > > > >             final boolean includeSubscriptions) throws
> > > > > PersistenceException; ...
> > > > >
> > > > > but the WSDL is generated with:
> > > > >
> > > > > <wsdl:definitions name="UserModuleService"
> > > > >
> > > > > targetNamespace="http://com.volantis.openapi.mss.usermodule"
> > > > > xmlns:ns1="http://com.volantis.xmlns/2008/01/mss/user-module"
> > > > > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > > > > xmlns:tns="http://com.volantis.openapi.mss.usermodule"
> > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > > > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
> > > > > <wsdl:types> <xs:schema
> > > > > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > > >
> > > > > xmlns:tns="http://com.volantis.xmlns/2008/01/mss/user-module"
> > > > > attributeFormDefault="unqualified"
> > > > >                    elementFormDefault="qualified"
> > > > >
> > > > > targetNamespace="http://com.volantis.xmlns/2008/01/mss/user-mo
> > > > >du le "> ...
> > > > >             <xs:complexType name="getSubscribersResponse">
> > > > >                 <xs:sequence>
> > > > >                     <xs:element form="unqualified"
> > > > > maxOccurs="unbounded" minOccurs="0" name="return"
> > > > > type="xs:anyType"/> </xs:sequence>
> > > > >             </xs:complexType>
> > > > >             ...
> > > > >         </xs:schema>
> > > > >     </wsdl:types>
> > > > >
> > > > >     <wsdl:message name="getSubscribersResponse">
> > > > >         <wsdl:part name="parameters"
> > > > > element="ns1:getSubscribersResponse"> </wsdl:part>
> > > > >     </wsdl:message>
> > > > >     ...
> > > > >
> > > > > What I want to see is:
> > > > >
> > > > >       * the WSDL targetNamespace matching the ns1 URI
> > > > >       * the elements generated with form "qualified"
> > > > >       * the sequence returned by getSubscribersResponse using
> > > > > the generated schema type for User.
> > > > >
> > > > > Any suggestions?
> > > > >
> > > > > Phil :n(
> > > > >
> > > > > On Mon, 2008-01-28 at 10:31 -0500, Daniel Kulp wrote:
> > > > > > 2) Create a package-info.java class in the package
> > > > > > containing the beans.
> > > > > > It would look like:
> > > > > >
> > > > > > @javax.xml.bind.annotation.XmlSchema(
> > > > > >      namespace = "http://the.namespace.to.use",
> > > > > >      elementFormDefault =
> > > > > > javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
> > > > > > package the package;



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message