iSpy
iSpy copied to clipboard
ONVIF: Error getting video urls
Hi, I'm trying to configure my ONVIF camera but I get an error when I click the "Get Video URLs" button.
Here's the log:
Error: ONVIF Profiles: ONVIF Profiles: Errore nella deserializzazione del corpo del messaggio di risposta per l'operazione 'GetStreamUri'.
Error: ONVIF Profiles: in System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
in System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
in System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
in System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
in System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
in System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
in System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
in System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass7_0`1.<CreateGenericTask>b__0(IAsyncResult asyncResult)
in System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in CoreLogic.Extensions.<WithCancellation>d__0`1.MoveNext()
--- Fine traccia dello stack da posizione precedente dove è stata generata l'eccezione ---
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in CoreLogic.Onvif.ONVIFDevice.<ProcessMedia1Client>d__47.MoveNext()
Error: ONVIF Profiles: ONVIF Profiles: Errore nel documento XML (1, 1889).
Error: ONVIF Profiles: in System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
in System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
Error: ONVIF Profiles: ONVIF Profiles: Fine del file imprevista. Gli elementi seguenti non sono stati chiusi: Uri, MediaUri, GetStreamUriResponse, Body, Envelope. Riga 1, posizione 1889.
PTZ Discovery: Could not get PTZ config for Onvif Device - using defaults
Error: Failed to connect
Error: in CoreLogic.Server.JsonProcessor.<LoadJson>d__7.MoveNext()
Failed to connect
This is the actual response of "GetStreamUri" using curl (I've masked the password with ****):
$ curl -s http://192.168.1.7:8899/onvif/device_service --data "<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetStreamUri xmlns="http://www.onvif.org/ver10/device/wsdl"><ProfileToken>PROFILE_000</ProfileToken></GetStreamUri></s:Body></s:Envelope>" --header 'Content-Type: application/soap+xml; charset=utf-8;'
<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:e="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" 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:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tst="http://www.onvif.org/ver10/storage/wsdl" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:axt="http://www.onvif.org/ver20/analytics" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:ter="http://www.onvif.org/ver10/error"><s:Body><trt:GetStreamUriResponse><trt:MediaUri><tt:Uri>rtsp://192.168.1.7:554/user=admin_password=*********_channel=0_stream=0&protocol=unicast.sdp?real_stream</tt:Uri><tt:InvalidAfterConnect>false</tt:InvalidAfterConnect><tt:InvalidAfterReboot>false</tt:InvalidAfterReboot><tt:Timeout>PT60S</tt:Timeout></trt:MediaUri></trt:GetStreamUriResponse></s:Body></s:Envelope>
hello that's probably not the response Agent is getting - you could try running Fiddler or Wireshark to see what response Agent is getting from the camera, I'm assuming it's probably a plain text error message that it's trying to parse as an XML response.
Hi @ispysoftware
thanks for the quick replay.
I've sniffed the http traffic to see the exact response Agent is getting and here it is (I've masked the passwords with ****):
## REQUEST
POST /onvif/media_service HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Host: 192.168.1.7:8899
Content-Length: 1524
Accept-Encoding: gzip, deflate
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">****</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">h5M8pw8ADpzfxvrTzP8hO6xH+pQ=</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2022-01-21T12:59:08.427Z</Created></UsernameToken></Security><a:Action s:mustUnderstand="1">http://www.onvif.org/ver10/media/wsdl/GetStreamUri</a:Action><a:MessageID>urn:uuid:871ec0dc-87ef-434c-911e-c3b491a056aa</a:MessageID><a:ReplyTo><a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address></a:ReplyTo><a:To s:mustUnderstand="1">http://192.168.1.7:8899/onvif/media_service</a:To></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetStreamUri xmlns="http://www.onvif.org/ver10/media/wsdl"><StreamSetup><Stream xmlns="http://www.onvif.org/ver10/schema">RTP-Unicast</Stream><Transport xmlns="http://www.onvif.org/ver10/schema"><Protocol>RTSP</Protocol></Transport></StreamSetup><ProfileToken>PROFILE_000</ProfileToken></GetStreamUri></s:Body></s:Envelope>
## RESPONSE
HTTP/1.1 200 OK
Server: hsoap/2.8
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 2156
Connection: close
<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:e="http://www.w3.org/2003/05/soap-encoding" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" 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:tt="http://www.onvif.org/ver10/schema" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tst="http://www.onvif.org/ver10/storage/wsdl" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:axt="http://www.onvif.org/ver20/analytics" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:ter="http://www.onvif.org/ver10/error"><s:Header><wsa:MessageID>urn:uuid:871ec0dc-87ef-434c-911e-c3b491a056aa</wsa:MessageID><wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To></s:Header><s:Body><trt:GetStreamUriResponse><trt:MediaUri><tt:Uri>rtsp://192.168.1.7:554/user=admin_password=****_channel=0_stream=0&protocol=unicast.sdp?real_stream</tt:Uri><tt:InvalidAfterConnect>false</tt:InvalidAfterConnect><tt:InvalidAfterReboot>false</tt:InvalidAfterReboot><tt:Timeout>PT60S</tt:Timeout></trt:MediaUri></trt:GetStreamUriResponse></s:Body></s:Envelope>
So it seems the camera is actually responding with the GetStreamUriResponse.
I've tried various XML validators online and some of them says that is not valid.
The problem seems related to the & character inside the tt:Uri element., butf I open that rtsp url with VLC it works just fine, I see the stream of the camera.
Any suggestion what I can do to make it work on AgentDVR?
yes you are right there, & in xml must be encoded as & amp; otherwise it will break validation. what you could do is just use that URL in Agent as an IP camera URL and bypass onvif I'll take a look to see if i can fix the field in our onvif code
hmm not looking likely unfortunately - it's basically coming back as an invalid XML document very early on in the processing. I'd check for firmware updates for your camera, possibly they have fixed it on their side.
Hi.
I started having the same problem. Unfortunately, manufacturer will most probably not be fixing it (at least for my camera from what I have understood from their email). It was working fine, until it got a firmware update. They tell me to use their NVR to have no problems using it, which I do not want.
On Agent DVR, however, there is an option to override the Live (and Recording) URL while using ONVIF option. Unfortunately, the configuration window still shows an error if pressed OK twice, telling that no URL has been defined (which I did using override URL). Can you not invalidate the fetching the URLs if override fields are given? See the both images below:


For information purposes, here is my wireshark monitor results, similar to original poster:
<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s=http://www.w3.org/2003/05/soap-envelope xmlns:e=http://www.w3.org/2003/05/soap-encoding xmlns:wsa=http://www.w3.org/2005/08/addressing xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:wsaw=http://www.w3.org/2006/05/addressing/wsdl xmlns:wsnt=http://docs.oasis-open.org/wsn/b-2 xmlns:wstop=http://docs.oasis-open.org/wsn/t-1 xmlns:wsntw=http://docs.oasis-open.org/wsn/bw-2 xmlns:wsrf-rw=http://docs.oasis-open.org/wsrf/rw-2 xmlns:wsrf-r=http://docs.oasis-open.org/wsrf/r-2 xmlns:wsrf-bf=http://docs.oasis-open.org/wsrf/bf-2 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:tt=http://www.onvif.org/ver10/schema xmlns:tns1=http://www.onvif.org/ver10/topics xmlns:tds=http://www.onvif.org/ver10/device/wsdl xmlns:trt=http://www.onvif.org/ver10/media/wsdl xmlns:tev=http://www.onvif.org/ver10/events/wsdl xmlns:timg=http://www.onvif.org/ver20/imaging/wsdl xmlns:tst=http://www.onvif.org/ver10/storage/wsdl xmlns:dn=http://www.onvif.org/ver10/network/wsdl xmlns:tr2=http://www.onvif.org/ver20/media/wsdl xmlns:tptz=http://www.onvif.org/ver20/ptz/wsdl xmlns:tan=http://www.onvif.org/ver20/analytics/wsdl xmlns:axt=http://www.onvif.org/ver20/analytics xmlns:tmd=http://www.onvif.org/ver10/deviceIO/wsdl xmlns:ter=http://www.onvif.org/ver10/error><s:Header></s:Header><s:Body><trt:GetStreamUriResponse><trt:MediaUri><tt:Uri>rtsp://192.168.178.40:554/user=xxx_password=yyyyyyy_channel=0_stream=0&protocol=unicast.sdp?real_stream</tt:Uri><tt:InvalidAfterConnect>false</tt:InvalidAfterConnect><tt:InvalidAfterReboot>false</tt:InvalidAfterReboot><tt:Timeout>PT60S</tt:Timeout></trt:MediaUri></trt:GetStreamUriResponse></s:Body></s:Envelope>
There is a unescaped “&” in the Streamuri:
rtsp://192.168.178.40:554/user=xxx_password=yyyyyyy_channel=0_stream=0&protocol=unicast.sdp?real_stream
The correct one should have been
rtsp://192.168.178.40:554/user=xxx_password=yyyyyyy_channel=0_stream=0&protocol=unicast.sdp?real_stream
that'll only work if it can pass onvif validation - if it's not you can just add a normal IP camera source using those URLs for live and record sources.
On Wed, Jan 26, 2022 at 10:48 PM Volkan Gezer @.***> wrote:
Hi.
I started having the same problem. Unfortunately, manufacturer will most probably not be fixing it (at least for my camera from what I have understood from their email). It was working fine, until it got a firmware update. They tell me to use their NVR to have no problems using it, which I do not want.
On Agent DVR, however, there is an option to override the Live (and Recording) URL while using ONVIF option. Unfortunately, the configuration window still shows an error if pressed OK twice, telling that no URL has been defined (which I did using override URL). Can you not invalidate the fetching the URLs if override fields are given? See the both images below:
[image: image] https://user-images.githubusercontent.com/231068/151184157-4c088e3b-686a-4575-be2e-5f7fc161b1dc.png
[image: image] https://user-images.githubusercontent.com/231068/151184645-ec08dba6-f63c-4c4e-bd74-4ee5bbe1fa05.png
For information purposes, here is my wireshark monitor results, similar to original poster:
rtsp://192.168.178.40:554/user=xxx_password=yyyyyyy_channel=0_stream=0&protocol=unicast.sdp?real_stream false false PT60S There is a unescaped “&” in the Streamuri: rtsp:// 192.168.178.40:554/user=xxx_password=yyyyyyy_channel=0_stream=0&protocol=unicast.sdp?real_stream The correct one should have been rtsp:// 192.168.178.40:554/user=xxx_password=yyyyyyy_channel=0_stream=0&protocol=unicast.sdp?real_stream
— Reply to this email directly, view it on GitHub https://github.com/ispysoftware/iSpy/issues/168#issuecomment-1022267946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGDKXO7ZTVZ5REJRQBFTK3UYACTTANCNFSM5MIOFXUQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>