[SOAP] Service web chronopost erreur de déserialisation
Bonjour,
je rencontre une erreur de déserialisation avec le service web de chronopost.
Vous pouvez reproduire facilement avec les infos suivantes.
J'ai ajouter le service web via vs2010 "Add web reference.."
WSDL : http://ws.chronopost.fr/axis/service...ocurement?wsdl
Code d'appel :
Code:
1 2 3 4 5 6
| ResultTrackSkybill Result;
TrackSkybillParams Params = new TrackSkybillParams() {language = "fr_FR",skybillNumbers = new string[] {"XY629090281JB"}};
using (ServiceEprocurementClient Serv = new ServiceEprocurementClient())
{
Result = Serv.trackSkybill(Params);
} |
Exception : Il existe une erreur dans le document XML (44, 4).
Inner Exception : Impossible d'assigner un objet de type fr.chronopost.ws.Event à un objet de type EDI_TEST.fr.chronopost.ws.Event[]. L'erreur s'est produite lors de la lecture du noeud doté de la valeur id='id2'.
Comment je peux contourner ?
Merci
PS : xml de la requete et de la réponse :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none" />
</s:Header>
<s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<q1:trackSkybill xmlns:q1="urn:server.eprocurement.soap.chronopost.fr">
<trackSkybillParams href="#id1" />
</q1:trackSkybill>
<q2:TrackSkybillParams id="id1" xsi:type="q2:TrackSkybillParams" xmlns:q2="http://tracking.interfaces.eprocurement.soap.chronopost.fr">
<language xsi:type="xsd:string">fr_FR</language>
<skybillNumbers href="#id2" />
</q2:TrackSkybillParams>
<q3:Array id="id2" q3:arrayType="xsd:string[1]" xmlns:q3="http://schemas.xmlsoap.org/soap/encoding/">
<Item>XY629090281JB</Item>
</q3:Array>
</s:Body>
</s:Envelope> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" />
<soapenv:Body>
<ns1:trackSkybillResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:server.eprocurement.soap.chronopost.fr">
<trackSkybillReturn href="#id0" />
</ns1:trackSkybillResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:ResultTrackSkybill" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://interfaces.eprocurement.soap.chronopost.fr">
<errorCode xsi:type="xsd:int">0</errorCode>
<errorMessage xsi:type="xsd:string" xsi:nil="true" />
<listEvents xsi:type="soapenc:Array" soapenc:arrayType="ns3:ListEvents[1]" xmlns:ns3="http://tracking.interfaces.eprocurement.soap.chronopost.fr">
<item href="#id1" />
</listEvents>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:ListEvents" xmlns:ns4="http://tracking.interfaces.eprocurement.soap.chronopost.fr" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<events href="#id2" />
<events href="#id3" />
<events href="#id4" />
<skybillNumber xsi:type="xsd:string">XY629090281JB</skybillNumber>
</multiRef>
<multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:Event" xmlns:ns5="http://tracking.interfaces.eprocurement.soap.chronopost.fr" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<NPC xsi:type="xsd:string"> 42</NPC>
<eventDate xsi:type="xsd:dateTime">2013-02-12T17:04:00.000Z</eventDate>
<eventLabel xsi:type="xsd:string">Envoi pris en charge chez l'expéditeur</eventLabel>
<highPriority xsi:type="soapenc:boolean">false</highPriority>
<officeLabel xsi:type="xsd:string">ST ETIENNE CHRONOPOST</officeLabel>
<zipCode xsi:type="xsd:string">42000</zipCode>
</multiRef>
<multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns6:Event" xmlns:ns6="http://tracking.interfaces.eprocurement.soap.chronopost.fr" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<NPC xsi:type="xsd:string"> 42</NPC>
<eventDate xsi:type="xsd:dateTime">2013-02-12T10:08:00.000Z</eventDate>
<eventLabel xsi:type="xsd:string">Envoi prêt chez l'expéditeur</eventLabel>
<highPriority xsi:type="soapenc:boolean">false</highPriority>
<officeLabel xsi:type="xsd:string">ST ETIENNE CHRONOPOST</officeLabel>
<zipCode xsi:type="xsd:string">42000</zipCode>
</multiRef>
<multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns7:Event" xmlns:ns7="http://tracking.interfaces.eprocurement.soap.chronopost.fr" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<NPC xsi:type="xsd:string"> 42</NPC>
<eventDate xsi:type="xsd:dateTime">2013-02-12T17:34:00.000Z</eventDate>
<eventLabel xsi:type="xsd:string">Tri effectué dans l'agence de départ</eventLabel>
<highPriority xsi:type="soapenc:boolean">true</highPriority>
<officeLabel xsi:type="xsd:string">ST ETIENNE CHRONOPOST</officeLabel>
<zipCode xsi:type="xsd:string">42000</zipCode>
</multiRef>
</soapenv:Body>
</soapenv:Envelope> |