You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <bi...@basistech.com> on 2007/10/23 20:53:13 UTC

Migrating enums

In the interests of a less eventful life, I moved my production code to
JAXB from Aegis. My doc guy just pointed out to me that our WSDL has
rather less schema elements than expected. Indeed, there seems to have a
been a giant migration to the service TNS, at least of enums.

In the wsdl that is coming out of java2wsdl, I've got one schema.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:btrni="http://index.rnm.basistech.com"
xmlns:btrniws="http://ws.index.rnm.basistech.com"
xmlns:btrnm="http://rnm.basistech.com"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://ws.index.rnm.basistech.com">

I then have a reference to an enum type:

<xs:element minOccurs="0" name="script" type="btrniws:iso15924"/>

This already looks wrong, insofar as that enum lives in
com.basistech.util, not com.basistech.rnm.index.ws.

But it's at least consistent, since that is the tns and, sure enough,
the enum complexType is just sitting in the tns.

However, I now notice that the same thing is happening to all of the
beans. Everything is in the TNS, regardless of package-of-origin.



RE: Migrating enums

Posted by Benson Margulies <bi...@basistech.com>.
OK, I get it. Namespace="....' as well.

> -----Original Message-----
> From: Benson Margulies [mailto:bim2007@basistech.com]
> Sent: Tuesday, October 23, 2007 4:11 PM
> To: Daniel Kulp; cxf-user@incubator.apache.org
> Subject: RE: Migrating enums
> 
> I've already got the following. I take it I need more?
> 
> @javax.xml.bind.annotation.XmlSchema(
>         xmlns = {
>                 @javax.xml.bind.annotation.XmlNs(prefix = "btutil",
>                                                  namespaceURI =
> "http://util.basistech.com")
>                 }
>                 )
> package com.basistech.util;
> 
> 
> 
> > -----Original Message-----
> > From: Daniel Kulp [mailto:dkulp@apache.org]
> > Sent: Tuesday, October 23, 2007 3:33 PM
> > To: cxf-user@incubator.apache.org
> > Cc: Benson Margulies
> > Subject: Re: Migrating enums
> >
> >
> > This is probably working "as designed" for JAX-WS tck/spec
compliance.
> >
> > Basically, in the absense of namespace attributes on the @XmlType
> > annotations or on the @XmlSchema annotation in the package-info, we
> are
> > supposed to map all the beans into schemas of the service namespace.
> I
> > know, kind of bizarre.
> >
> > The easy fix is usually to create a package-info.java with the
> > appropriate @XmlSchema annotation.    Otherwise, add the namespace
> > attribute to all the @XmlType annotations on all the beans.
> >
> > Dan
> >
> >
> > On Tuesday 23 October 2007, Benson Margulies wrote:
> > > In the interests of a less eventful life, I moved my production
code
> > > to JAXB from Aegis. My doc guy just pointed out to me that our
WSDL
> > > has rather less schema elements than expected. Indeed, there seems
> to
> > > have a been a giant migration to the service TNS, at least of
enums.
> > >
> > > In the wsdl that is coming out of java2wsdl, I've got one schema.
> > >
> > > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > xmlns:btrni="http://index.rnm.basistech.com"
> > > xmlns:btrniws="http://ws.index.rnm.basistech.com"
> > > xmlns:btrnm="http://rnm.basistech.com"
> > > attributeFormDefault="unqualified"
elementFormDefault="unqualified"
> > > targetNamespace="http://ws.index.rnm.basistech.com">
> > >
> > > I then have a reference to an enum type:
> > >
> > > <xs:element minOccurs="0" name="script" type="btrniws:iso15924"/>
> > >
> > > This already looks wrong, insofar as that enum lives in
> > > com.basistech.util, not com.basistech.rnm.index.ws.
> > >
> > > But it's at least consistent, since that is the tns and, sure
> enough,
> > > the enum complexType is just sitting in the tns.
> > >
> > > However, I now notice that the same thing is happening to all of
the
> > > beans. Everything is in the TNS, regardless of package-of-origin.
> >
> >
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727    C: 508-380-7194
> > daniel.kulp@iona.com
> > http://www.dankulp.com/blog

RE: Migrating enums

Posted by Benson Margulies <bi...@basistech.com>.
I've already got the following. I take it I need more?

@javax.xml.bind.annotation.XmlSchema(
        xmlns = {
                @javax.xml.bind.annotation.XmlNs(prefix = "btutil", 
                                                 namespaceURI =
"http://util.basistech.com")
                }
                )
package com.basistech.util;



> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Tuesday, October 23, 2007 3:33 PM
> To: cxf-user@incubator.apache.org
> Cc: Benson Margulies
> Subject: Re: Migrating enums
> 
> 
> This is probably working "as designed" for JAX-WS tck/spec compliance.
> 
> Basically, in the absense of namespace attributes on the @XmlType
> annotations or on the @XmlSchema annotation in the package-info, we
are
> supposed to map all the beans into schemas of the service namespace.
I
> know, kind of bizarre.
> 
> The easy fix is usually to create a package-info.java with the
> appropriate @XmlSchema annotation.    Otherwise, add the namespace
> attribute to all the @XmlType annotations on all the beans.
> 
> Dan
> 
> 
> On Tuesday 23 October 2007, Benson Margulies wrote:
> > In the interests of a less eventful life, I moved my production code
> > to JAXB from Aegis. My doc guy just pointed out to me that our WSDL
> > has rather less schema elements than expected. Indeed, there seems
to
> > have a been a giant migration to the service TNS, at least of enums.
> >
> > In the wsdl that is coming out of java2wsdl, I've got one schema.
> >
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:btrni="http://index.rnm.basistech.com"
> > xmlns:btrniws="http://ws.index.rnm.basistech.com"
> > xmlns:btrnm="http://rnm.basistech.com"
> > attributeFormDefault="unqualified" elementFormDefault="unqualified"
> > targetNamespace="http://ws.index.rnm.basistech.com">
> >
> > I then have a reference to an enum type:
> >
> > <xs:element minOccurs="0" name="script" type="btrniws:iso15924"/>
> >
> > This already looks wrong, insofar as that enum lives in
> > com.basistech.util, not com.basistech.rnm.index.ws.
> >
> > But it's at least consistent, since that is the tns and, sure
enough,
> > the enum complexType is just sitting in the tns.
> >
> > However, I now notice that the same thing is happening to all of the
> > beans. Everything is in the TNS, regardless of package-of-origin.
> 
> 
> 
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog

RE: Migrating enums

Posted by Benson Margulies <bi...@basistech.com>.
Oh, well, that's simple enough.

> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Tuesday, October 23, 2007 3:33 PM
> To: cxf-user@incubator.apache.org
> Cc: Benson Margulies
> Subject: Re: Migrating enums
> 
> 
> This is probably working "as designed" for JAX-WS tck/spec compliance.
> 
> Basically, in the absense of namespace attributes on the @XmlType
> annotations or on the @XmlSchema annotation in the package-info, we
are
> supposed to map all the beans into schemas of the service namespace.
I
> know, kind of bizarre.
> 
> The easy fix is usually to create a package-info.java with the
> appropriate @XmlSchema annotation.    Otherwise, add the namespace
> attribute to all the @XmlType annotations on all the beans.
> 
> Dan
> 
> 
> On Tuesday 23 October 2007, Benson Margulies wrote:
> > In the interests of a less eventful life, I moved my production code
> > to JAXB from Aegis. My doc guy just pointed out to me that our WSDL
> > has rather less schema elements than expected. Indeed, there seems
to
> > have a been a giant migration to the service TNS, at least of enums.
> >
> > In the wsdl that is coming out of java2wsdl, I've got one schema.
> >
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:btrni="http://index.rnm.basistech.com"
> > xmlns:btrniws="http://ws.index.rnm.basistech.com"
> > xmlns:btrnm="http://rnm.basistech.com"
> > attributeFormDefault="unqualified" elementFormDefault="unqualified"
> > targetNamespace="http://ws.index.rnm.basistech.com">
> >
> > I then have a reference to an enum type:
> >
> > <xs:element minOccurs="0" name="script" type="btrniws:iso15924"/>
> >
> > This already looks wrong, insofar as that enum lives in
> > com.basistech.util, not com.basistech.rnm.index.ws.
> >
> > But it's at least consistent, since that is the tns and, sure
enough,
> > the enum complexType is just sitting in the tns.
> >
> > However, I now notice that the same thing is happening to all of the
> > beans. Everything is in the TNS, regardless of package-of-origin.
> 
> 
> 
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog

Re: Migrating enums

Posted by Daniel Kulp <dk...@apache.org>.
This is probably working "as designed" for JAX-WS tck/spec compliance.

Basically, in the absense of namespace attributes on the @XmlType 
annotations or on the @XmlSchema annotation in the package-info, we are 
supposed to map all the beans into schemas of the service namespace.  I 
know, kind of bizarre.

The easy fix is usually to create a package-info.java with the 
appropriate @XmlSchema annotation.    Otherwise, add the namespace 
attribute to all the @XmlType annotations on all the beans.

Dan


On Tuesday 23 October 2007, Benson Margulies wrote:
> In the interests of a less eventful life, I moved my production code
> to JAXB from Aegis. My doc guy just pointed out to me that our WSDL
> has rather less schema elements than expected. Indeed, there seems to
> have a been a giant migration to the service TNS, at least of enums.
>
> In the wsdl that is coming out of java2wsdl, I've got one schema.
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:btrni="http://index.rnm.basistech.com"
> xmlns:btrniws="http://ws.index.rnm.basistech.com"
> xmlns:btrnm="http://rnm.basistech.com"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://ws.index.rnm.basistech.com">
>
> I then have a reference to an enum type:
>
> <xs:element minOccurs="0" name="script" type="btrniws:iso15924"/>
>
> This already looks wrong, insofar as that enum lives in
> com.basistech.util, not com.basistech.rnm.index.ws.
>
> But it's at least consistent, since that is the tns and, sure enough,
> the enum complexType is just sitting in the tns.
>
> However, I now notice that the same thing is happening to all of the
> beans. Everything is in the TNS, regardless of package-of-origin.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: Migrating enums

Posted by Benson Margulies <bi...@basistech.com>.
This turns out to be specific to java2wsdl usage. I'm running the tool
from ant, with:

   <java classname="org.apache.cxf.tools.java2wsdl.JavaToWSDL"
fork="true">
         <arg value="-quiet"/>
         <arg value="-o"/>
         <arg value="NameIndex.wsdl"/>
         <arg
value="com.basistech.rnm.index.ws.impl.NameIndexServiceImpl"/>
         <classpath>
            <path refid="src-compile-classpath"/>
         </classpath>
      </java>

The classpath there should contain all the relevant impediment. I guess
the first step is to change 'quiet' to 'verbose'.

> -----Original Message-----
> From: Benson Margulies [mailto:bim2007@basistech.com]
> Sent: Tuesday, October 23, 2007 2:53 PM
> To: cxf-user@incubator.apache.org
> Subject: Migrating enums
> 
> In the interests of a less eventful life, I moved my production code
to
> JAXB from Aegis. My doc guy just pointed out to me that our WSDL has
> rather less schema elements than expected. Indeed, there seems to have
a
> been a giant migration to the service TNS, at least of enums.
> 
> In the wsdl that is coming out of java2wsdl, I've got one schema.
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:btrni="http://index.rnm.basistech.com"
> xmlns:btrniws="http://ws.index.rnm.basistech.com"
> xmlns:btrnm="http://rnm.basistech.com"
> attributeFormDefault="unqualified" elementFormDefault="unqualified"
> targetNamespace="http://ws.index.rnm.basistech.com">
> 
> I then have a reference to an enum type:
> 
> <xs:element minOccurs="0" name="script" type="btrniws:iso15924"/>
> 
> This already looks wrong, insofar as that enum lives in
> com.basistech.util, not com.basistech.rnm.index.ws.
> 
> But it's at least consistent, since that is the tns and, sure enough,
> the enum complexType is just sitting in the tns.
> 
> However, I now notice that the same thing is happening to all of the
> beans. Everything is in the TNS, regardless of package-of-origin.
>