onvif: HikVision "Wrong ONVIF Soap Response" Error

Hey all,

I have a client that installed a bunch of HikVision cameras. Normally these connect without any issues, but we ran into some issues this time with most of the cameras. We were getting the error “Wrong ONVIF Soap Response”. It seems this is an issue with the newer firmware. We seem to be able to connect fine to cameras with the 18.12 firmware, but cameras with 19.12 are unable to connect:

image image

I added a bit of extra logging and was able to get some extra details that I hop could be useful.

First, I logged out the data that was being parsed when that error message was loaded up and got this: image

(for searchability, this message is returning “Access Error: 401 - Unauthorized”)

In our code, the “Unable to reach camera” error is triggered when we get an error after calling Camera.connect(). I tracked that a bit further and was able to get a trace in place to the spot that is complaining:

Trace
    at Cam.<anonymous> (/.../node_modules/onvif/lib/cam.js:176:17)
    at Cam.<anonymous> (/.../node_modules/onvif/lib/media.js:989:15)
    at /.../node_modules/onvif/lib/utils.js:74:6
    at Parser.<anonymous> (/.../node_modules/xml2js/lib/parser.js:304:18)
    at Parser.emit (events.js:400:28)
    at Parser.emit (domain.js:475:12)
    at SAXParser.onclosetag (/.../node_modules/xml2js/lib/parser.js:262:26)
    at emit (/.../node_modules/sax/lib/sax.js:624:35)
    at emitNode (/.../node_modules/sax/lib/sax.js:629:5)
    at closeTag (/.../node_modules/sax/lib/sax.js:889:7)

From my tracking it seems that getProfiles or getVideoSources now requires authentication but something isn’t working correctly with that for the newer firmware - but I’m not sure how to go about debugging further.

Unfortunately I don’t have direct access to the cameras themselves, but I do have access to the code & device that are actively attempting to connect to the cameras, so if any changes are needed to get extra information or to test changes let me know and I can make them directly to try.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

海康18.12及其以前的相机支持普通的WSSE认证的方式,因此直接使用gsoap中的soap_wsse_add_UsernameTokenDigest就可以完成认证,但是之后新版本的相机只支持安全的WSSE认证方式和digest认证,WSSE需要客户端和服务端时间同步,因此在使用WSSE认证方式之前需要校时。但是digest不需要。