You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by sebge2 <se...@cyberplongeurs.be> on 2010/09/27 17:56:35 UTC

"Original global element found in file" exception in WSDL2Java

Hello,

We are creating WSDL dynamically from Java; XML is mapped by XmlBeans. The
SOAP binding is BARE, document and literal. Unfortunately, it seems that the
same element (the same Qname) is declared several times in different schema
within the same WSDL.

For instance, the first time by BankListReponse is declared:

<wsdl:types>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified" 
targetNamespace="http://www.X.com/is/xml/core/service/bank" 
xmlns="http://www.X.com/is/xml/core/service/bank" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="BankListRequest">
<xsd:complexType>
<xsd:sequence/>
</xsd:complexType>
</xsd:element>
<xsd:element name="BankListResponse" nillable="true"/>
</xsd:schema>
...


The element is not completely declared. Later in the same WSDL, I can find
its complete definition:

<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.X.com/is/xml/core/service/bank" 
xmlns="http://www.X.com/is/xml/core/service/bank" 
xmlns:ban="http://www.X.com/is/xml/core/model/bank" 
xmlns:rep="http://www.X.com/is/xml/core/model/util/report" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.X.com/is/xml/core/model/util/report"/>
<xsd:import namespace="http://www.X.com/is/xml/core/model/bank"/>
<xsd:element name="BankListResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="report" type="rep:Report"/>
<xsd:element name="banks">
<xsd:complexType>
<xsd:sequence maxOccurs="unbounded" minOccurs="0">
<xsd:element name="bank" type="ban:Bank"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>


The bug seems to be the same as http://jira.codehaus.org/browse/XFIRE-1071.
Do you have any idea why the declaration of my elements are split like that?

Note that I've discovered this bug when using WSDL2Java. Web services can be
called by CXF/Xfire clients. SOAPUI is also able to create sample requests
based on the wrong WSDL.

Thank you!
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Original-global-element-found-in-file-exception-in-WSDL2Java-tp2855513p2855513.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: "Original global element found in file" exception in WSDL2Java

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 29 September 2010 3:19:08 am sebge2 wrote:
> We have found why that problem is occurring. We are using several XSD files
> with the same target namespace i.e., the elements of a the same namespace
> are spread into different files.
> 
> When CXF is generating the schema for a namespace, it can find the first
> element definition, but not the others. For those elements it is simply
> putting a nillable attribute. When it finds other files, it simply appends
> their definitions in a new schema definition.
> 
> 
> Is CXF requiring that each namespace must be declared in a single file?

Well, it's a requirement of schema that a single namespace be imported via a 
single location.  The schema for that namespace can be split accross several 
files, but those files are then <xsd:include> into a "top level" schema for 
that namespace which would then be imported into the other schemas/wsdl.  That 
is a requirement of schema, not so much CXF. 

If you are using xsd:import or wsdl:import things to import multple  schema 
files of the same namespaces, that would be invalid.


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

Re: "Original global element found in file" exception in WSDL2Java

Posted by sebge2 <se...@cyberplongeurs.be>.
We have found why that problem is occurring. We are using several XSD files
with the same target namespace i.e., the elements of a the same namespace
are spread into different files.

When CXF is generating the schema for a namespace, it can find the first
element definition, but not the others. For those elements it is simply
putting a nillable attribute. When it finds other files, it simply appends
their definitions in a new schema definition.


Is CXF requiring that each namespace must be declared in a single file?
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Original-global-element-found-in-file-exception-in-WSDL2Java-tp2855513p2972063.html
Sent from the cxf-user mailing list archive at Nabble.com.