XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS