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/03/14 02:02:54 UTC

RE: Problem with generated WSDLs

Revisiting this issue (TUSCANY-2853).

For clarity, the test server/client I'm referring to are in the test
program, now test2.zip, attached to TUSCANY-2853.

Here is what I did today:

* Checked out and built the 1.x branch (currently 1.5-SNAPSHOT)
* Added the supplied package-info.java to src/test/server
* Recompiled the test code and started the test server
* Retrieved the WSDL via a web browser
* Reran the test client to generate the WS client using Axis

This results in the same error that I was seeing on 1.4:

     [java] java.io.IOException: Type data is referenced but not
defined.
     [java]     at
org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTab
le.java:665)
     [java]     at
org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
     [java]     at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:5
18)
     [java]     at
org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:4
95)
     [java]     at
org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
     [java]     at java.lang.Thread.run(Thread.java:595)

I then changed the namespace from http://test/server to
http://server.test in the package-info.java, and reran the test which
resulted in the same error as shown above.  The test2.zip contains that
namespace change as well.

Is there something else that I need to do to implement the workaround?

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

FYI: the fix is checked into 1.x branch: 
http://svn.apache.org/viewvc?rev=745299&view=rev

Thanks,
Raymond

--------------------------------------------------
From: "Raymond Feng" <en...@gmail.com>
Sent: Tuesday, February 17, 2009 3:17 PM
To: <us...@tuscany.apache.org>
Subject: Re: Problem with generated WSDLs

> 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 Raymond Feng <en...@gmail.com>.
Hi,

I found the issue (the child elements under the doc-lit-wrapper are missing 
the type namespace) and worked out a fix. I'll have to do some more tests 
before I checked it in.

Thanks,
Raymond
--------------------------------------------------
From: "Phillips, Chad" <Ch...@gdit.com>
Sent: Friday, March 13, 2009 6:02 PM
To: <us...@tuscany.apache.org>
Subject: RE: Problem with generated WSDLs

> Revisiting this issue (TUSCANY-2853).
>
> For clarity, the test server/client I'm referring to are in the test
> program, now test2.zip, attached to TUSCANY-2853.
>
> Here is what I did today:
>
> * Checked out and built the 1.x branch (currently 1.5-SNAPSHOT)
> * Added the supplied package-info.java to src/test/server
> * Recompiled the test code and started the test server
> * Retrieved the WSDL via a web browser
> * Reran the test client to generate the WS client using Axis
>
> This results in the same error that I was seeing on 1.4:
>
>     [java] java.io.IOException: Type data is referenced but not
> defined.
>     [java]     at
> org.apache.axis.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTab
> le.java:665)
>     [java]     at
> org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:545)
>     [java]     at
> org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:5
> 18)
>     [java]     at
> org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:4
> 95)
>     [java]     at
> org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
>     [java]     at java.lang.Thread.run(Thread.java:595)
>
> I then changed the namespace from http://test/server to
> http://server.test in the package-info.java, and reran the test which
> resulted in the same error as shown above.  The test2.zip contains that
> namespace change as well.
>
> Is there something else that I need to do to implement the workaround?
>
> -----Original Message-----
> From: Raymond Feng [mailto:enjoyjava@gmail.com]
> Sent: Tuesday, February 17, 2009 15:43
> To: user@tuscany.apache.org
> Subject: Re: Problem with generated WSDLs
>
> FYI: the fix is checked into 1.x branch:
> http://svn.apache.org/viewvc?rev=745299&view=rev
>
> Thanks,
> Raymond
>
> --------------------------------------------------
> From: "Raymond Feng" <en...@gmail.com>
> Sent: Tuesday, February 17, 2009 3:17 PM
> To: <us...@tuscany.apache.org>
> Subject: Re: Problem with generated WSDLs
>
>> 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
>>