Ошибка десериализации тела ответного сообщения для операции getprofiles

I’m writing console WCF-client for one WCF-WebService. When calling the service I get an error in deserializing body of request:

Error in deserializing body of reply message for operation ‘GetProfiles’

Agent Code:

string  userLogin = "root", userPassword = "root";
string ipaddress = "192.168.137.164";

HttpTransportBindingElement httpTransportBindingElement = new    HttpTransportBindingElement();
httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Digest;
httpTransportBindingElement.KeepAliveEnabled = false;
httpTransportBindingElement.MaxBufferSize = int.MaxValue;
httpTransportBindingElement.MaxBufferPoolSize = int.MaxValue;
httpTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;

TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement();
textMessageEncodingBindingElement.MaxReadPoolSize = int.MaxValue;
textMessageEncodingBindingElement.MaxWritePoolSize = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxDepth = 64;
textMessageEncodingBindingElement.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;


CustomBinding binding = new CustomBinding(textMessageEncodingBindingElement, httpTransportBindingElement);

EndpointAddress MediaEndPointAddress = new EndpointAddress("http://" + ipaddress + ":80/onvif/services");

MediaClient mediaClient = new MediaClient(binding, MediaEndPointAddress);
mediaClient.ClientCredentials.UserName.UserName = userLogin;
mediaClient.ClientCredentials.UserName.Password = userPassword;

Profile[] profiles = mediaClient.GetProfiles(); // throw excpetion

I have already watched the requests and responses with a sniffer and it’s OK! The WebService has sent ‘200 OK’. If I have a small response from the WebService, there won’t be any errors and exceptions! I haven’t got WebService code. What should I do?

Stack trace:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131075</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2012-01-11T11:11:12.2185609Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{550193ea-8569-40e6-b794-1a0eed69a1ba}" />
<Execution ProcessName="TestingConsole.vshost" ProcessID="6128" ThreadID="9" />
<Channel />
<Computer>WS-LSH</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"    Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/ru-RU/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>TestingConsole.vshost.exe</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Error in deserializing body of reply message for operation 'GetProfiles'.    </Message>
<StackTrace>
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc&amp; rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
at TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.GetProfiles()
at TestingConsole.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
</StackTrace>
<ExceptionString>System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'GetProfiles'. ---&gt; System.InvalidOperationException: There is an error in XML document (2, 6287). ---&gt; System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
    at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
   at System.Xml.XmlDictionaryReader.ReadString()
   at System.Xml.XmlBaseReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
   --- End of inner exception stack trace ---</ExceptionString>
<InnerException>
<ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There is an error in XML document (2, 6287).</Message>
<StackTrace>
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at     System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
</StackTrace>
<ExceptionString>System.InvalidOperationException: There is an error in XML document (2, 6287). ---&gt; System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
   at System.Xml.XmlDictionaryReader.ReadString()
   at System.Xml.XmlBaseReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)</ExceptionString>
<InnerException>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The byte 0x03 is not valid at this location.  Line 2, position 6287.</Message>
<StackTrace>
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String     res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
</StackTrace>
<ExceptionString>System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
   at System.Xml.XmlDictionaryReader.ReadString()
   at System.Xml.XmlBaseReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)</ExceptionString>
</InnerException>
</InnerException>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>

I rewrite my code. Now I have got:

    string soapRequest = "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">" +
                                 "<s:Header>" +
                                 "</s:Header>" +
                                 "<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">" +
                                 "<GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/>" +
                                 "</s:Body>" +
                                 "</s:Envelope>";


XmlReader envelopeReader = XmlReader.Create(new StringReader(soapRequest));

Message requestMsg = Message.CreateMessage(envelopeReader, int.MaxValue, MessageVersion.Soap12);

Message responseMsg = null;

IChannelFactory<IRequestChannel> channelFactory = binding.BuildChannelFactory<IRequestChannel>();
channelFactory.Open();

IRequestChannel channel = channelFactory.CreateChannel(MediaEndPointAddress);
channel.Open();

responseMsg = channel.Request(requestMsg);
Console.WriteLine(responseMsg.ToString());

The last string return message «Error reading body: System.Xml.XmlException: ‘�’ contains invalid UTF8 bytes. …}».

WebService sends non-ut8 bytes, but points «UTF-8» in header.
What can I do?

Reply Message Body

HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 11591
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
            <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"                         xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"                        xmlns:wsa5="http://www.w3.org/2005/08/addressing"                       xmlns:xmime5="http://www.w3.org/2005/05/xmlmime"                        xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"                        xmlns:ter="http://www.onvif.org/ver10/error"                        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                      xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"                      xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"                       xmlns:tns1="http://www.onvif.org/ver10/topics"                      xmlns:ns1="http://www.onvif.org/ver20/analytics/wsdl"                       xmlns:ns2="http://www.onvif.org/ver10/schema"                       xmlns:ns3="http://docs.oasis-open.org/wsn/b-2"                      xmlns:ns4="http://docs.oasis-open.org/wsrf/bf-2"                        xmlns:ns5="http://docs.oasis-open.org/wsn/t-1"                      xmlns:ns6="http://www.onvif.org/ver10/device/wsdl"                      xmlns:ns7="http://www.onvif.org/ver10/events/wsdl"                      xmlns:ns9="http://docs.oasis-open.org/wsrf/r-2"                         xmlns:ns10="http://www.onvif.org/ver10/imaging/wsdl"                        xmlns:ns11="http://www.onvif.org/ver10/media/wsdl"                      xmlns:ns12="http://www.onvif.org/ver20/ptz/wsdl"                        xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/"                       xmlns:ns14="http://schemas.xmlsoap.org/ws/2005/04/discovery"                        xmlns:ns16="http://www.onvif.org/ver10/analytics/wsdl/RuleEngineBinding"                        xmlns:ns17="http://www.onvif.org/ver10/analytics/wsdl/AnalyticsEngineBinding"                       xmlns:ns18="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"                        xmlns:ns19="http://www.onvif.org/ver10/events/wsdl/EventBinding"                        xmlns:ns20="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"                      xmlns:ns21="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"                         xmlns:ns22="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding"                         xmlns:ns23="http://www.onvif.org/ver10/events/wsdl/PullPointBinding"                        xmlns:ns24="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding"                      xmlns:ns25="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding"                      xmlns:ns26="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding"                         xmlns:ns27="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding"                         xmlns:ns28="http://www.onvif.org/ver10/events/wsdl/EventPortType"                       xmlns:ns29="http://www.3svision.com.tw/2009/event/topics">                      <SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns11:GetProfilesResponse><ns11:Profiles token="Main_h264" fixed="true"><ns2:Name>Main h264</ns2:Name><ns2:VideoSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Main_h264"><ns2:Name>Main h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>60</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G7Ю11</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Sub_h264" fixed="true"><ns2:Name>Sub h264</ns2:Name><ns2:VideoSourceConfiguration token="1"><ns2:Name>user1</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Sub_h264"><ns2:Name>Sub h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>640</ns2:Width><ns2:Height>352</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Motion_jpeg" fixed="true"><ns2:Name>Motion jpeg</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>user2</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>Motion jpeg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:QualitЭy>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="mc_test" fixed="false"><ns2:Name>mc_test</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
@јч
@peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="MACROSCOP" fixed="false"><ns2:Name>MACROSCOP</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" heightЮ="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
@јч
@peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles></ns11:GetProfilesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Пишу консольный WCF-клиент для одного WCF-WebService. При вызове сервиса я получаю сообщение об ошибке десериализации тела запроса:

Ошибка десериализации тела ответного сообщения для операции GetProfiles.

Код агента:

string  userLogin = "root", userPassword = "root";
string ipaddress = "192.168.137.164";

HttpTransportBindingElement httpTransportBindingElement = new    HttpTransportBindingElement();
httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Digest;
httpTransportBindingElement.KeepAliveEnabled = false;
httpTransportBindingElement.MaxBufferSize = int.MaxValue;
httpTransportBindingElement.MaxBufferPoolSize = int.MaxValue;
httpTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;

TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement();
textMessageEncodingBindingElement.MaxReadPoolSize = int.MaxValue;
textMessageEncodingBindingElement.MaxWritePoolSize = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxDepth = 64;
textMessageEncodingBindingElement.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;


CustomBinding binding = new CustomBinding(textMessageEncodingBindingElement, httpTransportBindingElement);

EndpointAddress MediaEndPointAddress = new EndpointAddress("http://" + ipaddress + ":80/onvif/services");

MediaClient mediaClient = new MediaClient(binding, MediaEndPointAddress);
mediaClient.ClientCredentials.UserName.UserName = userLogin;
mediaClient.ClientCredentials.UserName.Password = userPassword;

Profile[] profiles = mediaClient.GetProfiles(); // throw excpetion

Просмотрел уже запросы и ответы сниффером и все нормально! WebService отправил «200 OK». Если я получу небольшой ответ от WebService, ошибок и исключений не будет! У меня нет кода WebService. Что я должен делать?

Трассировки стека:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131075</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2012-01-11T11:11:12.2185609Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{550193ea-8569-40e6-b794-1a0eed69a1ba}" />
<Execution ProcessName="TestingConsole.vshost" ProcessID="6128" ThreadID="9" />
<Channel />
<Computer>WS-LSH</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"    Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/ru-RU/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>TestingConsole.vshost.exe</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Error in deserializing body of reply message for operation 'GetProfiles'.    </Message>
<StackTrace>
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc&amp; rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
at TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.GetProfiles()
at TestingConsole.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
</StackTrace>
<ExceptionString>System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'GetProfiles'. ---&gt; System.InvalidOperationException: There is an error in XML document (2, 6287). ---&gt; System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
    at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
   at System.Xml.XmlDictionaryReader.ReadString()
   at System.Xml.XmlBaseReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
   --- End of inner exception stack trace ---</ExceptionString>
<InnerException>
<ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There is an error in XML document (2, 6287).</Message>
<StackTrace>
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at     System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
</StackTrace>
<ExceptionString>System.InvalidOperationException: There is an error in XML document (2, 6287). ---&gt; System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
   at System.Xml.XmlDictionaryReader.ReadString()
   at System.Xml.XmlBaseReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)</ExceptionString>
<InnerException>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The byte 0x03 is not valid at this location.  Line 2, position 6287.</Message>
<StackTrace>
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String     res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
</StackTrace>
<ExceptionString>System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
   at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
   at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
   at System.Xml.XmlUTF8TextReader.Read()
   at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
   at System.Xml.XmlDictionaryReader.ReadString()
   at System.Xml.XmlBaseReader.ReadElementString()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
   at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)</ExceptionString>
</InnerException>
</InnerException>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>

Я переписываю свой код. Теперь у меня есть:

    string soapRequest = "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">" +
                                 "<s:Header>" +
                                 "</s:Header>" +
                                 "<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">" +
                                 "<GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/>" +
                                 "</s:Body>" +
                                 "</s:Envelope>";


XmlReader envelopeReader = XmlReader.Create(new StringReader(soapRequest));

Message requestMsg = Message.CreateMessage(envelopeReader, int.MaxValue, MessageVersion.Soap12);

Message responseMsg = null;

IChannelFactory<IRequestChannel> channelFactory = binding.BuildChannelFactory<IRequestChannel>();
channelFactory.Open();

IRequestChannel channel = channelFactory.CreateChannel(MediaEndPointAddress);
channel.Open();

responseMsg = channel.Request(requestMsg);
Console.WriteLine(responseMsg.ToString());

Последняя строка возвращает сообщение «Ошибка чтения тела: System.Xml.XmlException: ‘�’ содержит недопустимые байты UTF8. …}».

WebService отправляет байты, отличные от UT8, но указывает в заголовке «UTF-8». Что я могу сделать?

Текст сообщения ответа

HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 11591
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
            <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"                         xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"                        xmlns:wsa5="http://www.w3.org/2005/08/addressing"                       xmlns:xmime5="http://www.w3.org/2005/05/xmlmime"                        xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"                        xmlns:ter="http://www.onvif.org/ver10/error"                        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                      xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"                      xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"                       xmlns:tns1="http://www.onvif.org/ver10/topics"                      xmlns:ns1="http://www.onvif.org/ver20/analytics/wsdl"                       xmlns:ns2="http://www.onvif.org/ver10/schema"                       xmlns:ns3="http://docs.oasis-open.org/wsn/b-2"                      xmlns:ns4="http://docs.oasis-open.org/wsrf/bf-2"                        xmlns:ns5="http://docs.oasis-open.org/wsn/t-1"                      xmlns:ns6="http://www.onvif.org/ver10/device/wsdl"                      xmlns:ns7="http://www.onvif.org/ver10/events/wsdl"                      xmlns:ns9="http://docs.oasis-open.org/wsrf/r-2"                         xmlns:ns10="http://www.onvif.org/ver10/imaging/wsdl"                        xmlns:ns11="http://www.onvif.org/ver10/media/wsdl"                      xmlns:ns12="http://www.onvif.org/ver20/ptz/wsdl"                        xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/"                       xmlns:ns14="http://schemas.xmlsoap.org/ws/2005/04/discovery"                        xmlns:ns16="http://www.onvif.org/ver10/analytics/wsdl/RuleEngineBinding"                        xmlns:ns17="http://www.onvif.org/ver10/analytics/wsdl/AnalyticsEngineBinding"                       xmlns:ns18="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"                        xmlns:ns19="http://www.onvif.org/ver10/events/wsdl/EventBinding"                        xmlns:ns20="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"                      xmlns:ns21="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"                         xmlns:ns22="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding"                         xmlns:ns23="http://www.onvif.org/ver10/events/wsdl/PullPointBinding"                        xmlns:ns24="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding"                      xmlns:ns25="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding"                      xmlns:ns26="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding"                         xmlns:ns27="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding"                         xmlns:ns28="http://www.onvif.org/ver10/events/wsdl/EventPortType"                       xmlns:ns29="http://www.3svision.com.tw/2009/event/topics">                      <SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns11:GetProfilesResponse><ns11:Profiles token="Main_h264" fixed="true"><ns2:Name>Main h264</ns2:Name><ns2:VideoSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Main_h264"><ns2:Name>Main h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>60</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G7Ю11</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Sub_h264" fixed="true"><ns2:Name>Sub h264</ns2:Name><ns2:VideoSourceConfiguration token="1"><ns2:Name>user1</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Sub_h264"><ns2:Name>Sub h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>640</ns2:Width><ns2:Height>352</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Motion_jpeg" fixed="true"><ns2:Name>Motion jpeg</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>user2</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>Motion jpeg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:QualitЭy>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="mc_test" fixed="false"><ns2:Name>mc_test</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
@јч
@peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="MACROSCOP" fixed="false"><ns2:Name>MACROSCOP</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" heightЮ="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
@јч
@peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles></ns11:GetProfilesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Я пишу консольный WCF-клиент для одного WCF-WebService. При вызове службы я получаю ошибку при десериализации тела запроса:

Ошибка десериализации тела ответного сообщения для операции «GetProfiles»

Код агента:

string  userLogin = "root", userPassword = "root";
string ipaddress = "192.168.137.164";

HttpTransportBindingElement httpTransportBindingElement = new    HttpTransportBindingElement();
httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Digest;
httpTransportBindingElement.KeepAliveEnabled = false;
httpTransportBindingElement.MaxBufferSize = int.MaxValue;
httpTransportBindingElement.MaxBufferPoolSize = int.MaxValue;
httpTransportBindingElement.MaxReceivedMessageSize = int.MaxValue;

TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement();
textMessageEncodingBindingElement.MaxReadPoolSize = int.MaxValue;
textMessageEncodingBindingElement.MaxWritePoolSize = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxDepth = 64;
textMessageEncodingBindingElement.ReaderQuotas.MaxBytesPerRead = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxArrayLength = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxNameTableCharCount = int.MaxValue;
textMessageEncodingBindingElement.ReaderQuotas.MaxStringContentLength = int.MaxValue;


CustomBinding binding = new CustomBinding(textMessageEncodingBindingElement, httpTransportBindingElement);

EndpointAddress MediaEndPointAddress = new EndpointAddress("http://" + ipaddress + ":80/onvif/services");

MediaClient mediaClient = new MediaClient(binding, MediaEndPointAddress);
mediaClient.ClientCredentials.UserName.UserName = userLogin;
mediaClient.ClientCredentials.UserName.Password = userPassword;

Profile[] profiles = mediaClient.GetProfiles(); // throw excpetion

Я уже смотрел запросы и ответы со сниффером, и это нормально! WebService отправил «200 OK». Если у меня есть небольшой ответ от WebService, ошибок и исключений не будет! У меня нет кода WebService. Что мне делать?

Трассировка стека:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131075</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2012-01-11T11:11:12.2185609Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{550193ea-8569-40e6-b794-1a0eed69a1ba}" />
<Execution ProcessName="TestingConsole.vshost" ProcessID="6128" ThreadID="9" />
<Channel />
<Computer>WS-LSH</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord"    Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/ru-RU/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>TestingConsole.vshost.exe</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Error in deserializing body of reply message for operation 'GetProfiles'.    </Message>
<StackTrace>
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc&amp; rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
at TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.TestingConsole.Onvif.Media.Media.GetProfiles(GetProfilesRequest request)
at TestingConsole.Onvif.Media.MediaClient.GetProfiles()
at TestingConsole.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
</StackTrace>
<ExceptionString>System.ServiceModel.CommunicationException: Error in deserializing body of reply message for operation 'GetProfiles'. ---&gt; System.InvalidOperationException: There is an error in XML document (2, 6287). ---&gt; System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
--- End of inner exception stack trace ---</ExceptionString>
<InnerException>
<ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There is an error in XML document (2, 6287).</Message>
<StackTrace>
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at     System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
</StackTrace>
<ExceptionString>System.InvalidOperationException: There is an error in XML document (2, 6287). ---&gt; System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)</ExceptionString>
<InnerException>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The byte 0x03 is not valid at this location.  Line 2, position 6287.</Message>
<StackTrace>
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String     res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
</StackTrace>
<ExceptionString>System.Xml.XmlException: The byte 0x03 is not valid at this location.  Line 2, position 6287.
at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, String res, String arg1, String arg2, String arg3)
at System.Xml.XmlExceptionHelper.ThrowInvalidXml(XmlDictionaryReader reader, Byte b)
at System.Xml.XmlUTF8TextReader.Read()
at System.Xml.XmlDictionaryReader.ReadString(Int32 maxStringContentLength)
at System.Xml.XmlDictionaryReader.ReadString()
at System.Xml.XmlBaseReader.ReadElementString()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read59_VideoSourceConfiguration(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read150_Profile(Boolean isNullable, Boolean checkType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMedia.Read224_GetProfilesResponse()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer73.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)</ExceptionString>
</InnerException>
</InnerException>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>

Я переписываю свой код. Теперь у меня есть:

    string soapRequest = "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">" +
"<s:Header>" +
"</s:Header>" +
"<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">" +
"<GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/>" +
"</s:Body>" +
"</s:Envelope>";
XmlReader envelopeReader = XmlReader.Create(new StringReader(soapRequest));
Message requestMsg = Message.CreateMessage(envelopeReader, int.MaxValue, MessageVersion.Soap12);
Message responseMsg = null;
IChannelFactory<IRequestChannel> channelFactory = binding.BuildChannelFactory<IRequestChannel>();
channelFactory.Open();
IRequestChannel channel = channelFactory.CreateChannel(MediaEndPointAddress);
channel.Open();
responseMsg = channel.Request(requestMsg);
Console.WriteLine(responseMsg.ToString());

Последнее сообщение возврата строки «Ошибка чтения тела: System.Xml.XmlException:» «содержит недопустимые байты UTF8….}».

WebService отправляет байты без ut8, но указывает «UTF-8» в заголовке.
Что я могу сделать?

Тело сообщения ответа

HTTP/1.1 200 OK
Server: gSOAP/2.7
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 11591
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"                         xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"                        xmlns:wsa5="http://www.w3.org/2005/08/addressing"                       xmlns:xmime5="http://www.w3.org/2005/05/xmlmime"                        xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"                        xmlns:ter="http://www.onvif.org/ver10/error"                        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"                      xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"                      xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"                        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"                       xmlns:tns1="http://www.onvif.org/ver10/topics"                      xmlns:ns1="http://www.onvif.org/ver20/analytics/wsdl"                       xmlns:ns2="http://www.onvif.org/ver10/schema"                       xmlns:ns3="http://docs.oasis-open.org/wsn/b-2"                      xmlns:ns4="http://docs.oasis-open.org/wsrf/bf-2"                        xmlns:ns5="http://docs.oasis-open.org/wsn/t-1"                      xmlns:ns6="http://www.onvif.org/ver10/device/wsdl"                      xmlns:ns7="http://www.onvif.org/ver10/events/wsdl"                      xmlns:ns9="http://docs.oasis-open.org/wsrf/r-2"                         xmlns:ns10="http://www.onvif.org/ver10/imaging/wsdl"                        xmlns:ns11="http://www.onvif.org/ver10/media/wsdl"                      xmlns:ns12="http://www.onvif.org/ver20/ptz/wsdl"                        xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/"                       xmlns:ns14="http://schemas.xmlsoap.org/ws/2005/04/discovery"                        xmlns:ns16="http://www.onvif.org/ver10/analytics/wsdl/RuleEngineBinding"                        xmlns:ns17="http://www.onvif.org/ver10/analytics/wsdl/AnalyticsEngineBinding"                       xmlns:ns18="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"                        xmlns:ns19="http://www.onvif.org/ver10/events/wsdl/EventBinding"                        xmlns:ns20="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"                      xmlns:ns21="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"                         xmlns:ns22="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding"                         xmlns:ns23="http://www.onvif.org/ver10/events/wsdl/PullPointBinding"                        xmlns:ns24="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding"                      xmlns:ns25="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding"                      xmlns:ns26="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding"                         xmlns:ns27="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding"                         xmlns:ns28="http://www.onvif.org/ver10/events/wsdl/EventPortType"                       xmlns:ns29="http://www.3svision.com.tw/2009/event/topics">                      <SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns11:GetProfilesResponse><ns11:Profiles token="Main_h264" fixed="true"><ns2:Name>Main h264</ns2:Name><ns2:VideoSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Main_h264"><ns2:Name>Main h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>60</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G7Ю11</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Sub_h264" fixed="true"><ns2:Name>Sub h264</ns2:Name><ns2:VideoSourceConfiguration token="1"><ns2:Name>user1</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Sub_h264"><ns2:Name>Sub h264</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>H264</ns2:Encoding><ns2:Resolution><ns2:Width>640</ns2:Width><ns2:Height>352</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>30</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:H264><ns2:GovLength>0</ns2:GovLength><ns2:H264Profile>Baseline</ns2:H264Profile></ns2:H264><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="Motion_jpeg" fixed="true"><ns2:Name>Motion jpeg</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>user2</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>Motion jpeg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:QualitЭy>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="mc_test" fixed="false"><ns2:Name>mc_test</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" height="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
@јч
@peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles><ns11:Profiles token="MACROSCOP" fixed="false"><ns2:Name>MACROSCOP</ns2:Name><ns2:VideoSourceConfiguration token="2"><ns2:Name>Hе</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken><Bounds xmlns="http://www.onvif.org/ver10/schema" heightЮ="720" width="1280" y="0" x="0"></Bounds></ns2:VideoSourceConfiguration><ns2:AudioSourceConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:SourceToken>0</ns2:SourceToken></ns2:AudioSourceConfiguration><ns2:VideoEncoderConfiguration token="Motion_jpeg"><ns2:Name>јч
@јч
@peg</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>JPEG</ns2:Encoding><ns2:Resolution><ns2:Width>1280</ns2:Width><ns2:Height>720</ns2:Height></ns2:Resolution><ns2:Quality>70</ns2:Quality><ns2:RateControl><ns2:FrameRateLimit>15</ns2:FrameRateLimit><ns2:EncodingInterval>15</ns2:EncodingInterval><ns2:BitrateLimit>3072</ns2:BitrateLimit></ns2:RateControl><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:VideoEncoderConfiguration><ns2:AudioEncoderConfiguration token="0"><ns2:Name>user0</ns2:Name><ns2:UseCount>0</ns2:UseCount><ns2:Encoding>G711</ns2:Encoding><ns2:Bitrate>64000</ns2:Bitrate><ns2:SampleRate>8000</ns2:SampleRate><ns2:Multicast><ns2:Address><ns2:Type>IPv4</ns2:Type><ns2:IPv4Address>0.0.0.0</ns2:IPv4Address></ns2:Address><ns2:Port>0</ns2:Port><ns2:TTL>5</ns2:TTL><ns2:AutoStart>false</ns2:AutoStart></ns2:Multicast><ns2:SessionTimeout>PT0S</ns2:SessionTimeout></ns2:AudioEncoderConfiguration></ns11:Profiles></ns11:GetProfilesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
  1. На главную

  2. How

  3. Ошибка десериализации тела сообщения запроса на операцию

Ошибка десериализации тела сообщения запроса на операцию

  • 2023
  • Редактор:
    Christopher Sullivan |
    Написать мне

Я пишу адаптер службы для использования веб-служб, размещенных другим поставщиком (Pega). Я не могу сменить эту услугу. Когда я вызываю метод, я получаю сообщение об ошибке:

«Ошибка десериализации тела сообщения запроса на операцию»

Я пробовал увеличить maxStringContentLength и все такое. Ничего не получилось. Изучая ответ XML, я вижу пустые значения для нескольких переменных типа long и int, я считаю, что это причина.

Есть ли какое-нибудь исправление для этого?

  • 1 Выполняется десериализация. Извините за автокоррекцию.
  • Эта ссылка может быть вам полезна marcipsen.wordpress.com/2009/02/25/…
  • Спасибо, Картик, но я уже пытался изменить настройки в app.config. Как я уже упоминал, я считаю, что причиной могут быть пустые значения для нескольких переменных типа long и int в ответном XML. Требуется исправление для этого со стороны клиента.
  • Есть ли внутреннее исключение с более подробной информацией?
  • Единственное, что имеет смысл: в System.Number.ParseInt64 (значение String, параметры NumberStyles, NumberFormatInfo numfmt) в System.Xml.XmlConvert.ToInt64 (String s)

Это было решено после удаления пустых тегов со стороны службы. На стороне клиента .Net решение не найдено.

  • У меня конец службы настроен на отправку 0 вместо нулевого элемента.
  • Спасибо. Я исправил свою проблему двумя вещами: 1) изменил тип возвращаемого значения операции с простого строкового типа на пользовательский тип класса, украшенный DataContractAttribute. 2) Я удалил HttpWatch 7.0.22, который мешает вызову jQuery. Именно HttpWatch заблокировал отправку аргумента операции.
  • @PAVITRA — У меня та же проблема, и я не мог понять, как решить, следуя вашим инструкциям: как вы на самом деле это сделали? Какие пустые теги? Из какого файла?
  • В ответ у меня были пустые значения для нескольких полей типа long и int, не допускающих значения NULL. Обычно этого не должно происходить. При попытке десериализации этого ответа возникла ошибка. Не удалось найти исправления от .NET для этого. Поэтому моим последним вариантом было изменить стороннюю службу. Я изменил его, чтобы отправлять 0 вместо пустых тегов для длинных полей int.

Я решил эту проблему, изменив формат одного из параметров запроса. Дата была передана в виде текста, и службе не удалось проанализировать предоставленный формат даты.

Не уверен, почему служба ожидала дату в виде строки, но в то время это выходило за рамки.

Аватара пользователя

kROOT

Специалист
Сообщения: 13137
Зарегистрирован: 02 сен 2013, 14:25
Откуда: youcam.pro
Контактная информация:

Re: Нет изображения (сигнала) с IP камеры

а камера случайно не Н265? линк давай на лот, где купил.



vadyusha

Новичок
Сообщения: 40
Зарегистрирован: 09 янв 2017, 13:28

Re: Нет изображения (сигнала) с IP камеры

Сообщение

vadyusha » 17 фев 2017, 12:44

Что это за штука? Ни звонит, ни сопротивления не измеряется.
Изображение



Sergiodemaster

Специалист
Сообщения: 3407
Зарегистрирован: 16 окт 2012, 09:24
Откуда: Рязань

Re: Нет изображения (сигнала) с IP камеры

Сообщение

Sergiodemaster » 17 фев 2017, 14:08

Поясните, пожалуйста, что вы там хотите найти, тыкая в плату мультиметром?
У вас либо прошивка слетела, либо процессор помер.
Если у вас есть острое желание воскресить модуль, и есть практика использования заклинаний вуду — изучайте ветку viewforum.php?f=24″ onclick=»window.open(this.href);return false;
Сходные ситуации там уже обсуждались.


vadyusha

Новичок
Сообщения: 40
Зарегистрирован: 09 янв 2017, 13:28

Re: Нет изображения (сигнала) с IP камеры

Сообщение

vadyusha » 17 фев 2017, 14:39

дохлый элемент, разрыв контакта.
Схожего не находил


Аватара пользователя

kROOT

Специалист
Сообщения: 13137
Зарегистрирован: 02 сен 2013, 14:25
Откуда: youcam.pro
Контактная информация:

Re: Нет изображения (сигнала) с IP камеры

Сообщение

kROOT » 17 фев 2017, 16:25

так камера работала раньше или нет?
если нет, то надо открывать диспут и возвращать камеру продавцу и больше такие камеры не покупать. малоизвестный производитель, плохая явно не уличная матрица с низкой чувствительностью и самое главное, чуть дешевле, чем проверенный ХМ на соневской матрице.


vadyusha

Новичок
Сообщения: 40
Зарегистрирован: 09 янв 2017, 13:28

Re: Нет изображения (сигнала) с IP камеры

Сообщение

vadyusha » 17 фев 2017, 16:28

Ни знаю почему, но заработала. То ли из-за остатка флюса, то ли из-за того, что полез в раздел Web страница и поставил QuickTime Player и еще что-то там щелка.



vadyusha

Новичок
Сообщения: 40
Зарегистрирован: 09 янв 2017, 13:28

Re: Нет изображения (сигнала) с IP камеры

Сообщение

vadyusha » 17 фев 2017, 16:44

Но вот это так и не исправилось. ONVIF Device Manager во вкладке Events в столбце Topic непрерывно пишется строка tns1:RuleEngine Там же в Events в Filters написано: Ошибка десериализации тела ответного сообщения для операции «GetEventProperties».
Изображение



Вернуться в «Общие вопросы по видеонаблюдению»


Перейти

  • Правила форума
  • Если не зайти на форум
  • Видеонаблюдение
  • ↳   Общие вопросы по видеонаблюдению
  • ↳   IP видеонаблюдение
  • ↳   Аналоговые системы видеонаблюдения
  • ↳   HD видеонаблюдение по коаксиальному кабелю (HD-SDI, AHD, HD-CVI и т.п.)
  • ↳   FAQ. Основы видеонаблюдения.
  • Оборудование из Китая (ebay, aliexpress, taobao, 409shop и т.п.)
  • ↳   Помогите выбрать
  • ↳   Оборудование из Китая — общие вопросы
  • ↳   Восстановление и настройка
  • ↳   Обзоры оборудования
  • ↳   Отправка, доставка, гарантия, возврат
  • Охранные и пожарные сигнализации, контроль доступа и прочие системы безопасности
  • ↳   Охранные и пожарные сигнализации, пожаротушение и т.п.
  • ↳   Контроль доступа, домофоны, учет рабочего времени.
  • ↳   Турникеты, шлагбаумы, автоматические ворота.
  • ↳   Монтаж
  • ↳   Инструкции и нормативные документы.
  • Все остальное
  • ↳   Работа
  • ↳   Предложения и запросы
  • ↳   Курилка
  • Remove From My Forums
  • Question

  • I m consuming a third party WCF service. The get menthod is taking request class object and its return type is a response class object.I m getting the above error when calling the get method.I have increased the
    maxStringContentLength and maxdepth
    to 2147483647 then also i m getting same error.Here is the Stack Trace:

    Thanks in advance…

    Server stack trace:
       at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[]
    parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.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 ContractName.getmethod(request request)
      

    If anybody here has any ideas that might help
    I would greatly appreciate it.  This is fairly new to me.

Answers

    • Marked as answer by

      Friday, February 3, 2012 9:15 AM

  • Is this 3rd party WCF service workable somewhere else? I mean is this getReport working in some other application or not? I feel like the response object must be having some problem like

    — Some member which cannot be serialized properly.

    You should check with the WCF service provider (vendor)


    ViBi

    • Marked as answer by
      Yi-Lun Luo
      Friday, February 3, 2012 9:15 AM
  • Remove From My Forums
  • Question

  • I m consuming a third party WCF service. The get menthod is taking request class object and its return type is a response class object.I m getting the above error when calling the get method.I have increased the
    maxStringContentLength and maxdepth
    to 2147483647 then also i m getting same error.Here is the Stack Trace:

    Thanks in advance…

    Server stack trace:
       at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[]
    parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
       at System.ServiceModel.Dispatcher.OperationFormatter.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 ContractName.getmethod(request request)
      

    If anybody here has any ideas that might help
    I would greatly appreciate it.  This is fairly new to me.

Answers

    • Marked as answer by

      Friday, February 3, 2012 9:15 AM

  • Is this 3rd party WCF service workable somewhere else? I mean is this getReport working in some other application or not? I feel like the response object must be having some problem like

    — Some member which cannot be serialized properly.

    You should check with the WCF service provider (vendor)


    ViBi

    • Marked as answer by
      Yi-Lun Luo
      Friday, February 3, 2012 9:15 AM
  • Remove From My Forums

none

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

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

  • Здравствуйте форумчани,

    Пишу клиента для одной веб службу (*.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> 
    //------------------------------------------------------------------------------ // <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; } } } 
    • Изменен тип

      11 июля 2011 г. 9:57

КОНТЕКСТ:

Я делаю приложение формы Windows C#, которое обменивается данными с камерами ONVIF, используя wsdls, указанные на сайте onvif.

Https://www.onvif.org/ver10/media/wsdl/media.wsdl

А также

Https://onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl

Я могу получать профили на камере, отправлять действия PTZ и многое другое, но когда я пытаюсь получить статус созданного мной ptzClient, я получаю сообщение об ошибке:

Error in deserializing body of reply message for operation 'GetStatus'

Я просмотрел внутреннее исключение этой ошибки, чтобы найти:

The string '1532531507' is not a valid AllXsd value.

Вот как я создаю свой ptzClient:

ServicePointManager.Expect100Continue = false;
var commonEncoding = new TextMessageEncodingBindingElement
{
MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
};
var commonBinding = new HttpTransportBindingElement
{
AuthenticationScheme = AuthenticationSchemes.Digest
};
var commonCustomBinding = new CustomBinding(commonEncoding, commonBinding);
var commonPasswordDigestBehavior = new PasswordDigestBehavior(userName, password);
var ptzEndpointAddress = new EndpointAddress($"http://{cameraAddress}/onvif/ptz");
ptzClient = new PTZClient(commonCustomBinding, ptzEndpointAddress);
ptzClient.Endpoint.EndpointBehaviors.Add(commonPasswordDigestBehavior);

Ошибка возникает при вызове этой строки кода:

var p = ptzClient.GetStatus(profile.token);

Когда я просматриваю свой xml-запрос и соответствующий ему xml-ответ в wirehark, я вижу, что ошибки нет:

ВОПРОС :

Как я могу сделать этот звонок, не получая этих ошибок?

Я мало что могу изменить …

Кажется, проблема в формате даты, но я не вижу способа изменить этот формат.

CONTEXT :

I’m making a c# windows form app that communicates to ONVIF cameras using the wsdls given on the onvif site.

https://www.onvif.org/ver10/media/wsdl/media.wsdl

and

https://onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl

I am able to get profiles on the camera, send PTZ action and more, but when I try to get the status of the ptzClient I created, I get the error:

Error in deserializing body of reply message for operation 'GetStatus'

I looked in the innerException of this error to find:

The string '1532531507' is not a valid AllXsd value.

Here’s how I create my ptzClient:

ServicePointManager.Expect100Continue = false;
var commonEncoding = new TextMessageEncodingBindingElement
{
MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
};
var commonBinding = new HttpTransportBindingElement
{
AuthenticationScheme = AuthenticationSchemes.Digest
};
var commonCustomBinding = new CustomBinding(commonEncoding, commonBinding);
var commonPasswordDigestBehavior = new PasswordDigestBehavior(userName, password);
var ptzEndpointAddress = new EndpointAddress($"http://{cameraAddress}/onvif/ptz");
ptzClient = new PTZClient(commonCustomBinding, ptzEndpointAddress);
ptzClient.Endpoint.EndpointBehaviors.Add(commonPasswordDigestBehavior);

The error happens when calling this line of code:

var p = ptzClient.GetStatus(profile.token);

When I go see my xml request and its corresponding xml response in wireshark, I see that there is no error :
enter image description here

QUESTION :

How can I manage to make this call without getting these errors?

There isn’t much I can change…

It seems that the problem is from the date format, but I don’t see a way to change this format.

CONTEXT :

I’m making a c# windows form app that communicates to ONVIF cameras using the wsdls given on the onvif site.

https://www.onvif.org/ver10/media/wsdl/media.wsdl

and

https://onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl

I am able to get profiles on the camera, send PTZ action and more, but when I try to get the status of the ptzClient I created, I get the error:

Error in deserializing body of reply message for operation 'GetStatus'

I looked in the innerException of this error to find:

The string '1532531507' is not a valid AllXsd value.

Here’s how I create my ptzClient:

ServicePointManager.Expect100Continue = false;
var commonEncoding = new TextMessageEncodingBindingElement
{
MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
};
var commonBinding = new HttpTransportBindingElement
{
AuthenticationScheme = AuthenticationSchemes.Digest
};
var commonCustomBinding = new CustomBinding(commonEncoding, commonBinding);
var commonPasswordDigestBehavior = new PasswordDigestBehavior(userName, password);
var ptzEndpointAddress = new EndpointAddress($"http://{cameraAddress}/onvif/ptz");
ptzClient = new PTZClient(commonCustomBinding, ptzEndpointAddress);
ptzClient.Endpoint.EndpointBehaviors.Add(commonPasswordDigestBehavior);

The error happens when calling this line of code:

var p = ptzClient.GetStatus(profile.token);

When I go see my xml request and its corresponding xml response in wireshark, I see that there is no error :
enter image description here

QUESTION :

How can I manage to make this call without getting these errors?

There isn’t much I can change…

It seems that the problem is from the date format, but I don’t see a way to change this format.

  • David Irwin

    David Irwin



    2019-09-15

    Hi, First time posting so hope I have included the right information.

    I have downloaded the ONVIF device manager to get the stream addresses for my new security camera but am having an error when trying to run the software. I have attached a screenshot plus a WireShark capture of the response from the camera.

    Any assistance on why this may be happening would be appreciated.

    David

    Thumbnail

    2019-09-15 08_28_05-ONVIF Device Manager v2.2.250.png

    GetProfile.xml

    alternate


Log in to post a comment.

  1. На главную

  2. How

  3. Ошибка десериализации тела сообщения запроса на операцию

Ошибка десериализации тела сообщения запроса на операцию

  • 2023
  • Редактор:
    Christopher Sullivan |
    Написать мне

Я пишу адаптер службы для использования веб-служб, размещенных другим поставщиком (Pega). Я не могу сменить эту услугу. Когда я вызываю метод, я получаю сообщение об ошибке:

«Ошибка десериализации тела сообщения запроса на операцию»

Я пробовал увеличить maxStringContentLength и все такое. Ничего не получилось. Изучая ответ XML, я вижу пустые значения для нескольких переменных типа long и int, я считаю, что это причина.

Есть ли какое-нибудь исправление для этого?

  • 1 Выполняется десериализация. Извините за автокоррекцию.
  • Эта ссылка может быть вам полезна marcipsen.wordpress.com/2009/02/25/…
  • Спасибо, Картик, но я уже пытался изменить настройки в app.config. Как я уже упоминал, я считаю, что причиной могут быть пустые значения для нескольких переменных типа long и int в ответном XML. Требуется исправление для этого со стороны клиента.
  • Есть ли внутреннее исключение с более подробной информацией?
  • Единственное, что имеет смысл: в System.Number.ParseInt64 (значение String, параметры NumberStyles, NumberFormatInfo numfmt) в System.Xml.XmlConvert.ToInt64 (String s)

Это было решено после удаления пустых тегов со стороны службы. На стороне клиента .Net решение не найдено.

  • У меня конец службы настроен на отправку 0 вместо нулевого элемента.
  • Спасибо. Я исправил свою проблему двумя вещами: 1) изменил тип возвращаемого значения операции с простого строкового типа на пользовательский тип класса, украшенный DataContractAttribute. 2) Я удалил HttpWatch 7.0.22, который мешает вызову jQuery. Именно HttpWatch заблокировал отправку аргумента операции.
  • @PAVITRA — У меня та же проблема, и я не мог понять, как решить, следуя вашим инструкциям: как вы на самом деле это сделали? Какие пустые теги? Из какого файла?
  • В ответ у меня были пустые значения для нескольких полей типа long и int, не допускающих значения NULL. Обычно этого не должно происходить. При попытке десериализации этого ответа возникла ошибка. Не удалось найти исправления от .NET для этого. Поэтому моим последним вариантом было изменить стороннюю службу. Я изменил его, чтобы отправлять 0 вместо пустых тегов для длинных полей int.

Я решил эту проблему, изменив формат одного из параметров запроса. Дата была передана в виде текста, и службе не удалось проанализировать предоставленный формат даты.

Не уверен, почему служба ожидала дату в виде строки, но в то время это выходило за рамки.

  • Ошибка десериализации json python
  • Ошибка деретикс call of duty modern warfare
  • Ошибка делить на ноль excel
  • Ошибка делим на слоги
  • Ошибка деления на ноль sql server