The string '' is not a valid AllXsd value.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I am consuming DHL Tracking service through an WCF rest client. I have generated proxy class through XSD provided by DHL.
But some time in while deserializing response I get error "The string is not a valid AllXsd value."
I am attaching 2 XML one that get processed and other that give error. I am not able to figure out why this is happning.
XML working fine:

<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 req<span style="color:blue :<span style="color:#a31515 TrackingResponse <span style="color:red xmlns:req<span style="color:blue =<span style="color:black "<span style="color:blue http://www.dhl.com<span style="color:black " <span style="color:red xmlns:xsi<span style="color:blue =<span style="color:black "<span style="color:blue http://www.w3.org/2001/XMLSchema-instance<span style="color:black " <span style="color:red xsi:schemaLocation<span style="color:blue =<span style="color:black "<span style="color:blue http://www.dhl.com TrackingResponse.xsd<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Response<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceHeader<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MessageTime<span style="color:blue >2011-07-19T10:22:41+00:00<span style="color:blue </<span style="color:#a31515 MessageTime<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MessageReference<span style="color:blue >94f36a67-d93d-417f-a589-43d9<span style="color:blue </<span style="color:#a31515 MessageReference<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 SiteID<span style="color:blue >DServiceVal<span style="color:blue </<span style="color:#a31515 SiteID<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ServiceHeader<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Response<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AWBInfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AWBNumber<span style="color:blue >9572148666<span style="color:blue </<span style="color:#a31515 AWBNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Status<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ActionStatus<span style="color:blue >success<span style="color:blue </<span style="color:#a31515 ActionStatus<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Status<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipmentInfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 OriginServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceAreaCode<span style="color:blue >LON<span style="color:blue </<span style="color:#a31515 ServiceAreaCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Lambeth -
United Kingdom<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 OriginServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 DestinationServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceAreaCode<span style="color:blue >SYD<span style="color:blue </<span style="color:#a31515 ServiceAreaCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Sydney - Australia<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 DestinationServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipperName<span style="color:blue >LEGEND FOOTWEAR<span style="color:blue </<span style="color:#a31515 ShipperName<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipperAccountNumber<span style="color:blue >185145554<span style="color:blue </<span style="color:#a31515 ShipperAccountNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ConsigneeName<span style="color:blue >UMAN GAMBHIR<span style="color:blue </<span style="color:#a31515 ConsigneeName<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipmentDate<span style="color:blue >2011-07-07T18:18:00<span style="color:blue </<span style="color:#a31515 ShipmentDate<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Pieces<span style="color:blue >1<span style="color:blue </<span style="color:#a31515 Pieces<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Weight<span style="color:blue >0.82<span style="color:blue </<span style="color:#a31515 Weight<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 WeightUnit<span style="color:blue >K<span style="color:blue </<span style="color:#a31515 WeightUnit<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipmentEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Date<span style="color:blue >2011-07-07<span style="color:blue </<span style="color:#a31515 Date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Time<span style="color:blue >17:48:00<span style="color:blue </<span style="color:#a31515 Time<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 EventCode<span style="color:blue >PU<span style="color:blue </<span style="color:#a31515 EventCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Shipment picked up<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ServiceEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Signatory <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 ServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceAreaCode<span style="color:blue >LON<span style="color:blue </<span style="color:#a31515 ServiceAreaCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Lambeth -
United Kingdom<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ServiceArea<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ShipmentEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipmentEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Date<span style="color:blue >2011-07-10<span style="color:blue </<span style="color:#a31515 Date<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Time<span style="color:blue >10:44:00<span style="color:blue </<span style="color:#a31515 Time<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 EventCode<span style="color:blue >FD<span style="color:blue </<span style="color:#a31515 EventCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >With delivery courier<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ServiceEvent<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Signatory <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 ServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceAreaCode<span style="color:blue >SYD<span style="color:blue </<span style="color:#a31515 ServiceAreaCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Sydney - Australia<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ServiceArea<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ShipmentEvent<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ShipmentInfo<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 AWBInfo<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 req<span style="color:blue :<span style="color:#a31515 TrackingResponse<span style="color:blue >
[/code]

<div style="color:black; background-color:white
<pre><br/>[/code]
<pre><br/>[/code]
<pre>XML giving error:
[/code]
<pre><br/>[/code]
<pre><br/>[/code]

<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 req<span style="color:blue :<span style="color:#a31515 TrackingResponse <span style="color:red xmlns:req<span style="color:blue =<span style="color:black "<span style="color:blue http://www.dhl.com<span style="color:black " <span style="color:red xmlns:xsi<span style="color:blue =<span style="color:black "<span style="color:blue http://www.w3.org/2001/XMLSchema-instance<span style="color:black " <span style="color:red xsi:schemaLocation<span style="color:blue =<span style="color:black "<span style="color:blue http://www.dhl.com TrackingResponse.xsd<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Response<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceHeader<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MessageTime<span style="color:blue >2011-07-19T10:19:53+00:00<span style="color:blue </<span style="color:#a31515 MessageTime<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MessageReference<span style="color:blue >60939550-a62e-4460-b96f-df9d<span style="color:blue </<span style="color:#a31515 MessageReference<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 SiteID<span style="color:blue >DServiceVal<span style="color:blue </<span style="color:#a31515 SiteID<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ServiceHeader<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Response<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AWBInfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AWBNumber<span style="color:blue >5589004234<span style="color:blue </<span style="color:#a31515 AWBNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Status<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ActionStatus<span style="color:blue >success<span style="color:blue </<span style="color:#a31515 ActionStatus<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Status<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipmentInfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 OriginServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceAreaCode<span style="color:blue >HKG<span style="color:blue </<span style="color:#a31515 ServiceAreaCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Hong Kong - Hong Kong<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 OriginServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 DestinationServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ServiceAreaCode<span style="color:blue >EXT<span style="color:blue </<span style="color:#a31515 ServiceAreaCode<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Description<span style="color:blue >Exeter -
United Kingdom<span style="color:blue </<span style="color:#a31515 Description<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 DestinationServiceArea<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipperName<span style="color:blue >YANGGUANG CO LTD<span style="color:blue </<span style="color:#a31515 ShipperName<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipperAccountNumber<span style="color:blue >631040567<span style="color:blue </<span style="color:#a31515 ShipperAccountNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ConsigneeName<span style="color:blue >DON PITWELL<span style="color:blue </<span style="color:#a31515 ConsigneeName<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ShipmentDate <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 Pieces<span style="color:blue >1<span style="color:blue </<span style="color:#a31515 Pieces<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 WeightUnit<span style="color:blue >K<span style="color:blue </<span style="color:#a31515 WeightUnit<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 ShipmentInfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Pieces<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PieceInfo<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PieceDetails<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 AWBNumber<span style="color:blue >5589004234<span style="color:blue </<span style="color:#a31515 AWBNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 LicensePlate<span style="color:blue >JD014549321120058221<span style="color:blue </<span style="color:#a31515 LicensePlate<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PieceNumber<span style="color:blue >1<span style="color:blue </<span style="color:#a31515 PieceNumber<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ActualDepth<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 ActualDepth<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ActualWidth<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 ActualWidth<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ActualHeight<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 ActualHeight<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 ActualWeight<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 ActualWeight<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Depth<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 Depth<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Width<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 Width<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Height<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 Height<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 Weight<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 Weight<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PackageType<span style="color:blue >WPX<span style="color:blue </<span style="color:#a31515 PackageType<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 DimWeight<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 DimWeight<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 WeightUnit<span style="color:blue >CM<span style="color:blue </<span style="color:#a31515 WeightUnit<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 PieceDetails<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 PieceInfo<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Pieces<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 AWBInfo<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 req<span style="color:blue :<span style="color:#a31515 TrackingResponse<span style="color:blue >
[/code]
<pre><span style="color:blue <br/>[/code]
<pre><span style="color:blue <br/>[/code]

<div style="color:black; background-color:white
<pre>Call stack:
[/code]
<pre><br/>[/code]
<pre><br/>[/code]
<pre><br/>[/code]

<pre>System.InvalidOperationException occurred
Message="There is an error in XML document (29, 13)."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at System.ServiceModel.Dispatcher.UnwrappedTypesXmlSerializerManager.XmlSerializerXmlObjectSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.ReadObject(Message message)
at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.CompositeClientFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IPSD.BnB.Interaction.DHL.IDHLTracking.GetTrackingInfo(KnownTrackingRequest req)
at IPSD.BnB.Interaction.DHL.DHLClient.GetTrackingInfo(KnownTrackingRequest req) in D:CCViewsa019pa_New_5.90BNBR_ServerShipmentTrackingAPIIPSD.BnB.CarrierComponent.DHLDHLProxy.cs:line 52
InnerException: System.FormatException
Message="The string is not a valid AllXsd value."
Source="System.Xml"
StackTrace:
at System.Xml.Schema.XsdDateTime..ctor(String text, XsdDateTimeFlags kinds)
at System.Xml.XmlConvert.ToDateTime(String s, XmlDateTimeSerializationMode dateTimeOption)
at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value)
at System.Xml.Serialization.XmlSerializationReader.ToDateTime(String value)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read19_ShipmentInfo(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read23_AWBInfo(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read25_TrackingResponse(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read29_TrackingResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.TrackingResponseSerializer.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
InnerException:
[/code]
<br/>
<br/>
<br/>
<br/>


<
Thanks, Sandeep<br/>
<br/>

View the full article
 
Back
Top