none
Ошибка десериализации помоги разабраться RRS feed

  • Общие обсуждения

  • Здравствуйте форумчани,
    Пишу клиента для одной веб службу (*.wsdl) находящейся в интернете. Опыта в этих делах маловато у меня. Вот столкнулся с ошибкой десериализации. С начала я авторизовываюсь на сервисе, получаю тикет. Затем формирую посылку и отправляю. На что служба мне выдает вот такой ответ:
    <?xml version="1.0" encoding="utf-8" ?>
    <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">
     <soapenv:Body>
      <SendProbeDataRequestResponse xmlns="http://probewebservices.traffic.com/schemas/v1_0/Probe" />
     </soapenv:Body>
    </soapenv:Envelope>
    
    На что дебагер ругается вот таким сообщением:
    Ошибка десериализации тела ответного сообщения для операции "sendProbeData". Ожидался элемент End "Body" из пространства
    имен "http://schemas.xmlsoap.org/soap/envelope/". Найден элемент "SendProbeDataRequestResponse" из пространства имен
    "http://probewebservices.traffic.com/schemas/v1_0/Probe". Строка 1, позиция 322.
    Как я понимаю при десериализации должно было вернутся вот такой ответ от службы согласно автосгенерированому коду по *.wsdl и .xsd
    <?xml version="1.0" encoding="utf-8" ?>
    <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">
     <soapenv:Body>
     </soapenv:Body>
    </soapenv:Envelope>
    
    Помогите понять в чем дело, или задайте вектор моих раскопок!!!

    Прикреплю на всякий случай код который атосгенерировала Visual Studio 2010 при подключении службы по ссылке http://tprobewebservices.traffic.com/services/v1_0/
    //------------------------------------------------------------------------------
    // <auto-generated>
    //   Этот код создан программой.
    //   Исполняемая версия:4.0.30319.235
    //
    //   Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
    //   повторной генерации кода.
    // </auto-generated>
    //------------------------------------------------------------------------------
    
    namespace Navteq_NoJava_ConsoleApplication.NavteqProbe {
      
      
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ServiceModel.ServiceContractAttribute(Namespace="http://probewebservices.traffic.com/services/v1_0/Probe", ConfigurationName="NavteqProbe.ProbePortType")]
      public interface ProbePortType {
        
        // CODEGEN: Контракт генерации сообщений с операцией sendProbeData не является ни RPC, ни упакованным документом.
        [System.ServiceModel.OperationContractAttribute(IsOneWay=false, Action="http://probewebservices.traffic.com/sendProbeData")]
        [System.ServiceModel.FaultContractAttribute(typeof(string), Action="http://probewebservices.traffic.com/sendProbeData", Name="WebServiceFault", Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebService")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
        void sendProbeData(Navteq_NoJava_ConsoleApplication.NavteqProbe.sendProbeData request);
        
        // CODEGEN: Контракт генерации сообщений с операцией pingProbe не является ни RPC, ни упакованным документом.
        [System.ServiceModel.OperationContractAttribute(Action="http://probewebservices.traffic.com/pingProbe", ReplyAction="*")]
        [System.ServiceModel.FaultContractAttribute(typeof(string), Action="http://probewebservices.traffic.com/pingProbe", Name="WebServiceFault", Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebService")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
        Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeResponse pingProbe(Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeRequest request);
      }
      
      /// <remarks/>
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.225")]
      [System.SerializableAttribute()]
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.ComponentModel.DesignerCategoryAttribute("code")]
      [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebServiceClientContext")]
      public partial class WebServiceClientContext : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string ticketField;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=0)]
        public string ticket {
          get {
            return this.ticketField;
          }
          set {
            this.ticketField = value;
            this.RaisePropertyChanged("ticket");
          }
        }
        
        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.225")]
      [System.SerializableAttribute()]
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.ComponentModel.DesignerCategoryAttribute("code")]
      [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/Probe")]
      public partial class GeoLocation : object, System.ComponentModel.INotifyPropertyChanged {
        
        private float latitudeField;
        
        private float longitudeField;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=0)]
        public float latitude {
          get {
            return this.latitudeField;
          }
          set {
            this.latitudeField = value;
            this.RaisePropertyChanged("latitude");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=1)]
        public float longitude {
          get {
            return this.longitudeField;
          }
          set {
            this.longitudeField = value;
            this.RaisePropertyChanged("longitude");
          }
        }
        
        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.225")]
      [System.SerializableAttribute()]
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.ComponentModel.DesignerCategoryAttribute("code")]
      [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/Probe")]
      public partial class GlobalPosition : object, System.ComponentModel.INotifyPropertyChanged {
        
        private GeoLocation geoLocField;
        
        private System.Nullable<int> headingField;
        
        private bool headingFieldSpecified;
        
        private System.Nullable<int> speedField;
        
        private bool speedFieldSpecified;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=0)]
        public GeoLocation geoLoc {
          get {
            return this.geoLocField;
          }
          set {
            this.geoLocField = value;
            this.RaisePropertyChanged("geoLoc");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
        public System.Nullable<int> heading {
          get {
            return this.headingField;
          }
          set {
            this.headingField = value;
            this.RaisePropertyChanged("heading");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool headingSpecified {
          get {
            return this.headingFieldSpecified;
          }
          set {
            this.headingFieldSpecified = value;
            this.RaisePropertyChanged("headingSpecified");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=2)]
        public System.Nullable<int> speed {
          get {
            return this.speedField;
          }
          set {
            this.speedField = value;
            this.RaisePropertyChanged("speed");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public bool speedSpecified {
          get {
            return this.speedFieldSpecified;
          }
          set {
            this.speedFieldSpecified = value;
            this.RaisePropertyChanged("speedSpecified");
          }
        }
        
        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.225")]
      [System.SerializableAttribute()]
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.ComponentModel.DesignerCategoryAttribute("code")]
      [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/Probe")]
      public partial class ProbeData : object, System.ComponentModel.INotifyPropertyChanged {
        
        private string deviceAddressField;
        
        private string deviceTypeField;
        
        private string deviceSubTypeField;
        
        private string sourceIdField;
        
        private GlobalPosition globalPositionField;
        
        private System.DateTime collectionTimeGMTField;
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=0)]
        public string deviceAddress {
          get {
            return this.deviceAddressField;
          }
          set {
            this.deviceAddressField = value;
            this.RaisePropertyChanged("deviceAddress");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
        public string deviceType {
          get {
            return this.deviceTypeField;
          }
          set {
            this.deviceTypeField = value;
            this.RaisePropertyChanged("deviceType");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=2)]
        public string deviceSubType {
          get {
            return this.deviceSubTypeField;
          }
          set {
            this.deviceSubTypeField = value;
            this.RaisePropertyChanged("deviceSubType");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=3)]
        public string sourceId {
          get {
            return this.sourceIdField;
          }
          set {
            this.sourceIdField = value;
            this.RaisePropertyChanged("sourceId");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=4)]
        public GlobalPosition globalPosition {
          get {
            return this.globalPositionField;
          }
          set {
            this.globalPositionField = value;
            this.RaisePropertyChanged("globalPosition");
          }
        }
        
        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(Order=5)]
        public System.DateTime collectionTimeGMT {
          get {
            return this.collectionTimeGMTField;
          }
          set {
            this.collectionTimeGMTField = value;
            this.RaisePropertyChanged("collectionTimeGMT");
          }
        }
        
        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.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
      [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
      public partial class sendProbeData {
        
        [System.ServiceModel.MessageHeaderAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebServiceClientContext")]
        public Navteq_NoJava_ConsoleApplication.NavteqProbe.WebServiceClientContext WebServiceClientContextElement;
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/Probe", Order=0)]
        [System.Xml.Serialization.XmlArrayItemAttribute("probeData", IsNullable=false)]
        public ProbeData[] SendProbeDataRequest;
        
        public sendProbeData() {
        }
        
        public sendProbeData(Navteq_NoJava_ConsoleApplication.NavteqProbe.WebServiceClientContext WebServiceClientContextElement, ProbeData[] SendProbeDataRequest) {
          this.WebServiceClientContextElement = WebServiceClientContextElement;
          this.SendProbeDataRequest = SendProbeDataRequest;
        }
      }
      
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
      [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
      public partial class pingProbeRequest {
        
        [System.ServiceModel.MessageHeaderAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebServiceClientContext")]
        public Navteq_NoJava_ConsoleApplication.NavteqProbe.WebServiceClientContext WebServiceClientContextElement;
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebService", Order=0)]
        public string PlaceHolder;
        
        public pingProbeRequest() {
        }
        
        public pingProbeRequest(Navteq_NoJava_ConsoleApplication.NavteqProbe.WebServiceClientContext WebServiceClientContextElement, string PlaceHolder) {
          this.WebServiceClientContextElement = WebServiceClientContextElement;
          this.PlaceHolder = PlaceHolder;
        }
      }
      
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
      [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
      public partial class pingProbeResponse {
        
        [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://probewebservices.traffic.com/schemas/v1_0/WebService", Order=0)]
        public string Ping;
        
        public pingProbeResponse() {
        }
        
        public pingProbeResponse(string Ping) {
          this.Ping = Ping;
        }
      }
      
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      public interface ProbePortTypeChannel : Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType, System.ServiceModel.IClientChannel {
      }
      
      [System.Diagnostics.DebuggerStepThroughAttribute()]
      [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
      public partial class ProbePortTypeClient : System.ServiceModel.ClientBase<Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType>, Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType {
        
        public ProbePortTypeClient() {
        }
        
        public ProbePortTypeClient(string endpointConfigurationName) : 
            base(endpointConfigurationName) {
        }
        
        public ProbePortTypeClient(string endpointConfigurationName, string remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
        }
        
        public ProbePortTypeClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
        }
        
        public ProbePortTypeClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(binding, remoteAddress) {
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        void Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType.sendProbeData(Navteq_NoJava_ConsoleApplication.NavteqProbe.sendProbeData request) {
          base.Channel.sendProbeData(request);
        }
        
        public void sendProbeData(Navteq_NoJava_ConsoleApplication.NavteqProbe.WebServiceClientContext WebServiceClientContextElement, ProbeData[] SendProbeDataRequest) {
          Navteq_NoJava_ConsoleApplication.NavteqProbe.sendProbeData inValue = new Navteq_NoJava_ConsoleApplication.NavteqProbe.sendProbeData();
          inValue.WebServiceClientContextElement = WebServiceClientContextElement;
          inValue.SendProbeDataRequest = SendProbeDataRequest;
          ((Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType)(this)).sendProbeData(inValue);
        }
        
        [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeResponse Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType.pingProbe(Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeRequest request) {
          return base.Channel.pingProbe(request);
        }
        
        public string pingProbe(Navteq_NoJava_ConsoleApplication.NavteqProbe.WebServiceClientContext WebServiceClientContextElement, string PlaceHolder) {
          Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeRequest inValue = new Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeRequest();
          inValue.WebServiceClientContextElement = WebServiceClientContextElement;
          inValue.PlaceHolder = PlaceHolder;
          Navteq_NoJava_ConsoleApplication.NavteqProbe.pingProbeResponse retVal = ((Navteq_NoJava_ConsoleApplication.NavteqProbe.ProbePortType)(this)).pingProbe(inValue);
          return retVal.Ping;
        }
      }
    }
    
    
    2 июля 2011 г. 11:50

Все ответы

  • Уважаемый пользователь!

    В вашей теме отсутствует активность в течение последних 5 дней. При отсутствии каких-либо действий в течение 2 последующих дней, тема будет переведена в разряд обсуждений. Вы можете возобновить дискуссию, просто оставив сообщение в данной теме


    Для связи [mail]
    Модератор