反序列化操作的回复消息体时出错

时间:2012-01-11 11:53:28

标签: c# wcf serialization

我正在为一个WCF-WebService编写控制台WCF客户端。在调用服务时,我在反序列化请求主体时遇到错误:

  

反序列化操作'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());

最后一个字符串返回消息“Error read body: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>

2 个答案:

答案 0 :(得分:1)

首先,如果是您的Profile类,请检查您的Profile对象的合约 - 可能它没有配置良好的DataContract属性。如果您拥有由服务所有者提供的Profile类的dll,则可能是版本错误。你可以尝试启用WCF trace并将捕获的XML与Profile对象的合约进行比较(使用dotPeek或任何其他反编译来从dll获取类代码)

答案 1 :(得分:0)

如果您的嗅探器中来自网络服务的响应为200 OK,并且您的客户端因上述异常而失败,则值得尝试更新您的代理。可能存在wsdl已更改且收到的响应对象未在客户端采用预期格式的情况