I'm currently developing an application that access to a web service, a PHP based web service. But I have an issue, one of the method returns a custom type and the system is unable to deserialize the informations. Here is the exception thrown :
Error in deserializing body of reply message for operation 'listeDemandeAcces'.
System.InvalidOperationException: There is an error in XML document (1, 577). --> System.InvalidOperationException: The specified type was not recognized: name
='demande', namespace='http://mysite/acces_net', at <demandes xmlns=''>
Here is the code of my Reference.cs generated via the WSDL of the service :
namespace TDF.OSSExtranet.BusinessProxies.ServiceReference1 {
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://mysite/acces_net", ConfigurationName="ServiceReference1.AccesNetWsdlPortType")]
public interface AccesNetWsdlPortType {
[System.ServiceModel.OperationContractAttribute(Action="http://mysite/applications/accesnet/ws/ws_clients.php/list" +
"eDemandeAcces", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(Style=System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults=true, Use=System.ServiceModel.OperationFormatUse.Encoded)]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(IntervenantV2))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(Demande))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(Intervenant))]
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(Projet))]
[return: System.ServiceModel.MessageParameterAttribute(Name="resultat_req_da")]
TDF.OSSExtranet.BusinessProxies.ServiceReference1.ResultatReqDa listeDemandeAcces(string login, string password, TDF.OSSExtranet.BusinessProxies.ServiceReference1.RequestDAFilter filter);
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34230")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="http://mysite/acces_net")]
public partial class Demande : object, System.ComponentModel.INotifyPropertyChanged {
private string num_demandeField;
private System.DateTime date_demandeField;
private System.DateTime date_maj_demandeField;
private string statut_dem_accesField;
private string code_siteField;
private string code_igField;
private ZoneInterventionV2 zone_interventionField;
private System.DateTime date_deb_interventionField;
private System.DateTime date_fin_interventionField;
private bool accompagnement_demandeField;
private bool accompagnement_requisField;
private string nature_interventionField;
private string code_projet_TDFField;
private bool impact_TDFField;
private bool travaux_dangereuxField;
private Demandeur demandeurField;
private IntervenantV2[] intervenantsField;
private string num_diField;
private string num_btField;
/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(DataType="integer")]
public string num_demande {
get {
return this.num_demandeField;
}
set {
this.num_demandeField = value;
this.RaisePropertyChanged("num_demande");
}
}
/// <remarks/>
public System.DateTime date_demande {
get {
return this.date_demandeField;
}
set {
this.date_demandeField = value;
this.RaisePropertyChanged("date_demande");
}
}
/// <remarks/>
public System.DateTime date_maj_demande {
get {
return this.date_maj_demandeField;
}
set {
this.date_maj_demandeField = value;
this.RaisePropertyChanged("date_maj_demande");
}
}
/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(DataType="integer")]
public string statut_dem_acces {
get {
return this.statut_dem_accesField;
}
set {
this.statut_dem_accesField = value;
this.RaisePropertyChanged("statut_dem_acces");
}
}
/// <remarks/>
public string code_site {
get {
return this.code_siteField;
}
set {
this.code_siteField = value;
this.RaisePropertyChanged("code_site");
}
}
/// <remarks/>
public string code_ig {
get {
return this.code_igField;
}
set {
this.code_igField = value;
this.RaisePropertyChanged("code_ig");
}
}
/// <remarks/>
public ZoneInterventionV2 zone_intervention {
get {
return this.zone_interventionField;
}
set {
this.zone_interventionField = value;
this.RaisePropertyChanged("zone_intervention");
}
}
/// <remarks/>
public System.DateTime date_deb_intervention {
get {
return this.date_deb_interventionField;
}
set {
this.date_deb_interventionField = value;
this.RaisePropertyChanged("date_deb_intervention");
}
}
/// <remarks/>
public System.DateTime date_fin_intervention {
get {
return this.date_fin_interventionField;
}
set {
this.date_fin_interventionField = value;
this.RaisePropertyChanged("date_fin_intervention");
}
}
/// <remarks/>
public bool accompagnement_demande {
get {
return this.accompagnement_demandeField;
}
set {
this.accompagnement_demandeField = value;
this.RaisePropertyChanged("accompagnement_demande");
}
}
/// <remarks/>
public bool accompagnement_requis {
get {
return this.accompagnement_requisField;
}
set {
this.accompagnement_requisField = value;
this.RaisePropertyChanged("accompagnement_requis");
}
}
/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(DataType="integer")]
public string nature_intervention {
get {
return this.nature_interventionField;
}
set {
this.nature_interventionField = value;
this.RaisePropertyChanged("nature_intervention");
}
}
/// <remarks/>
public string code_projet_TDF {
get {
return this.code_projet_TDFField;
}
set {
this.code_projet_TDFField = value;
this.RaisePropertyChanged("code_projet_TDF");
}
}
/// <remarks/>
public bool impact_TDF {
get {
return this.impact_TDFField;
}
set {
this.impact_TDFField = value;
this.RaisePropertyChanged("impact_TDF");
}
}
/// <remarks/>
public bool travaux_dangereux {
get {
return this.travaux_dangereuxField;
}
set {
this.travaux_dangereuxField = value;
this.RaisePropertyChanged("travaux_dangereux");
}
}
/// <remarks/>
public Demandeur demandeur {
get {
return this.demandeurField;
}
set {
this.demandeurField = value;
this.RaisePropertyChanged("demandeur");
}
}
/// <remarks/>
public IntervenantV2[] intervenants {
get {
return this.intervenantsField;
}
set {
this.intervenantsField = value;
this.RaisePropertyChanged("intervenants");
}
}
/// <remarks/>
public string num_di {
get {
return this.num_diField;
}
set {
this.num_diField = value;
this.RaisePropertyChanged("num_di");
}
}
/// <remarks/>
public string num_bt {
get {
return this.num_btField;
}
set {
this.num_btField = value;
this.RaisePropertyChanged("num_bt");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34230")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace="http://mysite/acces_net")]
public partial class ResultatReqDa : object, System.ComponentModel.INotifyPropertyChanged {
private string nb_demandesField;
private Demande[] demandesField;
/// <remarks/>
[System.Xml.Serialization.SoapElementAttribute(DataType="integer")]
public string nb_demandes {
get {
return this.nb_demandesField;
}
set {
this.nb_demandesField = value;
this.RaisePropertyChanged("nb_demandes");
}
}
/// <remarks/>
public Demande[] demandes {
get {
return this.demandesField;
}
set {
this.demandesField = value;
this.RaisePropertyChanged("demandes");
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface AccesNetWsdlPortTypeChannel : TDF.OSSExtranet.BusinessProxies.ServiceReference1.AccesNetWsdlPortType, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class AccesNetWsdlPortTypeClient : System.ServiceModel.ClientBase<TDF.OSSExtranet.BusinessProxies.ServiceReference1.AccesNetWsdlPortType>, TDF.OSSExtranet.BusinessProxies.ServiceReference1.AccesNetWsdlPortType {
public AccesNetWsdlPortTypeClient() {
}
public AccesNetWsdlPortTypeClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public AccesNetWsdlPortTypeClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public AccesNetWsdlPortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public AccesNetWsdlPortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public TDF.OSSExtranet.BusinessProxies.ServiceReference1.ResultatReqDa listeDemandeAcces(string login, string password, TDF.OSSExtranet.BusinessProxies.ServiceReference1.RequestDAFilter filter) {
return base.Channel.listeDemandeAcces(login, password, filter);
}
}
}
And here is the response from the service :
HTTP/1.1 200 OK
Date: Thu, 29 Oct 2015 11:01:17 GMT
Server: Apache
X-SOAP-Server: NuSOAP/0.7.2 (1.94)
Content-Length: 17798
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://ift.tt/wEYywg" xmlns:SOAP-ENV="http://ift.tt/sVJIaE" xmlns:xsd="http://ift.tt/tphNwY" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:SOAP-ENC="http://ift.tt/wEYywg" xmlns:tns="http://ift.tt/1MkRD6P">
<SOAP-ENV:Body><ns1:listeDemandeAccesResponse xmlns:ns1="http://mysite/acces_net"><resultat_req_da xsi:type="tns:ResultatReqDa">
<nb_demandes xsi:type="xsd:integer">10</nb_demandes>
<demandes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:demande[10]">
<demande xsi:type="tns:Demande">
<num_demande xsi:type="xsd:integer">579</num_demande>
<date_demande xsi:type="xsd:dateTime">2012-02-15T16:13:27.181509+01:00</date_demande>
<statut_dem_acces xsi:type="xsd:integer">1</statut_dem_acces>
<code_site xsi:type="xsd:string">T59067</code_site>
<code_ig xsi:type="xsd:string">3530703</code_ig>
<zone_intervention xsi:type="tns:ZoneIntervention">
<local xsi:type="xsd:boolean">false</local>
</zone_intervention>
<date_deb_intervention xsi:type="xsd:dateTime">2012-02-29T09:00:00+01:00</date_deb_intervention>
<date_fin_intervention xsi:type="xsd:dateTime">2012-02-29T11:00:00+01:00</date_fin_intervention>
<accompagnement_demande xsi:type="xsd:boolean">true</accompagnement_demande>
<accompagnement_requis xsi:type="xsd:boolean">true</accompagnement_requis>
<nature_intervention xsi:type="xsd:integer">0</nature_intervention>
<code_projet_TDF xsi:type="xsd:string"></code_projet_TDF>
<travaux_dangereux xsi:type="xsd:boolean">false</travaux_dangereux>
<demandeur xsi:type="tns:Demandeur">
<nom xsi:type="xsd:string">Legoff</nom>
<prenom xsi:type="xsd:string">Yvon</prenom>
<telephone xsi:type="xsd:string">0612345678</telephone>
<email xsi:type="xsd:string"></email>
</demandeur>
<intervenants xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:IntervenantV2[1]">
<intervenant xsi:type="tns:IntervenantV2">
<inter_soc xsi:type="xsd:string">TDF</inter_soc>
<inter_nom xsi:type="xsd:string">Legoff</inter_nom>
<inter_prenom xsi:type="xsd:string">Yvon</inter_prenom>
<inter_tel1 xsi:type="xsd:string">0612345678</inter_tel1>
<inter_email xsi:type="xsd:string"></inter_email>
</intervenant>
</intervenants>
<num_di xsi:type="xsd:string">992625</num_di>
</demande>
</demandes>
</resultat_req_da>
</ns1:listeDemandeAccesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
If someone could help me figure out why the system can't deserialize the data, it would be nice :) .
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire