mictlanix / onvif

A lightweight ONVIF Client library.
MIT License
46 stars 25 forks source link

Protocol Security Exception #4

Open Oneiros90 opened 3 years ago

Oneiros90 commented 3 years ago

Hi, thank you for this library. I'm actually having this exception when I try to run the test program:

System.ServiceModel.ProtocolException: The header 'Security' from the namespace 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' was not understood by the recipient of this message, causing the message to not be processed. This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process. Please ensure that the configuration of the client's binding is consistent with the service's binding.

I'm using .Net Core 3.0, Visual Studio 2019 and a simple Foscam IP Camera. Any idea why I get that exception?

ezavaleta commented 3 years ago

First, you should check if your camera supports ONVIF, If so It seems your camera doesn't support SOAP security header. You can download the repo and comment out at OnvifClientFactory.cs where SoapSecurityHeaderBehavior is added.

I highly recommend you to check https://sourceforge.net/projects/onvifdm/, this project is also .NET and much more complete.

Regards, Eddy Zavaleta

Oneiros90 commented 3 years ago

Ok I actually solved this problem: I basically created a new class called OnvifClient that provides the same methods of OnvifClientFactory but reuses the same data (username, password, uri, binding and capabilities) when a client is created. And now it works. I did this because I noticed that the exception is raised on this line, which is weird.