Arduino-TR-064-SOAP-Library icon indicating copy to clipboard operation
Arduino-TR-064-SOAP-Library copied to clipboard

Can't access services apart from urn:dslforum-org:service

Open overwerk opened this issue 2 years ago • 3 comments

Hi,

I tried for a couple of days to get the external IPv6 address of my FB 7490 via TR064 on my ESP32.

The IPv6 is available here: TR064connection.action("urn:schemas-upnp-org:service:WANIPConnection:1", "X_AVM_DE_GetExternalIPv6Address", params, 0, req, 1, "/igdupnp/control/WANIPConn1");

The problem is, in the function "action_raw" the const _servicePrefix will be added infront of every service name.

_servicePrefix = "urn:dslforum-org:service:";

Therefore I couldn't access "urn:schemas-upnp-org:service:WANIPConnection:1", because in the end it was always "urn:dslforum-org:service:urn:schemas-upnp-org:service:WANIPConnection:1" and returned a 500er http request error.

In the same function you call "cleanOldServiceName", that strips away the prefixes of the services, if provided and later you use above mentioned const to add the prefixes.

Maybe it possible that cleanOldServiceName just adds the prefix, if not provided (service not starting with "urn:" than add it here, otherwise keep the servicename. Afterwards you can get rid of all the _servicePrefix concats in "action_raw".

Best regards and thank you for the library!

overwerk avatar Sep 22 '23 15:09 overwerk

Hey, Thanks for the report. I'll have to see when I have the time to fix it. In the meantime you could try to simply overwrite the _servicePrefix before URL init

Aypac avatar Sep 22 '23 17:09 Aypac

Hey @overwerk

The TR-064 protocol is based on the UPnP standard, but the upnp addresses are not part of it. I don't know what is in your project and if you need the Tr064 library for it. Otherwise a simple POST request will give you the desired result. As an example here a CURL request:

curl -s "http://fritz.box:49000/igdupnp/control/WANIPConn1" -H "Content-Type: text/xml; charset="utf-8"" -H "SoapAction:urn:schemas-upnp-org:service:WANIPConnection:1#X_AVM_DE_GetExternalIPv6Address" -d "<?xml version='1.0' encoding='utf-8'?> <s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <u:X_AVM_DE_GetExternalIPv6Address xmlns:u='urn:schemas-upnp-org:service:WANIPConnection:1'/> </s:Body> </s:Envelope>" -s | grep -Eo '\<[[:alnum:]]{0,}(\:[[:alnum:]]{0,4}){7}\>'

But since the SOAP request is the same, I created a method that handles this. you can try this in the branch develop.

https://github.com/saak2820/Arduino-TR-064-SOAP-Library.git

saak2820 avatar Sep 26 '23 09:09 saak2820

Thank you, I tested it and it seems to work, but I get this error message too:

08:09:08.586 -> [TR064][processGeneralXMLParam] TR064 error, errorCode: '503'
08:09:08.650 -> [TR064][processGeneralXMLParam] TR064 error, errorCodeMessage: 'Authentication failed. No Secret in Header?'
08:09:08.779 -> [TR064][processGeneralXMLParam] TR064 error, errorDescription: auth. failed`

Request I made:

  String params[][2] = { {} };
  String req[][2] = { { "NewX_AVM-DE_HostListPath", "" } };
  TR064connection.action("urn:dslforum-org:service:Hosts:1", "X_AVM-DE_GetHostListPath", params, 0, req, 1);

Strangely it seems to work though, I get the result...

EDIT: Nevermind.. I get the same error message with the old configuration. I dig deeper when I have the time.

overwerk avatar Sep 27 '23 06:09 overwerk