|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
Есть Веб служба, где то в интернете мне не подвластная. Пытаюсь отправить ей данные, в ответ на мою попытку получаю следующее Код: plaintext 1. 2. 3. 4. 5. 6.
и на него ругается визуал студия вот такой ошибкой Код: plaintext 1. 2.
Как решить мне эту проблему? Подскажите пожалуйста. ... |
|||
:
Нравится:
Не нравится:
|
|||
30.06.2011, 23:14 |
|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
2king2, код в студию ... |
|||
:
Нравится:
Не нравится:
|
|||
01.07.2011, 10:30 |
|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
pation2king2, код в студию Вот то что с генерировала студия при подключении к службе код №1 //------------------------------------------------------------------------------ // <auto-generated> // Этот код создан программой. // Исполняемая версия:4.0.30319.235 // // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае // повторной генерации кода. // </auto-generated> //------------------------------------------------------------------------------ namespace Service_NoJava_ConsoleApplication.ServiceProbe { [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.ServiceContractAttribute(Namespace=" http://probewebservices.traffic.com/services/v1_0/Probe", ConfigurationName="ServiceProbe.ProbePortType")] public interface ProbePortType { // CODEGEN: Контракт генерации сообщений с операцией sendProbeData не является ни RPC, ни упакованным документом. [System.ServiceModel.OperationContractAttribute(IsOneWay=false, Action=" http://probewebservices.traffic.com/sendProbeData%22)%5D]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%22)%5D]http://probewebservices.traffic.com/schemas/v1_0/WebService")] [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] void sendProbeData(Service_NoJava_ConsoleApplication.ServiceProbe.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%22)%5D]http://probewebservices.traffic.com/schemas/v1_0/WebService")] [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)] Service_NoJava_ConsoleApplication.ServiceProbe.pingProbeResponse pingProbe(Service_NoJava_ConsoleApplication.ServiceProbe.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%22)%5D]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%22)%5D]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%22)%5D]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%22)%5D]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.String 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.String 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%22)%5D]http://probewebservices.traffic.com/schemas/v1_0/WebServiceClientContext")] public Service_NoJava_ConsoleApplication.ServiceProbe.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(Service_NoJava_ConsoleApplication.ServiceProbe.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%22)%5D]http://probewebservices.traffic.com/schemas/v1_0/WebServiceClientContext")] public Service_NoJava_ConsoleApplication.ServiceProbe.WebServiceClientContext WebServiceClientContextElement; [System.ServiceModel.MessageBodyMemberAttribute(Namespace=" http://probewebservices.traffic.com/schemas/v1_0/WebService", Order=0)] public string PlaceHolder; public pingProbeRequest() { } public pingProbeRequest(Service_NoJava_ConsoleApplication.ServiceProbe.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 : Service_NoJava_ConsoleApplication.ServiceProbe.ProbePortType, System.ServiceModel.IClientChannel { } [System.Diagnostics.DebuggerStepThroughAttribute()] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] public partial class ProbePortTypeClient : System.ServiceModel.ClientBase<Service_NoJava_ConsoleApplication.ServiceProbe.ProbePortType>, Service_NoJava_ConsoleApplication.ServiceProbe.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 Service_NoJava_ConsoleApplication.ServiceProbe.ProbePortType.sendProbeData(Service_NoJava_ConsoleApplication.ServiceProbe.sendProbeData request) { base.Channel.sendProbeData(request); } public void sendProbeData(Service_NoJava_ConsoleApplication.ServiceProbe.WebServiceClientContext WebServiceClientContextElement, ProbeData[] SendProbeDataRequest) { Service_NoJava_ConsoleApplication.ServiceProbe.sendProbeData inValue = new Service_NoJava_ConsoleApplication.ServiceProbe.sendProbeData(); inValue.WebServiceClientContextElement = WebServiceClientContextElement; inValue.SendProbeDataRequest = SendProbeDataRequest; ((Service_NoJava_ConsoleApplication.ServiceProbe.ProbePortType)(this)).sendProbeData(inValue); } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] Service_NoJava_ConsoleApplication.ServiceProbe.pingProbeResponse Service_NoJava_ConsoleApplication.ServiceProbe.ProbePortType.pingProbe(Service_NoJava_ConsoleApplication.ServiceProbe.pingProbeRequest request) { return base.Channel.pingProbe(request); } public string pingProbe(Service_NoJava_ConsoleApplication.ServiceProbe.WebServiceClientContext WebServiceClientContextElement, string PlaceHolder) { Service_NoJava_ConsoleApplication.ServiceProbe.pingProbeRequest inValue = new Service_NoJava_ConsoleApplication.ServiceProbe.pingProbeRequest(); inValue.WebServiceClientContextElement = WebServiceClientContextElement; inValue.PlaceHolder = PlaceHolder; Service_NoJava_ConsoleApplication.ServiceProbe.pingProbeResponse retVal = ((Service_NoJava_ConsoleApplication.ServiceProbe.ProbePortType)(this)).pingProbe(inValue); return retVal.Ping; } } } Мое творение код №2 static void Main(string[] args) { var table = new DataTable(); table.Columns.Add("1", typeof(string)); table.Columns.Add("2", typeof(string)); table.Columns.Add("3", typeof(string)); table.Columns.Add("4", typeof(string)); table.Columns.Add("5", typeof(string)); table.Columns.Add("6", typeof(string)); table.Columns.Add("7", typeof(string)); var r = table.NewRow(); r["1"] = "50748165"; r["2"] = "55,90425"; r["3"] = "37,76128"; r["4"] = "35"; r["5"] = "50"; r["6"] = "2011-06-30T11:42:06.000Z"; table.Rows.Add(r); var authentication = new ServiceAuthentication.AuthenticationPortTypeClient("Authentication"); var param = new ServiceAuthentication.AuthenticateWebServiceClient(); var points = new List<ServiceProbe.ProbeData>(); param.userName = ""; param.password = ""; param.domain = ""; string sourceId = ""; var probecontext = new ServiceProbe.WebServiceClientContext(); using (var probe = new ServiceProbe.ProbePortTypeClient("Probe")) { probecontext.ticket = authentication.authenticateWebServiceClient(param).ticket; try { int lineNumber = 0; foreach (DataRow line in table.Rows) { ServiceProbe.ProbeData probeData = buildPoint(sourceId, line); lineNumber++; points.Add(probeData); if (lineNumber == table.Rows.Count) { ServiceProbe.ProbeData[] data = new ServiceProbe.ProbeData[table.Rows.Count]; int index = 0; foreach (ServiceProbe.ProbeData iterator in points) data[index++] = iterator; probe.sendProbeData(probecontext, data); points.Clear(); lineNumber = 0; } } } catch (Exception e) { } } } ... |
|||
:
Нравится:
Не нравится:
|
|||
01.07.2011, 11:52 |
|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
Блин, все перепробовал что знал, и ничего ... ... |
|||
:
Нравится:
Не нравится:
|
|||
01.07.2011, 16:38 |
|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
pation, Вот еще *.wsdl сервиса Код wsdl Код: plaintext 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. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72.
... |
|||
:
Нравится:
Не нравится:
|
|||
01.07.2011, 16:59 |
|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
Как я понимаю при десериализации должно было вернутся вот такой ответ от службы согласно автосгенерированому коду по *.wsdl и .xsd Код: plaintext 1. 2. 3. 4. 5.
А венулось не пустое тело, а с элементом SendProbeDataRequestResponse Код: plaintext 1. 2. 3. 4. 5. 6.
Рассуждая логически, то наверно можно на стороне моего клиента что то где-то поправить, то есть мне надо познакомить клиента с SendProbeDataRequestResponse. Подскажите где? ... |
|||
:
Нравится:
Не нравится:
|
|||
02.07.2011, 11:31 |
|
Ошибка десериализации помоги разабраться
|
|||
---|---|---|---|
#18+
2king2Как я понимаю при десериализации должно было вернутся вот такой ответ от службы согласно автосгенерированому коду по *.wsdl и .xsd Код: plaintext 1. 2. 3. 4. 5.
А венулось не пустое тело, а с элементом SendProbeDataRequestResponse Код: plaintext 1. 2. 3. 4. 5. 6.
Рассуждая логически, то наверно можно на стороне моего клиента что то где-то поправить, то есть мне надо познакомить клиента с SendProbeDataRequestResponse. Подскажите где? именно, сделайте чтоб метод sendProbeData возвращал SendProbeDataRequestResponse SendProbeDataRequestResponse - просто пустой класс. но вообщето это проблема поставщиков сервиса, спросите у них почему они не придерживаются своей же спецификации ... |
|||
:
Нравится:
Не нравится:
|
|||
04.07.2011, 10:28 |
|
|
start [/forum/topic.php?fid=20&msg=37331534&tid=1401900]: |
0ms |
get settings: |
11ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
42ms |
get topic data: |
11ms |
get forum data: |
2ms |
get page messages: |
46ms |
get tp. blocked users: |
1ms |
others: | 16ms |
total: | 152ms |
0 / 0 |