我正在尝试使用c#和wcf构建ONVIF服务器。大多数都与我的服务(ONVIF设备管理器和ispy)连接得很好,但不是exacqVision。导致错误:
A first chance exception of type 'System.Xml.XmlException' occurred in
System.Runtime.Serialization.dll
Additional information: The prefix 'xmlns' can only be bound to the namespace
'http://www.w3.org/2000/xmlns/'.
我猜它是因为xmlns:xmlns =" http://tempuri.org/xmlns.xsd"在它的肥皂信封里。
有没有办法使用c#/ wcf在服务器端解决这个问题? ONVIF相机与exacqVision连接得很好,因此对他们来说不是问题。
看起来exacqVision正在使用gSOAP / 2.8。这是推荐的,但我更喜欢在C#中执行此操作。
我在没有运气的情况下搜索了ONVIF网站。我不想花钱成为ONVIF成员,因为这似乎是一个肥皂问题而不是ONVIF。
这是使用SvcUtil生成的绑定:
<binding name="DeviceBinding">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
And here's exacqVision's soap call:
POST /onvif/device_service HTTP/1.1
Host: ---
User-Agent: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime"
Content-Length: 2341
Connection: close
SOAPAction: "http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime"
<?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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsa5="http://www.w3.org/2005/08/addressing"
xmlns:xmlns="http://tempuri.org/xmlns.xsd"
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:xmime="http://tempuri.org/xmime.xsd"
xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2"
xmlns:tanae="http://www.onvif.org/ver10/analytics/wsdl/AnalyticsEngineBinding"
xmlns:tanre="http://www.onvif.org/ver10/analytics/wsdl/RuleEngineBinding"
xmlns:tan="http://www.onvif.org/ver10/analytics/wsdl"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
xmlns:tevcpp="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding"
xmlns:teve="http://www.onvif.org/ver10/events/wsdl/EventBinding"
xmlns:tevnc="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding"
xmlns:tevnp="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding"
xmlns:tevpp="http://www.onvif.org/ver10/events/wsdl/PullPointBinding"
xmlns:tevpps="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding"
xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
xmlns:tevpsm="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:tevsm="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding"
xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
xmlns:tptz="http://www.onvif.org/ver10/ptz/wsdl"
xmlns:tptz2="http://www.onvif.org/ver20/ptz/wsdl"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"><SOAP-ENV:Body><tds:GetSystemDateAndTime></tds:GetSystemDateAndTime></SOAP-ENV:Body></SOAP-ENV:Envelope>