That sounds like a problem with Xerces, if it's not catching the
validation error.
(Note that Axis does not attempt to validate messages, so you must
perform the validation using a handler or intermediary.)

Anne

On 2/6/07, pau carre <[EMAIL PROTECTED]> wrote:
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.
I use Eclispe WTP, AXIS 1.4 and Xerces for XML validation and WSDL4J
for WSDL validation.

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 OK with WSDL (the XML
instance based on the soap message whithout the soap-scepcific tags
emits an error with the XSD) :

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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to