You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "I.Cougil" <ig...@yahoo.es> on 2008/12/13 12:44:29 UTC

WSDL incorrect - in XSD elements always must be the root element?

Hi!
First of all, sorry about my english, but I'm not accustomed to write in
this language ;-)
We're trying to publish a Webservice with JAXWS with the support of CXF and
with a classes generated via JAXB parsing a group of XSD files, always in a
maven project with java 5.
More explained the steps we are trying to follow:
1) parse the XSD group files with JAXB and generate a JAR file
2) use the classes packaged in the JAR file in other maven project and
define and deploy a webapp with the webservice using CXF + JAXWS
The problem seems to be that if the elements in the original XSD files
aren't root elements the WSDL generated is incorrect.
Here there are the XSD files we are using and the WSDL error result (XMLSpy
dixit, "ns1:Example" must refer to an existing element).
Anyone knows what happens?
Thank you in advance and sorry about this large message!

--- start of TEST.XSD --
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://example.work/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.work/test" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:include schemaLocation="TEST_TYPE.xsd"/>
<!--
if we define the Example Element like this, everything works ok! why?
because Example is defined global?
<xs:element name="Example" type="ExampleType"/>
-->
<xs:element name="TEST_ELEMENT">
<xs:annotation>
<xs:documentation>Blablabla</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Example" type="TestType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
-- end --

--- start of TEST_TYPE.xsd --
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://example.work/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.work/test" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:complexType name="TestType">
<xs:annotation>
<xs:documentation>Example type</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="Element_A" type="xs:string"/>
<xs:element name="Elment_B" type="xs:boolean"/>
<xs:element name="Sex" type="SexType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="SexType">
<xs:annotation>
<xs:documentation>Sex Type</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="M"/>
<xs:enumeration value="W"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
-- end --

-- start WSL error --
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="TestBO" targetNamespace="http://our.package.test/"
xmlns:ns1="http://our.package.test/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://example.work/test"
xmlns:tns="http://example.work/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="TEST_ELEMENT">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="Example"
type="tns:TestType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="TestType">
<xs:sequence>
<xs:element name="Element_A" type="xs:string"/>
<xs:element name="Elment_B" type="xs:boolean"/>
<xs:element name="Sex" type="tns:SexType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="SexType">
<xs:restriction base="xs:string">
<xs:enumeration value="M"/>
<xs:enumeration value="W"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified" targetNamespace="http://our.package.test"
xmlns:ns1="http://example.work/test" xmlns:tns="http://our.package.test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://example.work/test"/>
<xs:element name="test" type="tns:test"/>
<xs:element name="testResponse" type="tns:testResponse"/>
<xs:complexType name="test">
<xs:sequence>
<xs:element minOccurs="0" name="test">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="ns1:Example"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" ref="ns1:Example"/> <!--
here is the error - XMLSpy dixit that ns1:Example must refer to an existing
element -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="test">
<wsdl:part element="ns1:test" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="testResponse">
<wsdl:part element="ns1:testResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="TestBO">
<wsdl:operation name="test">
<wsdl:input message="ns1:test" name="test">
</wsdl:input>
<wsdl:output message="ns1:testResponse" name="testResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
</wsdl:definitions>
-- end -- 
-- 
View this message in context: http://www.nabble.com/WSDL-incorrect---in-XSD-elements-always-must-be-the-root-element--tp20989424p20989424.html
Sent from the cxf-user mailing list archive at Nabble.com.