You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Phillips, Chad" <Ch...@gdit.com> on 2009/02/17 20:13:22 UTC

Problem with generated WSDLs

Hi,

I'm having a problem when using the WSDLs generated via Tuscany SCA Java
1.4 for services using the WS binding.  Specifically, I can't generate a
WS client using Axis, Axis2, JAX-WS, or XMLBeans with the Tuscany
generated WSDL.  The issue only seems to show up when the input
parameter for a service contains a complex type.  I've documented the
issue (including code to reproduce the error) in
https://issues.apache.org/jira/browse/TUSCANY-2853 

The problem seems to be related to how namespaces are being created
and/or associated with the complex types in the WSDL.  Has anyone else
encountered this issue and if so have you found a workaround to the
problem?

- Chad Phillips

Re: Problem with generated WSDLs

Posted by Raymond Feng <en...@gmail.com>.
I'll fix that issue. We were trying to create a package-based JAXBContext if 
there is a package-info with @XmlSchema. It will fail if the 
ObjectFactory.class is not present for the package.

Thanks,
Raymond

--------------------------------------------------
From: "Phillips, Chad" <Ch...@gdit.com>
Sent: Tuesday, February 17, 2009 2:58 PM
To: <us...@tuscany.apache.org>
Subject: RE: Problem with generated WSDLs

> Hi Raymond,
>
> Thanks for taking the time to look into this.  I added the supplied
> package-info.java to my test/server src dir and recompiled; this now
> generates a new error after starting up the SCA runtime (see below).  Do
> I need to generate ObjectFactory using a JAXB tool or create/generate
> jaxb.index?
>
>     [java] SEVERE: Exception thrown was:
> org.osoa.sca.ServiceRuntimeException: javax.xml.bind.JAXBException:
> "test.server" doesnt contain ObjectFactory.class o
> r jaxb.index
>     [java] Exception in thread "main"
> org.osoa.sca.ServiceRuntimeException: javax.xml.bind.JAXBException:
> "test.server" doesnt contain ObjectFactory.class or j
> axb.index
>     [java]     at
> org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper.getSchemaDefiniti
> ons(JAXBTypeHelper.java:241)
>     [java]     at
> org.apache.tuscany.sca.binding.ws.wsdlgen.Interface2WSDLGenerator.genera
> te(Interface2WSDLGenerator.java:308)
>     [java]     at
> org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator.createWSD
> LInterfaceContract(BindingWSDLGenerator.java:307)
>     [java]     at
> org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator.createWSD
> LDocument(BindingWSDLGenerator.java:205)
>     [java]     at
> org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator.generateW
> SDL(BindingWSDLGenerator.java:163)
>     [java]     at
> org.apache.tuscany.sca.binding.ws.xml.BindingBuilderImpl.build(BindingBu
> ilderImpl.java:48)
>     [java]     at
> org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuil
> derImpl.buildServiceBindings(ComponentServiceBindingBuilderImpl.java:
> 68)
>     [java]     at
> org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuil
> derImpl.build(ComponentServiceBindingBuilderImpl.java:48)
>     [java]     at
> org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl.build(
> CompositeBuilderImpl.java:204)
>     [java]     at
> org.apache.tuscany.sca.node.impl.RuntimeBootStrapper.buildComposite(Runt
> imeBootStrapper.java:244)
>     [java]     at
> org.apache.tuscany.sca.node.impl.NodeImpl.configureNode(NodeImpl.java:57
> 2)
>     [java]     at
> org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:167)
>     [java]     at
> org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassL
> oader(NodeFactoryImpl.java:37)
>     [java]     at
> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultS
> CADomain.java:175)
>     [java]     at
> org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(Defaul
> tSCADomain.java:97)
>     [java]     at
> org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADoma
> in.java:182)
>     [java]     at
> org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.jav
> a:63)
>     [java]     at test.server.Server.main(Server.java:9)
>     [java] Caused by: javax.xml.bind.JAXBException: "test.server"
> doesnt contain ObjectFactory.class or jaxb.index
>     [java]     at
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183
> )
>     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>     [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
>     [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>     [java]     at
> javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
>     [java]     at
> javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
>     [java]     at
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
>     [java]     at
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
>     [java]     at
> org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getJAXBContext(
> JAXBContextCache.java:242)
>     [java]     at
> org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getJAXBContext(
> JAXBContextCache.java:284)
>     [java]     at
> org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBCont
> ext(JAXBContextHelper.java:181)
>     [java]     at
> org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBCont
> ext(JAXBContextHelper.java:213)
>     [java]     at
> org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper.getSchemaDefiniti
> ons(JAXBTypeHelper.java:236)
>     [java]     ... 17 more
>
> -----Original Message-----
> From: Raymond Feng [mailto:enjoyjava@gmail.com]
> Sent: Tuesday, February 17, 2009 14:43
> To: user@tuscany.apache.org
> Subject: Re: Problem with generated WSDLs
>
> Hi,
>
> The issue is a result of JAXBContext.generateSchema(). JAXB doesn't try
> to
> derive the target namespace from the java package name and it use "" as
> the
> default unless the package is annotated with @XmlSchema.
>
> Adding a test/server/package-info.java with the following contents allow
> you
> to provide the namespace.
>
> @javax.xml.bind.annotation.XmlSchema(namespace="http://test/server")
> package test.server;
>
> Then the generated schema looks like:
>
> <?xml version="1.0" standalone="yes"?>
> <xs:schema version="1.0" targetNamespace="http://test/server"
> xmlns:tns="http://test/server"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
>  <xs:complexType name="data">
>    <xs:sequence>
>      <xs:element name="a" type="tns:data2" nillable="true"
> minOccurs="0"
> maxOccurs="unbounded"/>
>      <xs:element name="b" type="xs:int"/>
>      <xs:element name="c" type="xs:float"/>
>    </xs:sequence>
>  </xs:complexType>
>
>  <xs:complexType name="data2">
>    <xs:sequence>
>      <xs:element name="asdf" type="xs:string" nillable="true"
> minOccurs="0"
> maxOccurs="unbounded"/>
>    </xs:sequence>
>  </xs:complexType>
> </xs:schema>
>
> Can you try to add package-info.java? I agree it is not nice at all if
> the
> default value (no namespace) breaks the generated WSDL/XSD.
>
> Thanks,
> Raymond
>
>
> --------------------------------------------------
> From: "Phillips, Chad" <Ch...@gdit.com>
> Sent: Tuesday, February 17, 2009 11:13 AM
> To: <us...@tuscany.apache.org>
> Subject: Problem with generated WSDLs
>
>> Hi,
>>
>> I'm having a problem when using the WSDLs generated via Tuscany SCA
> Java
>> 1.4 for services using the WS binding.  Specifically, I can't generate
> a
>> WS client using Axis, Axis2, JAX-WS, or XMLBeans with the Tuscany
>> generated WSDL.  The issue only seems to show up when the input
>> parameter for a service contains a complex type.  I've documented the
>> issue (including code to reproduce the error) in
>> https://issues.apache.org/jira/browse/TUSCANY-2853
>>
>> The problem seems to be related to how namespaces are being created
>> and/or associated with the complex types in the WSDL.  Has anyone else
>> encountered this issue and if so have you found a workaround to the
>> problem?
>>
>> - Chad Phillips 


RE: Problem with generated WSDLs

Posted by "Phillips, Chad" <Ch...@gdit.com>.
Hi Raymond,

Thanks for taking the time to look into this.  I added the supplied
package-info.java to my test/server src dir and recompiled; this now
generates a new error after starting up the SCA runtime (see below).  Do
I need to generate ObjectFactory using a JAXB tool or create/generate
jaxb.index?

     [java] SEVERE: Exception thrown was:
org.osoa.sca.ServiceRuntimeException: javax.xml.bind.JAXBException:
"test.server" doesnt contain ObjectFactory.class o
r jaxb.index
     [java] Exception in thread "main"
org.osoa.sca.ServiceRuntimeException: javax.xml.bind.JAXBException:
"test.server" doesnt contain ObjectFactory.class or j
axb.index
     [java]     at
org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper.getSchemaDefiniti
ons(JAXBTypeHelper.java:241)
     [java]     at
org.apache.tuscany.sca.binding.ws.wsdlgen.Interface2WSDLGenerator.genera
te(Interface2WSDLGenerator.java:308)
     [java]     at
org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator.createWSD
LInterfaceContract(BindingWSDLGenerator.java:307)
     [java]     at
org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator.createWSD
LDocument(BindingWSDLGenerator.java:205)
     [java]     at
org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator.generateW
SDL(BindingWSDLGenerator.java:163)
     [java]     at
org.apache.tuscany.sca.binding.ws.xml.BindingBuilderImpl.build(BindingBu
ilderImpl.java:48)
     [java]     at
org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuil
derImpl.buildServiceBindings(ComponentServiceBindingBuilderImpl.java:
68)
     [java]     at
org.apache.tuscany.sca.assembly.builder.impl.ComponentServiceBindingBuil
derImpl.build(ComponentServiceBindingBuilderImpl.java:48)
     [java]     at
org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl.build(
CompositeBuilderImpl.java:204)
     [java]     at
org.apache.tuscany.sca.node.impl.RuntimeBootStrapper.buildComposite(Runt
imeBootStrapper.java:244)
     [java]     at
org.apache.tuscany.sca.node.impl.NodeImpl.configureNode(NodeImpl.java:57
2)
     [java]     at
org.apache.tuscany.sca.node.impl.NodeImpl.<init>(NodeImpl.java:167)
     [java]     at
org.apache.tuscany.sca.node.impl.NodeFactoryImpl.createSCANodeFromClassL
oader(NodeFactoryImpl.java:37)
     [java]     at
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultS
CADomain.java:175)
     [java]     at
org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.<init>(Defaul
tSCADomain.java:97)
     [java]     at
org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADoma
in.java:182)
     [java]     at
org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.jav
a:63)
     [java]     at test.server.Server.main(Server.java:9)
     [java] Caused by: javax.xml.bind.JAXBException: "test.server"
doesnt contain ObjectFactory.class or jaxb.index
     [java]     at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183
)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
     [java]     at
javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
     [java]     at
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
     [java]     at
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
     [java]     at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getJAXBContext(
JAXBContextCache.java:242)
     [java]     at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getJAXBContext(
JAXBContextCache.java:284)
     [java]     at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBCont
ext(JAXBContextHelper.java:181)
     [java]     at
org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBCont
ext(JAXBContextHelper.java:213)
     [java]     at
org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper.getSchemaDefiniti
ons(JAXBTypeHelper.java:236)
     [java]     ... 17 more

-----Original Message-----
From: Raymond Feng [mailto:enjoyjava@gmail.com] 
Sent: Tuesday, February 17, 2009 14:43
To: user@tuscany.apache.org
Subject: Re: Problem with generated WSDLs

Hi,

The issue is a result of JAXBContext.generateSchema(). JAXB doesn't try
to 
derive the target namespace from the java package name and it use "" as
the 
default unless the package is annotated with @XmlSchema.

Adding a test/server/package-info.java with the following contents allow
you 
to provide the namespace.

@javax.xml.bind.annotation.XmlSchema(namespace="http://test/server")
package test.server;

Then the generated schema looks like:

<?xml version="1.0" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://test/server" 
xmlns:tns="http://test/server"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="data">
    <xs:sequence>
      <xs:element name="a" type="tns:data2" nillable="true"
minOccurs="0" 
maxOccurs="unbounded"/>
      <xs:element name="b" type="xs:int"/>
      <xs:element name="c" type="xs:float"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="data2">
    <xs:sequence>
      <xs:element name="asdf" type="xs:string" nillable="true"
minOccurs="0" 
maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

Can you try to add package-info.java? I agree it is not nice at all if
the 
default value (no namespace) breaks the generated WSDL/XSD.

Thanks,
Raymond


--------------------------------------------------
From: "Phillips, Chad" <Ch...@gdit.com>
Sent: Tuesday, February 17, 2009 11:13 AM
To: <us...@tuscany.apache.org>
Subject: Problem with generated WSDLs

> Hi,
>
> I'm having a problem when using the WSDLs generated via Tuscany SCA
Java
> 1.4 for services using the WS binding.  Specifically, I can't generate
a
> WS client using Axis, Axis2, JAX-WS, or XMLBeans with the Tuscany
> generated WSDL.  The issue only seems to show up when the input
> parameter for a service contains a complex type.  I've documented the
> issue (including code to reproduce the error) in
> https://issues.apache.org/jira/browse/TUSCANY-2853
>
> The problem seems to be related to how namespaces are being created
> and/or associated with the complex types in the WSDL.  Has anyone else
> encountered this issue and if so have you found a workaround to the
> problem?
>
> - Chad Phillips 

Re: Problem with generated WSDLs

Posted by Raymond Feng <en...@gmail.com>.
Hi,

The issue is a result of JAXBContext.generateSchema(). JAXB doesn't try to 
derive the target namespace from the java package name and it use "" as the 
default unless the package is annotated with @XmlSchema.

Adding a test/server/package-info.java with the following contents allow you 
to provide the namespace.

@javax.xml.bind.annotation.XmlSchema(namespace="http://test/server")
package test.server;

Then the generated schema looks like:

<?xml version="1.0" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://test/server" 
xmlns:tns="http://test/server" xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:complexType name="data">
    <xs:sequence>
      <xs:element name="a" type="tns:data2" nillable="true" minOccurs="0" 
maxOccurs="unbounded"/>
      <xs:element name="b" type="xs:int"/>
      <xs:element name="c" type="xs:float"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="data2">
    <xs:sequence>
      <xs:element name="asdf" type="xs:string" nillable="true" minOccurs="0" 
maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

Can you try to add package-info.java? I agree it is not nice at all if the 
default value (no namespace) breaks the generated WSDL/XSD.

Thanks,
Raymond


--------------------------------------------------
From: "Phillips, Chad" <Ch...@gdit.com>
Sent: Tuesday, February 17, 2009 11:13 AM
To: <us...@tuscany.apache.org>
Subject: Problem with generated WSDLs

> Hi,
>
> I'm having a problem when using the WSDLs generated via Tuscany SCA Java
> 1.4 for services using the WS binding.  Specifically, I can't generate a
> WS client using Axis, Axis2, JAX-WS, or XMLBeans with the Tuscany
> generated WSDL.  The issue only seems to show up when the input
> parameter for a service contains a complex type.  I've documented the
> issue (including code to reproduce the error) in
> https://issues.apache.org/jira/browse/TUSCANY-2853
>
> The problem seems to be related to how namespaces are being created
> and/or associated with the complex types in the WSDL.  Has anyone else
> encountered this issue and if so have you found a workaround to the
> problem?
>
> - Chad Phillips 

Re: Problem with generated WSDLs

Posted by Raymond Feng <en...@gmail.com>.
Hi,

It seems that the java package name to XML namespace is messed up. Let me 
try to investigate.

Thanks,
Raymond

--------------------------------------------------
From: "Phillips, Chad" <Ch...@gdit.com>
Sent: Tuesday, February 17, 2009 11:13 AM
To: <us...@tuscany.apache.org>
Subject: Problem with generated WSDLs

> Hi,
>
> I'm having a problem when using the WSDLs generated via Tuscany SCA Java
> 1.4 for services using the WS binding.  Specifically, I can't generate a
> WS client using Axis, Axis2, JAX-WS, or XMLBeans with the Tuscany
> generated WSDL.  The issue only seems to show up when the input
> parameter for a service contains a complex type.  I've documented the
> issue (including code to reproduce the error) in
> https://issues.apache.org/jira/browse/TUSCANY-2853
>
> The problem seems to be related to how namespaces are being created
> and/or associated with the complex types in the WSDL.  Has anyone else
> encountered this issue and if so have you found a workaround to the
> problem?
>
> - Chad Phillips