0

I'm trying to build a ONVIF server using c# and wcf. Most are connecting just fine with my service ( ONVIF device manager and ispy ) but not exacqVision. Causing the error:

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/'.

I'm guessing it's because of the xmlns:xmlns="http://tempuri.org/xmlns.xsd" in it's soap envelope.

Is there a way to fix this on the server side using c#/wcf? ONVIF cameras connect just fine with exacqVision so it's not a problem for them.

looks like exacqVision is using gSOAP/2.8. Which is recommended but I would prefer to do this in C#.

I've searched the ONVIF site with no luck. I'd prefer not to spend the money on becoming a ONVIF member as this seems to be a soap problem not an ONVIF one.

Here's the binding generated with 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>
Ginkgo
  • 1
  • 2
  • 1
    Error message is pretty clear, but without code it is not possible to answer what you should do to fix it. – Alexei Levenkov Apr 22 '15 at 00:39
  • It doesn't make it to the code. Error happens through serialization which I'm doing with a custom binding. – Ginkgo Apr 22 '15 at 16:06
  • Is there a binding or behavior that can handle this situation? Is there a way to intercept the xml before serialization? I've tried extensions but they never get called. – Ginkgo Apr 22 '15 at 16:16
  • Clearly default WCF service does not return XML with "xmlns:xmlns" - if you can't provide code at least try to search it for "xmlns" (`*.cs`+`*.config`) and see if you spot something odd. – Alexei Levenkov Apr 22 '15 at 16:18
  • I think your sender needs to fix their SOAP message. Be sure to tell them that everyone else works ok. – John Saunders Apr 22 '15 at 16:38
  • Thanks. exacqVision is a big company I don't know if they'll listen to little old me. XD Is there a way to fix the Soap message myself? For example: removing that namespace before serialization. From the the looks of it everything else would work fine if that part wasn't there. – Ginkgo Apr 22 '15 at 17:33
  • I got it working. I had to create a CustomTextMessageEncoder and remove the bad namespace during the ReadMessage. – Ginkgo Apr 22 '15 at 23:18

0 Answers0