Comments (5)
Hi @LODYZ , I really don't know what's happening with that connection issue. I've read here - https://dart.dev/tools/pub/troubleshoot - that anti-virus software can cause the issue.
I also found that one of the code changes that you referred to here - LODYZ@aed87fa - did not make it into the new build. I've published v2.1.0-dev.9 that includes the change.
from easy_onvif.
Hi @faithoflifedev, i've inspected the situation and probably found the problem.
Using the Flutter DevTools i noticed that:
3 post calls:
- getSystemDateAndTime -> response 200
<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header/><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>
- GetServices -> response 500
request:
<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header/><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"><IncludeCapability>true</IncludeCapability></GetServices></s:Body></s:Envelope>
response:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns2="http://www.onvif.org/ver10/pacs" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver10/accesscontrol/wsdl" xmlns:ns3="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:vifsvr="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:vifsvr10="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:vifsvr2="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:vifsvr3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:vifsvr4="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:vifsvr5="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:vifsvr6="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:vifsvr7="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:vifsvr8="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:vifsvr9="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><SOAP-ENV:Fault><SOAP-ENV:Code><SOAP-ENV:Value>ter:Unauthorized</SOAP-ENV:Value><SOAP-ENV:Subcode><SOAP-ENV:Value>ter:Unauthorized</SOAP-ENV:Value></SOAP-ENV:Subcode></SOAP-ENV:Code><SOAP-ENV:Reason><SOAP-ENV:Text xml:lang="en">**Sender not Authorized**</SOAP-ENV:Text></SOAP-ENV:Reason></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
- GetCapabilities -> response 500 (like the previous point)
At this point i compared this connection phase with "my" v2.0.13+19 version.
Here the request also contains authentication in the header:
<?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:Header> <Security xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1"> <UsernameToken> <Username>replaced</Username> <Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">replaced=</Password> <Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">replaced==</Nonce> <Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2023-03-13T22:41:41.000143Z </Created> </UsernameToken> </Security> </s:Header> <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <GetServices xmlns="http://www.onvif.org/ver10/device/wsdl"> <IncludeCapability>true</IncludeCapability> </GetServices> </s:Body> </s:Envelope>
In conclusion i think this famous "Connection closed while receiving data" error is simply an authentication problem.
I hope it could be useful. Let me know if you find a match.
Thanks in advance
from easy_onvif.
@LODYZ, I think we have some progress here. It looks like the device you are using requires an authenticated header for the GetServices
request, while all the devices that I've tested to date do not require this. I've now published v2.1.0-dev.10 that adds the authenticated header when making the request.
Let me know if this resolves the issue for you.
from easy_onvif.
Hi @faithoflifedev, problem solved 🎉
from easy_onvif.
Hi @LODYZ,
I've finally gotten access to a device that allowed me to recreate this issue for a specific Onvif command. For the media2.getStreamUri
request, the Onvif supplied wsdl
description wasn't updated properly to match the official spec - https://www.onvif.org/specs/srv/media/ONVIF-Media2-Service-Spec.pdf - so the SOAP request the code was building was incorrect and some devices like the Lorex LNB4421SB throw a "Connection closed" error rather than the documented env:Sender - ter:InvalidArgVal
that would actually be useful.
Even though this wasn't your specific issue, I'm adding this here so that the related issue is at least somewhat documented. The moral of the story is that there are errors in the spec documents and also bad spec implementations on devices that cause a double whammy for troubleshooting.
The next release will have the "Connection closed" issue resolved for and media2.getStreamUri
requests.
from easy_onvif.
Related Issues (20)
- [2.1.0-dev11] error during onvif.getProfiles() device media1 HOT 2
- [2.1.0-dev11] error during onvif.getStreamUri() device media1 HOT 2
- [2.1.0-dev.14] onvif.mediaSupportLevel HOT 2
- Flutter example application cannot run successfully HOT 2
- RTSP port in the getStreamUri response not correct HOT 3
- camera recording HOT 2
- Is it possible to check if Onvif connect failed? HOT 2
- Onvif Imaging Profile HOT 3
- MulticastProbe with Auth HOT 3
- onvif discovery crash in windows HOT 6
- using CLI for testing causes a crash on onvif probe list-devices HOT 1
- Unable to get preset HOT 26
- new specifications support--thermal interface HOT 2
- How send audio stream to camera ? HOT 3
- Couldn't connect with Ezviz H8c camera HOT 3
- BUG: get-capabilities method is breaking for some cameras HOT 4
- BUG: Camera movement command is not working for some cameras HOT 16
- DioException [receive timeout]: The request HOT 10
- getStreamUri doesn't connect to sub stream of Onvif camera HOT 5
- Actions that require authentication no longer work HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easy_onvif.