[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

keyref works in xsd but not in wsdl

  • From: "pau carre" <pau.carre@g...>
  • To: xml-dev@l...
  • Date: Mon, 5 Feb 2007 13:35:46 +0100

keyref works in xsd but not in wsdl
Hi all, I have witten an schema (XSD) using key and keyref elements.
This XSD has been tested successfully with some XML files.
The problem is that when I add this XSD to a WSDL (copy-paste) wrong
soap instances (XML instances in the context of XSD) are validated OK
when they do not fit the keyref constraint.

The XSD  is:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:tns="http://localhost:8080/hotelres"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://localhost:8080/hotelres"
	attributeFormDefault="unqualified" elementFormDefault="qualified"
	xmlns="http://www.w3.org/2001/XMLSchema">
	<xs:element name="contract">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="roomtypes">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="roomtype"
								type="tns:roomtypeType">
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="sizes">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="size"
								type="tns:sizeType" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute name="id" type="xs:string" use="required" />
		</xs:complexType>
		<xs:key name="roomtypesCodeID">
			<xs:selector xpath="./tns:roomtypes/tns:roomtype" />
			<xs:field xpath="@code" />
		</xs:key>
		<xs:keyref name="roomtypesCodeIDRef"
			refer="tns:roomtypesCodeID">
			<xs:selector	

xpath="./tns:sizes/tns:size/tns:RoomtypeReferences/tns:RoomtypeReference" />
			<xs:field xpath="@code" />
		</xs:keyref>
	</xs:element>
	<xs:complexType name="roomtypeType">
		<xs:attribute name="code" type="xs:string" use="required" />
	</xs:complexType>
	<xs:complexType name="sizeType">
		<xs:sequence>
			<xs:element name="RoomtypeReferences">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="RoomtypeReference">
							<xs:complexType>
								<xs:attribute name="code"
									type="xs:string" />
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</schema>

The WSDL is:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://localhost:8080/hotelres"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://localhost:8080/hotelres">
	<wsdl:types>
		<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://localhost:8080/hotelres">

<!-- THE SAME SCHEMA AS THE XSD DEFINED ABOVE -->
		
		</xs:schema>

	</wsdl:types>
	<wsdl:message name="updateContractRQ">
		<wsdl:part element="tns:contract" name="parameter"/>
	</wsdl:message>
	<wsdl:message name="updateContractRS">
		<wsdl:part element="tns:contractResponse" name="parameter"/>
	</wsdl:message>
	<wsdl:portType name="htrBackOffice_SOAP">
		<wsdl:operation name="UpdateContract">
			<wsdl:input message="tns:updateContractRQ"/>
			<wsdl:output message="tns:updateContractRS"/>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="htrBackOfficeSOAP" type="tns:htrBackOffice_SOAP">
		<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="UpdateContract">
			<soap:operation soapAction="urn:UpdateContract" style="document"/>
			<wsdl:input>
				<soap:body use="literal"/>
			</wsdl:input>
			<wsdl:output>
				<soap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="htrBackOffice">
		<wsdl:port binding="tns:htrBackOfficeSOAP" name="htrBackOfficeSOAP">
			<soap:address
location="http://localhost:8080/hhNewSOAP/services/htrBackOfficeSOAP"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

One example of soap message that is validated but is acceptated with WSDL:

soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:hot="http://localhost:8080/hotelres">
   <soapenv:Header/>
   <soapenv:Body>
      <hot:contract id="A">
         <hot:roomtypes>
            <hot:roomtype code="AA"/>
         </hot:roomtypes>
         <hot:sizes>
            <hot:size>
               <hot:RoomtypeReferences>
                  <hot:RoomtypeReference code="CC"/>
               </hot:RoomtypeReferences>
            </hot:size>
         </hot:sizes>
      </hot:contract>
   </soapenv:Body>
</soapenv:Envelope>


Thanks in advance,
Pau.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.