ONVIF Authentication in .NET 4.0 with Visual Studios 2010

给你一囗甜甜゛ 提交于 2019-11-28 06:03:40
user704419

All right:

EndpointAddress serviceAddress = new EndpointAddress("<mycameraurl:<mycameraport>/onvif/device_service");

HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();

httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;

var messageElement = new TextMessageEncodingBindingElement();

messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None);

CustomBinding bind = new CustomBinding(messageElement, httpBinding);

// Add our custom behavior - this require the Microsoft WSE 3.0 SDK

PasswordDigestBehavior behavior = new PasswordDigestBehavior(CameraASCIIStringLogin, CameraASCIIStringPassword);

DeviceClient client = new DeviceClient(bind, serviceAddress);

client.Endpoint.Behaviors.Add(behavior);

// We can now ask for information

client.GetSystemDateAndTime();

client.GetNetworkInterfaces();

client.GetScopes();

client.GetRelayOutputs();

client.GetWsdlUrl();

The problem was that the camera required authentication before giving any information beyond the simplest ones, and the trickiest part was to finally catch a working xml onvif message to recreate it in my own software.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!