I have two HikVision cameras which I am trying to connect to LightNVR. I would like to use the cameras built-in motion detection if I can.
I am running LightNVR via Docker Compose.
When I try to add the cameras using ONVIF, the cameras are detected, but connecting a camera fails with "Error testing connection: failed to connect to ONVIF device". The output in the logs:
lightnvr | [2026-06-16 12:15:04.383] [INFO] [ONVIFAPI] Handling POST /api/onvif/device/test request
lightnvr | [2026-06-16 12:15:04.383] [INFO] Testing connection to ONVIF device: http://10.10.10.2/onvif/device_service
lightnvr | [2026-06-16 12:15:04.383] [INFO] Sending SOAP request to: http://10.10.10.2/onvif/device_service
lightnvr | [2026-06-16 12:15:04.383] [INFO] Request body: <GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>false</IncludeCapability></GetServices>
lightnvr | [2026-06-16 12:15:04.383] [INFO] No authentication credentials provided
lightnvr | * Trying 10.10.10.2:80...
lightnvr | * Established connection to 10.10.10.2 (10.10.10.2 port 80) from 172.20.0.2 port 34592
lightnvr | * using HTTP/1.x
lightnvr | > POST /onvif/device_service HTTP/1.1
lightnvr | Host: 10.10.10.2
lightnvr | Accept: */*
lightnvr | Content-Type: application/soap+xml; charset=utf-8
lightnvr | Content-Length: 368
lightnvr |
lightnvr | * upload completely sent off: 368 bytes
lightnvr | < HTTP/1.1 200 OK
lightnvr | < Date: Tue, 16 Jun 2026 12:14:29 GMT
lightnvr | < X-Content-Type-Options: nosniff
lightnvr | < X-Frame-Options: SAMEORIGIN
lightnvr | < X-XSS-Protection: 1; mode=block
lightnvr | < Cache-Control: no-cache
lightnvr | < Content-Length: 4497
lightnvr | < Connection: close
lightnvr | < Content-Type: application/soap+xml; charset=utf-8
lightnvr | <
lightnvr | * shutting down connection #0
lightnvr | [2026-06-16 12:15:04.386] [INFO] First SOAP format succeeded
lightnvr | [2026-06-16 12:15:04.386] [INFO] Response (first 200 chars): <?xml version="1.0" encoding="UTF-8"?>
lightnvr | <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLS
lightnvr | [2026-06-16 12:15:04.386] [INFO] Using 's:Body' namespace for XML parsing
lightnvr | [2026-06-16 12:15:04.386] [INFO] Standard XML parsing failed, trying fallback for onvif_simple_server
lightnvr | [2026-06-16 12:15:04.386] [INFO] Created fallback media URL: http://10.10.10.2/onvif/onvif/media_service
lightnvr | [2026-06-16 12:15:04.386] [INFO] Getting profiles for ONVIF device: http://10.10.10.2/onvif/device_service (Media URL: http://10.10.10.2/onvif/onvif/media_service)
lightnvr | [2026-06-16 12:15:04.386] [INFO] Sending SOAP request to: http://10.10.10.2/onvif/onvif/media_service
lightnvr | [2026-06-16 12:15:04.386] [INFO] Request body: <GetProfiles xmlns="http://www.onvif.org/ver10/media/wsdl"/>
lightnvr | [2026-06-16 12:15:04.386] [INFO] No authentication credentials provided
lightnvr | * Trying 10.10.10.2:80...
lightnvr | * Established connection to 10.10.10.2 (10.10.10.2 port 80) from 172.20.0.2 port 34606
lightnvr | * using HTTP/1.x
lightnvr | > POST /onvif/onvif/media_service HTTP/1.1
lightnvr | Host: 10.10.10.2
lightnvr | Accept: */*
lightnvr | Content-Type: application/soap+xml; charset=utf-8
lightnvr | Content-Length: 310
lightnvr |
lightnvr | * upload completely sent off: 310 bytes
lightnvr | < HTTP/1.1 401 Unauthorized
lightnvr | < Date: Tue, 16 Jun 2026 12:14:29 GMT
lightnvr | < X-Content-Type-Options: nosniff
lightnvr | < X-Frame-Options: SAMEORIGIN
lightnvr | < X-XSS-Protection: 1; mode=block
lightnvr | < Content-Length: 234
lightnvr | < Content-Type: text/html
lightnvr | < Connection: close
lightnvr | < WWW-Authenticate: Digest qop="auth", realm="IP Camera(FG314)", nonce="366664393a64303561633136323a618ade1fe5e6440079e800ea9152463f", stale="FALSE"
lightnvr | <
lightnvr | * shutting down connection #0
lightnvr | [2026-06-16 12:15:04.389] [INFO] First SOAP format succeeded
lightnvr | [2026-06-16 12:15:04.389] [ERROR] ONVIF device management request failed with HTTP code 401
lightnvr | [2026-06-16 12:15:04.389] [ERROR] [Device Management] SOAP error response (no Fault element): <!DOCTYPE html>
lightnvr | <html><head><title>Document Error: Unauthorized</title></head>
lightnvr | <body><h2>Access Error: 401 -- Unauthorized</h2>
lightnvr | <p>Authentication Error: This onvif request requires authentication information</p>
lightnvr | </body>
lightnvr | </html>
lightnvr |
lightnvr | [2026-06-16 12:15:04.389] [ERROR] Failed to get profiles
lightnvr | [2026-06-16 12:15:04.389] [ERROR] Failed to connect to ONVIF device: http://10.10.10.2/onvif/device_service
lightnvr | [2026-06-16 12:15:04.389] [ERROR] [ONVIFAPI] Failed to connect to ONVIF device
I tried to make the SOAP request to /onvif/device_service using curl, and the response is:
<?xml version="1.0" encoding="UTF-8" ?>
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tt="http://www.onvif.org/ver10/schema"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl"
xmlns:trt="http://www.onvif.org/ver10/media/wsdl"
xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl"
xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl"
xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl"
xmlns:tst="http://www.onvif.org/ver10/storage/wsdl"
xmlns:ter="http://www.onvif.org/ver10/error"
xmlns:dn="http://www.onvif.org/ver10/network/wsdl"
xmlns:tns1="http://www.onvif.org/ver10/topics"
xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl"
xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http"
xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery"
xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2"
xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2"
xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2"
xmlns:trc="http://www.onvif.org/ver10/recording/wsdl"
xmlns:tse="http://www.onvif.org/ver10/search/wsdl"
xmlns:trp="http://www.onvif.org/ver10/replay/wsdl"
xmlns:tnshik="http://www.hikvision.com/2011/event/topics"
xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl"
xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema"
xmlns:tas="http://www.onvif.org/ver10/advancedsecurity/wsdl"
xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"
xmlns:axt="http://www.onvif.org/ver20/analytics"
><env:Body><tds:GetServicesResponse><tds:Service><tds:Namespace
>http://www.onvif.org/ver10/device/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/device_service</tds:XAddr>
<tds:Version><tt:Major>18</tt:Major>
<tt:Minor>12</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver10/media/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Media</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major>
<tt:Minor>60</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver10/events/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Events</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major>
<tt:Minor>60</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver20/imaging/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Imaging</tds:XAddr>
<tds:Version><tt:Major>16</tt:Major>
<tt:Minor>6</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver10/deviceIO/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/DeviceIO</tds:XAddr>
<tds:Version><tt:Major>16</tt:Major>
<tt:Minor>12</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver20/analytics/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Analytics</tds:XAddr>
<tds:Version><tt:Major>16</tt:Major>
<tt:Minor>12</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver10/recording/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Recording</tds:XAddr>
<tds:Version><tt:Major>16</tt:Major>
<tt:Minor>12</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver10/search/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/SearchRecording</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major>
<tt:Minor>42</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver10/replay/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Replay</tds:XAddr>
<tds:Version><tt:Major>2</tt:Major>
<tt:Minor>21</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service><tds:Namespace
>http://www.onvif.org/ver20/media/wsdl</tds:Namespace>
<tds:XAddr>http://10.10.10.2/onvif/Media2</tds:XAddr>
<tds:Version><tt:Major>16</tt:Major>
<tt:Minor>12</tt:Minor>
</tds:Version>
</tds:Service>
</tds:GetServicesResponse>
</env:Body>
</env:Envelope>
It seems that it expects to find s:Body when the response actually uses env:Body
I have two HikVision cameras which I am trying to connect to LightNVR. I would like to use the cameras built-in motion detection if I can.
I am running LightNVR via Docker Compose.
When I try to add the cameras using ONVIF, the cameras are detected, but connecting a camera fails with "Error testing connection: failed to connect to ONVIF device". The output in the logs:
I tried to make the SOAP request to
/onvif/device_serviceusing curl, and the response is:It seems that it expects to find
s:Bodywhen the response actually usesenv:Body