You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Thébault, Médérick" <Me...@brittany-ferries.fr> on 2003/02/12 19:09:28 UTC
Xerces 2.x
Hello
Here are the schema that I try to use.
TruckTrace.xsd, TruckTraceSoap.xsd, TruckTraceRequest.xsd,
TruckTraceResponse.xsd.
TruckTrace.xsd
<xs:schema targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:response="http://foo/TruckTrace"
xmlns:request="http://foo/TruckTrace" elementFormDefault="qualified"
attributeFormDefault="qualified">
<!-- <xs:import namespace="http://foo/TruckTrace"
schemaLocation="TruckTraceRequest.xsd"/>
<xs:import namespace="http://foo/TruckTrace"
schemaLocation="TruckTraceResponse.xsd"/> -->
<xs:import namespace="http://foo/TruckTrace"
schemaLocation="TruckTraceSoap.xsd"/>
<xs:element name="Envelope">
<xs:complexType>
<xs:sequence>
<xs:element name="Header"
type="SOAP-ENV:HeaderType" form="qualified" minOccurs="0"/>
<xs:element name="Body"
form="qualified">
<xs:complexType>
<xs:choice>
<xs:element
ref="request:truckEnqui"/>
<xs:element
ref="response:truckResponse"/>
<xs:element
name="Fault" type="SOAP-ENV:FaultType"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="encodingStyle"
use="optional" fixed="http://schemas.xmlsoap.org/soap/encoding/"/>
</xs:complexType>
</xs:element>
<xs:complexType name="HeaderType">
<xs:sequence>
<xs:any namespace="##other"
processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute namespace="##other"
processContents="lax"/>
</xs:complexType>
<xs:complexType name="FaultType">
<xs:sequence>
<xs:element name="faultcode" type="xs:QName"/>
<xs:element name="faultstring"
type="xs:string"/>
<xs:element name="faultfactor" type="xs:anyURI"
minOccurs="0"/>
<xs:element name="detail" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:any
namespace="##any" processContents="lax" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute
namespace="##any" processContents="lax"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
TruckTraceSoap.xsd
<xs:schema targetNamespace="http://foo/TruckTrace"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="TruckTraceRequest.xsd"/>
<xs:include schemaLocation="TruckTraceResponse.xsd"/>
</xs:schema>
TruckTraceRequest.xsd
<xs:schema targetNamespace="http://foo/TruckTrace"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://foo/TruckTrace" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xs:element name="truckEnqui" type="TruckEnquiType"/>
........................
</xs:schema>
Here is the value for my parser property
"http://apache.org/xml/properties/schema/external-schemaLocation"
Object value = "http://schemas.xmlsoap.org/soap/envelope/ "+ directory
+"TruckTrace.xsd";
When receiving request like the following, all is OK for my parser :
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding">
<soap-env:Body>
<ns0:truckEnqui xmlns:ns0="http://foo/TruckTrace">
<sClientAccountNo>F101012E</sClientAccountNo>
<dDepartureDate>2003-02-12T00:00:00</dDepartureDate>
<sSearchWithinFiveDays>Y</sSearchWithinFiveDays>
<sRoute/>
<sRegistrationNo/>
</ns0:truckEnqui>
</soap-env:Body>
</soap-env:Envelope>
but maybe not according to W3C specs....
The request like the following is more annoying :
<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding"
xsi:schemaLocation="http://foo/TruckTrace TruckTrace.xsd">
<soap-env:Body>
<ns0:truckEnqui xmlns:ns0="http://foo/TruckTrace">
<sClientAccountNo>F101012E</sClientAccountNo>
<dDepartureDate>2003-02-12T00:00:00</dDepartureDate>
<sSearchWithinFiveDays>Y</sSearchWithinFiveDays>
<sRoute/>
<sRegistrationNo/>
</ns0:truckEnqui>
</soap-env:Body>
</soap-env:Envelope>
because then we got this error :
src-import.3.1: The namespace attribute 'http://foo/TruckTrace' of an
<import> element information item must be identical to the
targetNamespace attribute 'http://schemas.xmlsoap.org/soap/envelope/' of
the imported document.
And when changing the parser property to
Object value = "http://foo/TruckTrace "+ directory +"TruckTrace.xsd";
then I got
cvc-elt.1: Cannot find the declaration of element 'soap-env:Envelope'.
Am I wrong in the settings of the parser, Do I have to modify the
request, Do the Schema are OK? I am a bit lost. Does something exist
somewhere to help answering those questions a part W3C specs?
Thanx
Mederick
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org