Reputation: 177
today i'm using a VDX camera and i'd like to control it using Onvif protocol. In my program I need to do a "GetProfiles" request.
With other cameras (Bosh, Lumens, Axis, ec...) my method works properly but with VDX I have a lot of problems. In particular if I using the follow snippet (using port 80), the server throws an exception (error 414 URI too large):
var httpTransport = new HttpTransportBindingElement
{
AuthenticationScheme = AuthenticationSchemes.Digest
};
var binding = new CustomBinding(new TextMessageEncodingBindingElement
(MessageVersion.None, Encoding.Default), httpTransport);
var builder = new UriBuilder("http", "10.0.34.32", 80, "/onvif/media_service");
var mediaAddress = builder.Uri;
var mediaClient = new MediaClient(binding, new EndpointAddress(mediaAddress));
mediaClient.ClientCredentials.HttpDigest.ClientCredential.UserName = username;
mediaClient.ClientCredentials.HttpDigest.ClientCredential.Password = password;
var getProfilesResponse = await mediaClient.GetProfilesAsync();
var profiles = getProfilesResponse.Profiles;
}
If I change port number with 81 the server responds without error but profiles is null (there are 2 profiles actually).
Accessing with the camera webpage I found this ports numbers:
Using Onvif Device Manager it works properly... someone can tell me my what I wrong? Any ideas?
Upvotes: 1
Views: 1597
Reputation: 4188
How did you choose to connect to the media service on port 80
with relative URI /onvif/media_service
? Probably you are not using the correct one (and hard-coding them in code is bad, since newer versions of the firmware may change it).
You should invoke GetServices
from the device management service and use the correct URI to access the desired service.
Upvotes: 1