Re: [xml-dev] XSD Schema type derived by restriction problem

From
Christopher Loschen <>
To
Date
2009-11-20T18:39:11Z
ID
<>
Thread
Re: [xml-dev] XSD Schema type derived by restriction problem
Hi Ken,

Thanks very much for your reply!

Yes, we do have the xs prefix mapped.

The SOAP request going out looks like this :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 	<soapenv:Header>
 		<mes:MessageHeader
xmlns:mes="http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd">
 			<mes:TrackingMessageHeader>
 				<cin:version
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">v20</cin:version>
 				<cin:messageId
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">CSI-CES-TEST:1248272571983</cin:messageId>
 				<cin:timeToLive
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">72000000000</cin:timeToLive>
 				<cin:dateTimeStamp
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd"
xsi:type="xs:dateTime">2009-07-22T14:22:51.983Z</cin:dateTimeStamp>
 			</mes:TrackingMessageHeader>
 			<mes:SecurityMessageHeader>
 				<cin:userName
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">csitest</cin:userName>
 				<cin:userPassword
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">testcsi</cin:userPassword>
 			</mes:SecurityMessageHeader>
 			<mes:SequenceMessageHeader>
 				<cin:sequenceNumber
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">1</cin:sequenceNumber>
 				<cin:totalInSequence
xmlns:cin="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd">1</cin:totalInSequence>
 			</mes:SequenceMessageHeader>
 		</mes:MessageHeader>
 	</soapenv:Header>
 	<soapenv:Body>
 		<ech:EchoRequest
xmlns:ech="http://csi.xxx.com/CSI/Namespaces/Container/Public/EchoRequest.xsd">
 			<ech:data>H E L L O</ech:data>
 		</ech:EchoRequest>
 	</soapenv:Body>
 </soapenv:Envelope>

The response from the server looks like this :

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:m="http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd"
xmlns:cer="http://csi.xxx.com/CSI/Namespaces/Types/Public/ErrorResponse.xsd">
 	<soap-env:Header>
 		<m:MessageHeader>
 			<TrackingMessageHeader
xmlns="http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd"
xmlns:cng="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd"
xmlns:soap="http://csi.xxx.com/CSI/Namespaces/JMS/Public/SoapFaultResponse.xsd">
 				<cng:version>v20</cng:version>
 				<cng:messageId>CSI-CES-TEST:1248272571983</cng:messageId>
 				<cng:timeToLive>72000000000</cng:timeToLive>
 			
<cng:conversationId>csitest~CNG-CSI~89ccf9d49d35d1f5:2c53d17b:122997122c9:-6dfd</cng:conversationId>
 				<cng:dateTimeStamp>2009-07-22T14:22:51.983Z</cng:dateTimeStamp>
 			</TrackingMessageHeader>
 			<SecurityMessageHeader
xmlns="http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd"
xmlns:cng="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd"
xmlns:soap="http://csi.xxx.com/CSI/Namespaces/JMS/Public/SoapFaultResponse.xsd">
 				<cng:userName>csitest</cng:userName>
 				<cng:userPassword>testcsi</cng:userPassword>	
 			</SecurityMessageHeader>
 			<SequenceMessageHeader
xmlns="http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd"
xmlns:cng="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd"
xmlns:soap="http://csi.xxx.com/CSI/Namespaces/JMS/Public/SoapFaultResponse.xsd">
 				<cng:sequenceNumber>1</cng:sequenceNumber>
 				<cng:totalInSequence>1</cng:totalInSequence>
 			</SequenceMessageHeader>
 		</m:MessageHeader>
 	</soap-env:Header>
 	<soap-env:Body>
 		<soap-env:Fault
xmlns:soap1="http://csi.xxx.com/CSI/Namespaces/Types/Public/SoapFaultDetails.xsd">
 			<faultcode>soap-env:Client</faultcode>
 			<faultstring>Unknown Error</faultstring>
 			<faultactor>soap-env:Client</faultactor>
 			<detail>
 				<soap1:CSIApplicationException>
 					<cer:Response
xmlns="http://csi.xxx.com/CSI/Namespaces/Types/Public/SoapFaultDetails.xsd"
xmlns:cng="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd"
xmlns:ns0="http://csi.xxx.com/CSI/Namespaces/Types/Public/SoapFault.xsd">
 						<cng:code>900</cng:code>
 						<cng:description>Unknown Error</cng:description>
 					</cer:Response>
 					<cer:ServiceProviderEntity
xmlns="http://csi.xxx.com/CSI/Namespaces/Types/Public/SoapFaultDetails.xsd"
xmlns:cng="http://csi.xxx.com/CSI/Namespaces/Types/Public/XXXDataModel.xsd"
xmlns:ns0="http://csi.xxx.com/CSI/Namespaces/Types/Public/SoapFault.xsd">
 						<cer:reportingServiceEntity>GATEWAY</cer:reportingServiceEntity>
 						<cer:faultDate>2009-07-22Z</cer:faultDate>
 						<cer:faultSequenceNumber>1</cer:faultSequenceNumber>
 						<cer:faultLevel>ERROR</cer:faultLevel>
 						<cer:faultCode>90000000001</cer:faultCode>
 						<cer:faultDescription>The method
[com.prft.gateway.common.XmlTransformHelper.transformRequest] raised exception
[java.lang.Exception].  java.lang.Exception: Invalid SOAP Request - Failed
Schema Validation Errors in the Header :
 Invalid xsi:type qname: 'xs:dateTime' in element
TrackingMessageHeader@http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd</cer:faultDescription>
 						<cer:ServiceProviderRawError>
 							<cer:code/>
 							<cer:description>The method
[com.prft.gateway.common.XmlTransformHelper.transformRequest] raised exception
[java.lang.Exception].  java.lang.Exception: Invalid SOAP Request - Failed
Schema Validation Errors in the Header :
 Invalid xsi:type qname: 'xs:dateTime' in element
TrackingMessageHeader@http://csi.xxx.com/CSI/Namespaces/Types/Public/MessageHeader.xsd</cer:description>
 						</cer:ServiceProviderRawError>
 					</cer:ServiceProviderEntity>
 				</soap1:CSIApplicationException>
 			</detail>
 		</soap-env:Fault>
 	</soap-env:Body>
 </soap-env:Envelope>

Thanks for any pointers or suggestions you might have.

Best,
Chris



Sorry, in my haste I mistyped the prefix ... you will need:

   xmlns:xs="http://www.w3.org/2001/XMLSchema"

... in your document for "xs:dateTime" to be a valid QName representing the
W3C Schema data type.

. . . . . . . . Ken

At 2009-11-20 13:14 -0500, I wrote:
>At 2009-11-20 13:10 -0500, Christopher Loschen wrote:
>>I'm working with a schema that defines a type by restricting the 
>>simple dateTime type. Our mapping rules (based on the JAX-RPC spec) 
>>map this to the class of the parent type (in this case, 
>>java.util.Calendar) rather than creating a new class to represent the 
>>derived type. Consequently, when we generate an XML message we specify 
>>that this element is of xsi:type="xs:dateTime" (that is, the parent type).
>>
>>However, when we do that, the schema validator flags the XML as 
>>invalid: it cites an invalid QName at the xsi:type="xs:dateTime" attribute.
>
>Have you declared xmlns:ns="http://www.w3.org/2001/XMLSchema" in your 
>XML document?
>
>The error message indicates that you have not, as a QName is only valid 
>if the prefix used has a namespace binding in scope.
>
>I hope this helps.
>
>. . . . . . . Ken



____________________________________________________________________