The ONVIF standard allows us to do many useful things with IP cameras such as remote streaming, PTZ control, subscribing to events, face and object detection, scheduling, remote recording, multi streaming, etc.
In this ongoing series about integrating ONVIF camera control with C# we will explore some of these topics in detail. Today I would like to start with how to create a basic client and add it as a connected reference to your project.
ONVIF is a standard based on SOAP technology, which is not really well known any more, as JSON based REST has become the standard in web based communication protocols. Fortunately, Visual Studio allows you to bypass all SOAP related details and it will generate a client for any well formed SOAP message contained in a URI. The main URI we will use in this post is:
http://www.onvif.org/ver10/device/wsdl
This document will provide all the operations your ONVIF compliant camera can expose. Of course, not all cameras implement all of the functionalities in the ONVIF standard, so the cameras usually expose their capabilities through a service discovery endpoint which we will cover in the next post.
To create the client simply add a Service Reference of WCF Service Type to your project and in the URI section paste the above URI. Visual Studio then generates your client in a file called Reference.cs, and the dependencies related to this class in a file called ConnectedService.json.
On some occasions Reference.cs can cause some build errors. This is usually related to the access modifiers of the generated class. Don't hesitate to change this file to fix these errors. If you have specific questions about this you can contact me on my email displayed near my profile.
After generating the reference file your device client is ready to be used. In the next post we will see how to use this client to connect to your camera and discover it's capabilities.