ONVIF Error in deserializing body of reply message for operation 'GetStatus' -> The string '1532531507' is not a valid AllXsd value

烂漫一生 提交于 2019-12-13 03:13:06

问题


CONTEXT :

I'm making a c# windows form app that communicates to ONVIF cameras using the wsdls given on the onvif site.

https://www.onvif.org/ver10/media/wsdl/media.wsdl

and

https://onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl

I am able to get profiles on the camera, send PTZ action and more, but when I try to get the status of the ptzClient I created, I get the error:

Error in deserializing body of reply message for operation 'GetStatus'

I looked in the innerException of this error to find:

The string '1532531507' is not a valid AllXsd value.

Here's how I create my ptzClient:

ServicePointManager.Expect100Continue = false;
var commonEncoding = new TextMessageEncodingBindingElement
                {
                    MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
                };
var commonBinding = new HttpTransportBindingElement
                {
                    AuthenticationScheme = AuthenticationSchemes.Digest
                };
var commonCustomBinding = new CustomBinding(commonEncoding, commonBinding);
var commonPasswordDigestBehavior = new PasswordDigestBehavior(userName, password);
var ptzEndpointAddress = new EndpointAddress($"http://{cameraAddress}/onvif/ptz");
ptzClient = new PTZClient(commonCustomBinding, ptzEndpointAddress);
ptzClient.Endpoint.EndpointBehaviors.Add(commonPasswordDigestBehavior);

The error happens when calling this line of code:

var p = ptzClient.GetStatus(profile.token);

When I go see my xml request and its corresponding xml response in wireshark, I see that there is no error :

QUESTION :

How can I manage to make this call without getting these errors?

There isn't much I can change...

It seems that the problem is from the date format, but I don't see a way to change this format.


回答1:


To Know whether the camera device supports PTZ, you can call GetCapabilities on device service.

The GetCapabilities list includes references to the addresses (XAddr) of the service(in your case it is PTZ service) implementing the interface operations in the category. If PTZ service is not listed in GetCapabilities list then PTZ is not supported by your device.

GetStatus api just returns PTZ status for the Node in the selected profile.

There are ONVIF test tools available to test your camera on windows platform to easy the development. http://www.happytimesoft.com/products/onvif-client/index.html



来源:https://stackoverflow.com/questions/51523249/onvif-error-in-deserializing-body-of-reply-message-for-operation-getstatus

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