You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by John Hite <jh...@appsecinc.com> on 2008/08/27 22:31:36 UTC

nillable schema elements and wsdl generation

Hi, 

I have a WSDL with a schema definition like this.

 

<element name="rules-config-dropResponse">

   <complexType>

    <sequence>

     <element name="output" type="xsd:string" minOccurs="0" maxOccurs="1"
nillable="true" />

    </sequence>

   </complexType>

  </element>

 </schema>

 

I can generate java code from this with WSDLToJava, but the
JaxWsServiceFactoryBean throws an exception when trying to create a client
or a server. 

 

    [javac] Compiling 6 source files to C:\lib

     [java] java2ws -wsdl -verbose -cp C:\ib -frontend jaxws -t
urn:company-product -servicename AppSensor -portname AppSensorPortType -o
AppSensorGenerated.wsdl -d C:\wsdl com.example.soap.arc.AppSensorPortType

     [java] java2ws - Apache CXF 2.1.2

     [java] Aug 27, 2008 4:15:29 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass

     [java] INFO: Creating Service
{urn:company-product}AppSensorPortTypeService from class
com.example.soap.arc.AppSensorPortType

     [java] Error: org.apache.ws.commons.schema.XmlSchemaException: Schema
name conflict in collection. Namespace: urn:company-product

     [java] java.lang.RuntimeException:
org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in
collection. Namespace: urn:company-product

     

 

I found that if I set the nillable attribute to false or remove it
completely the exception goes away. Is this a bug or is this the correct
behavior?

 

I'm using CXF 2.1.2.

 

Thanks,

John

 

 

 

 


Re: nillable schema elements and wsdl generation

Posted by Daniel Kulp <dk...@apache.org>.
It actually gets a step worse....  When round tripped, the schema has:
    <xs:element name="sayHelloResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="output" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

Basically, it loses the min/max/nillable stuff entirely.   :-(

Dan


On Thursday 28 August 2008 4:22:40 pm Daniel Kulp wrote:
> This seems to be a bug in JAXB.   Basicall, it's generating two schema
> documents.  One is completely empty (no element or type defs or anything)
> and a second that defines the type, but imports the empty one.   We can
> hack a workaround, but it definitely is a bug in jaxb.
>
> Dan
>
> On Thursday 28 August 2008 11:43:59 am John Hite wrote:
> > https://issues.apache.org/jira/browse/CXF-1769
> >
> > I included a wsdl and ant build that demonstrate the problem.
> >
> > John
> > -----Original Message-----
> >
> > It's at least one bug. It might be more. This is not a polite
> > diagnosis of whatever is going on. Could we have a JIRA?
> >
> > On Wed, Aug 27, 2008 at 4:31 PM, John Hite <jh...@appsecinc.com> wrote:
> > > Hi,
> > >
> > > I have a WSDL with a schema definition like this.
> > >
> > >
> > >
> > > <element name="rules-config-dropResponse">
> > >
> > >   <complexType>
> > >
> > >    <sequence>
> > >
> > >     <element name="output" type="xsd:string" minOccurs="0"
> > > maxOccurs="1" nillable="true" />
> > >
> > >    </sequence>
> > >
> > >   </complexType>
> > >
> > >  </element>
> > >
> > >  </schema>
> > >
> > >
> > >
> > > I can generate java code from this with WSDLToJava, but the
> > > JaxWsServiceFactoryBean throws an exception when trying to create a
> > > client or a server.
> > >
> > >
> > >
> > >    [javac] Compiling 6 source files to C:\lib
> > >
> > >     [java] java2ws -wsdl -verbose -cp C:\ib -frontend jaxws -t
> > > urn:company-product -servicename AppSensor -portname AppSensorPortType
> > > -o AppSensorGenerated.wsdl -d C:\wsdl
> > > com.example.soap.arc.AppSensorPortType
> > >
> > >     [java] java2ws - Apache CXF 2.1.2
> > >
> > >     [java] Aug 27, 2008 4:15:29 PM
> > > org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> > > buildServiceFromClass
> > >
> > >     [java] INFO: Creating Service
> > > {urn:company-product}AppSensorPortTypeService from class
> > > com.example.soap.arc.AppSensorPortType
> > >
> > >     [java] Error: org.apache.ws.commons.schema.XmlSchemaException:
> > > Schema name conflict in collection. Namespace: urn:company-product
> > >
> > >     [java] java.lang.RuntimeException:
> > > org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict
> > > in collection. Namespace: urn:company-product
> > >
> > >
> > >
> > >
> > >
> > > I found that if I set the nillable attribute to false or remove it
> > > completely the exception goes away. Is this a bug or is this the
> > > correct behavior?
> > >
> > >
> > >
> > > I'm using CXF 2.1.2.
> > >
> > >
> > >
> > > Thanks,
> > >
> > > John



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: nillable schema elements and wsdl generation

Posted by Daniel Kulp <dk...@apache.org>.
This seems to be a bug in JAXB.   Basicall, it's generating two schema 
documents.  One is completely empty (no element or type defs or anything) and 
a second that defines the type, but imports the empty one.   We can hack a 
workaround, but it definitely is a bug in jaxb.

Dan


On Thursday 28 August 2008 11:43:59 am John Hite wrote:
> https://issues.apache.org/jira/browse/CXF-1769
>
> I included a wsdl and ant build that demonstrate the problem.
>
> John
> -----Original Message-----
>
> It's at least one bug. It might be more. This is not a polite
> diagnosis of whatever is going on. Could we have a JIRA?
>
> On Wed, Aug 27, 2008 at 4:31 PM, John Hite <jh...@appsecinc.com> wrote:
> > Hi,
> >
> > I have a WSDL with a schema definition like this.
> >
> >
> >
> > <element name="rules-config-dropResponse">
> >
> >   <complexType>
> >
> >    <sequence>
> >
> >     <element name="output" type="xsd:string" minOccurs="0" maxOccurs="1"
> > nillable="true" />
> >
> >    </sequence>
> >
> >   </complexType>
> >
> >  </element>
> >
> >  </schema>
> >
> >
> >
> > I can generate java code from this with WSDLToJava, but the
> > JaxWsServiceFactoryBean throws an exception when trying to create a
> > client or a server.
> >
> >
> >
> >    [javac] Compiling 6 source files to C:\lib
> >
> >     [java] java2ws -wsdl -verbose -cp C:\ib -frontend jaxws -t
> > urn:company-product -servicename AppSensor -portname AppSensorPortType -o
> > AppSensorGenerated.wsdl -d C:\wsdl com.example.soap.arc.AppSensorPortType
> >
> >     [java] java2ws - Apache CXF 2.1.2
> >
> >     [java] Aug 27, 2008 4:15:29 PM
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> > buildServiceFromClass
> >
> >     [java] INFO: Creating Service
> > {urn:company-product}AppSensorPortTypeService from class
> > com.example.soap.arc.AppSensorPortType
> >
> >     [java] Error: org.apache.ws.commons.schema.XmlSchemaException: Schema
> > name conflict in collection. Namespace: urn:company-product
> >
> >     [java] java.lang.RuntimeException:
> > org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in
> > collection. Namespace: urn:company-product
> >
> >
> >
> >
> >
> > I found that if I set the nillable attribute to false or remove it
> > completely the exception goes away. Is this a bug or is this the correct
> > behavior?
> >
> >
> >
> > I'm using CXF 2.1.2.
> >
> >
> >
> > Thanks,
> >
> > John



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

RE: nillable schema elements and wsdl generation

Posted by John Hite <jh...@appsecinc.com>.
https://issues.apache.org/jira/browse/CXF-1769

I included a wsdl and ant build that demonstrate the problem.

John
-----Original Message-----

It's at least one bug. It might be more. This is not a polite
diagnosis of whatever is going on. Could we have a JIRA?

On Wed, Aug 27, 2008 at 4:31 PM, John Hite <jh...@appsecinc.com> wrote:
> Hi,
>
> I have a WSDL with a schema definition like this.
>
>
>
> <element name="rules-config-dropResponse">
>
>   <complexType>
>
>    <sequence>
>
>     <element name="output" type="xsd:string" minOccurs="0" maxOccurs="1"
> nillable="true" />
>
>    </sequence>
>
>   </complexType>
>
>  </element>
>
>  </schema>
>
>
>
> I can generate java code from this with WSDLToJava, but the
> JaxWsServiceFactoryBean throws an exception when trying to create a client
> or a server.
>
>
>
>    [javac] Compiling 6 source files to C:\lib
>
>     [java] java2ws -wsdl -verbose -cp C:\ib -frontend jaxws -t
> urn:company-product -servicename AppSensor -portname AppSensorPortType -o
> AppSensorGenerated.wsdl -d C:\wsdl com.example.soap.arc.AppSensorPortType
>
>     [java] java2ws - Apache CXF 2.1.2
>
>     [java] Aug 27, 2008 4:15:29 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
>
>     [java] INFO: Creating Service
> {urn:company-product}AppSensorPortTypeService from class
> com.example.soap.arc.AppSensorPortType
>
>     [java] Error: org.apache.ws.commons.schema.XmlSchemaException: Schema
> name conflict in collection. Namespace: urn:company-product
>
>     [java] java.lang.RuntimeException:
> org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in
> collection. Namespace: urn:company-product
>
>
>
>
>
> I found that if I set the nillable attribute to false or remove it
> completely the exception goes away. Is this a bug or is this the correct
> behavior?
>
>
>
> I'm using CXF 2.1.2.
>
>
>
> Thanks,
>
> John
>
>
>
>
>
>
>
>
>
>



Re: nillable schema elements and wsdl generation

Posted by Benson Margulies <bi...@gmail.com>.
It's at least one bug. It might be more. This is not a polite
diagnosis of whatever is going on. Could we have a JIRA?

On Wed, Aug 27, 2008 at 4:31 PM, John Hite <jh...@appsecinc.com> wrote:
> Hi,
>
> I have a WSDL with a schema definition like this.
>
>
>
> <element name="rules-config-dropResponse">
>
>   <complexType>
>
>    <sequence>
>
>     <element name="output" type="xsd:string" minOccurs="0" maxOccurs="1"
> nillable="true" />
>
>    </sequence>
>
>   </complexType>
>
>  </element>
>
>  </schema>
>
>
>
> I can generate java code from this with WSDLToJava, but the
> JaxWsServiceFactoryBean throws an exception when trying to create a client
> or a server.
>
>
>
>    [javac] Compiling 6 source files to C:\lib
>
>     [java] java2ws -wsdl -verbose -cp C:\ib -frontend jaxws -t
> urn:company-product -servicename AppSensor -portname AppSensorPortType -o
> AppSensorGenerated.wsdl -d C:\wsdl com.example.soap.arc.AppSensorPortType
>
>     [java] java2ws - Apache CXF 2.1.2
>
>     [java] Aug 27, 2008 4:15:29 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
>
>     [java] INFO: Creating Service
> {urn:company-product}AppSensorPortTypeService from class
> com.example.soap.arc.AppSensorPortType
>
>     [java] Error: org.apache.ws.commons.schema.XmlSchemaException: Schema
> name conflict in collection. Namespace: urn:company-product
>
>     [java] java.lang.RuntimeException:
> org.apache.ws.commons.schema.XmlSchemaException: Schema name conflict in
> collection. Namespace: urn:company-product
>
>
>
>
>
> I found that if I set the nillable attribute to false or remove it
> completely the exception goes away. Is this a bug or is this the correct
> behavior?
>
>
>
> I'm using CXF 2.1.2.
>
>
>
> Thanks,
>
> John
>
>
>
>
>
>
>
>
>
>