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 Wed, 27 Feb 2008 21:48:12 GMT


This looks exactly like the issue in:
http://www.nabble.com/Does-CXF-Support-Interfaces-as-Web-Params--to15702272.html

I'll look at it more tonight or tomorrow.

Dan

On Wednesday 27 February 2008, Phil Weighill-Smith wrote:
> Dan,
>
> So we managed to get the new tool running, but we still have the same
> problem. I've attached the full actual WSDL generated.
>
> This is generated using the following snippet of Ant scripting:
>
>
>     <target name="generate-remote-java2wsdl"
> depends="-make-output-dir"> <java
> classname="org.apache.cxf.tools.java2ws.JavaToWS" fork="true"> <arg
> value="-wsdl"/>
>             <arg value="-s"/>
>             <arg
> value="${product.dir}/user-module/built/output/generated"/> <arg
> value="-o"/>
>             <arg
> value="${product.dir}/user-module/built/output/UserModule.wsdl"/>
>             <arg
> value="com.volantis.openapi.mss.usermodule.UserModule"/> <classpath>
>                <path refid="cxf.classpath"/>
>             </classpath>
>         </java>
>     </target>
>
>
> When executed we get the following output from Ant:
>
>
> generate-remote-java2wsdl:
>      [java] log4j:WARN No appenders could be found for logger
> (org.apache.cxf.bus.spring.BusApplicationContext). [java] log4j:WARN
> Please initialize the log4j system properly. [java] Feb 27, 2008
> 2:06:35 PM org.apache.cxf.bus.spring.BusApplicationContext
> getConfigResources [java] INFO: No cxf.xml configuration file
> detected, relying on defaults. [java] Feb 27, 2008 2:06:37 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass [java] INFO: Creating Service
> {http://com.volantis.xmlns/2008/01/mss/user-module}UserModuleService
> from class com.volantis.openapi.mss.usermodule.UserModule [java] Feb
> 27, 2008 2:06:38 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass [java] INFO:
> {http://com.volantis.xmlns/2008/01/mss/user-module}parameters part
> type QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}parameter part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}parameters part
> type QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}return part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}return part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}definition part
> type QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}parameter part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}return part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}return part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}parameters part
> type QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}return part type
> QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}preference part
> type QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}originalPreference
> part type QName null. [java]
> {http://com.volantis.xmlns/2008/01/mss/user-module}parameters part
> type QName null.
>
> I'm wondering if the QName null issues are the source of our problems,
> and what they mean.
>
> Here is the start of our SEI (with the first operation/method
> included):
>
>
> package com.volantis.openapi.mss.usermodule;
>
> import com.volantis.openapi.mss.usermodule.jaxb.Adapters;
>
> import java.util.List;
>
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.xml.datatype.Duration;
> import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
>
> /**
>  * Provides access to the various operations that can be performed
> against the * user module which forms part of the MSS API.
>  *
>  * ...
>  */
> @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 {
>     /**
>      * Get the details of the specified user, with or without
> extension * parameter and subscription details and potentially
> updating the user's * last known device.
>      *
>      * @param applicationID              the ID for the application
> scope in *                                   which the user exists.
> Must not be *                                   null
>      * @param userID                     the application-scope unique
> ID for *                                   the user to be retrieved.
> Must not be *                                   null
>      * @param device                     the DRWS device name for the
> request *                                   during which the user's
> details are *                                   to be retrieved. If
> not null this may *                                   be used to
> update the user's last *                                   known
> device
>      * @param includeExtensionParameters identifies whether extension
>      *                                   parameters should be
> populated * @param includeSubscriptions       identifies whether
> subscriptions *                                   should be populated
>      * @return the user with or without extension parameter and/or
> subscription *         details. Will not be null
>      * @throws PersistenceException if there is a problem with the MSS
>      *                              persistence mechanism
>      */
>     @XmlJavaTypeAdapter(Adapters.UserAdapter.class)
>     User getUser(
>             @WebParam(name = "application")
>             final String applicationID,
>             @WebParam(name = "id")
>             final String userID,
>             @WebParam(name = "device")
>             final String device,
>             @WebParam(name = "includeExtensionParameters")
>             final boolean includeExtensionParameters,
>             @WebParam(name = "includeSubscriptions")
>             final boolean includeSubscriptions) throws
> PersistenceException; ...
> }
>
> The User interface looks like:
>
>
> package com.volantis.openapi.mss.usermodule;
>
> import com.volantis.openapi.mss.usermodule.jaxb.Adapters;
>
> import java.util.Calendar;
> import java.util.List;
>
> import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
> import javax.xml.bind.annotation.XmlElement;
>
> /**
>  * Represents the details of a user as stored in MSS.
>  *
>  * <p><strong>Warning: This is a facade provided for use by user code,
> not for * implementation in user code. User implementations of this
> interface are * highly likely to be incompatible with future releases
> of the product at both * binary and source levels.</strong></p>
>  *
>  * @volantis-api-include-in PublicAPI
>  */
> @XmlJavaTypeAdapter(Adapters.UserAdapter.class)
> public interface User {
>     /**
>      * The user's application-scope unique identity. This is typically
> defined * by an operator token though may be a generated unique ID
> obtained from * the MSS User Identification Service.
>      *
>      * @return the user's identity. Will not be null
>      */
>     @XmlElement(required = true)
>     String getID();
>
>     ...
> }
>
>
> The implementation of this looks like:
>
>
> package com.volantis.openapi.mss.usermodule.jaxb;
>
> import com.volantis.openapi.mss.usermodule.User;
>
> import javax.xml.bind.annotation.XmlType;
> import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
>
> /**
>  * A mutable implementation of the {@link User} API for use
>  * in JAXB bindings.
>  */
> @XmlType(name = "User")
> public class UserImpl extends ParameterOwner implements User {
>     /**
>      * The ID for this user.
>      */
>     private String id;
>
>     ...
>
>     /**
>      * Initializes the new instance.
>      */
>     public UserImpl() {
>     }
>
>     @Override
>     public String getID() {
>         return id;
>     }
>
>     /**
>      * Permit the ID to be updated.
>      *
>      * @param id the new value. Must not be null
>      * @throws IllegalArgumentException if any constraints are
> violated */
>     public void setID(final String id) throws IllegalArgumentException
> { if (id == null) {
>             throw new IllegalArgumentException();
>         }
>
>         this.id = id;
>     }
>
>     ...
> }
>
>
> (The ParameterOwner base class can be ignored pretty much in this
> cut-down example, but I leave it here so you can see how the UserImpl
> is structured by extending a base class with certain properties.)
>
> Finally, the adapter looks like this:
>
>
> package com.volantis.openapi.mss.usermodule.jaxb;
>
> import com.volantis.openapi.mss.usermodule.User;
>
> import javax.xml.bind.annotation.adapters.XmlAdapter;
>
> /**
>  * Provides the various Java type adapters required to allow the API
> to be * appropriately bound to JAX-WS and JAXB.
>  */
> public final class Adapters {
>     /**
>      * {@link User} adapter.
>      */
>     public static 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;
>         }
>     }
>
>     ...
> }
>
>
> Any suggestions as to why the response for the getUser operation is
> like:
>
>
>     <xs:element name="getUserResponse" type="getUserResponse"/>
>     <xs:complexType name="getUserResponse">
>         <xs:sequence>
>             <xs:element minOccurs="0" name="return"/>
>         </xs:sequence>
>     </xs:complexType>
>
>
> and the fact that there is no "User" element/complex type
> generated...?
>
> Phil :n.
>
> PS: Thanks for your help so far!
>
> On Tue, 2008-02-26 at 13:42 -0500, Daniel Kulp wrote:
> > On Tuesday 26 February 2008, Phil Weighill-Smith wrote:
> > > That's the sort of answer I was looking for. Thanks,
> > >
> > > Phil :n)
> > >
> > > PS: Was this an RTFM moment?!
> >
> > I wish I could say the answer was yes...  :-(
> >
> > I think most of our docs on the wiki at this point are more
> > targetted toward the 2.0.x toolset (since 2.0.x is released).
> >
> > Dan
> >
> > > ----- Original Message -----
> > > From: Daniel Kulp <dkulp@apache.org>
> > > To: cxf-user@incubator.apache.org
> > > Cc: Phil Weighill-Smith <phil.weighill-smith@volantis.com>
> > > Sent: Tue, 26 Feb 2008 11:25:16 -0700 (MST)
> > > Subject: Re: Problem generating WSDL from Java API with CXF 2.0.3
> > >
> > > 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



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

Mime
View raw message