Aypac / Arduino-TR-064-SOAP-Library

Arduino library for the TR-064 protocol, most commonly used by the Fritz!Box router API
Other
65 stars 21 forks source link

urn:dslforum-org:service:WANDSLInterfaceConfig:1 returning empty result? #7

Closed myaliaswastaken closed 4 years ago

myaliaswastaken commented 6 years ago

Hi Aypac,

thanks for this great library, it's a great thing to communicate with the Fritz!Box and implementing cool stuff. I ran into some trouble and wondered, if you might be able to enlighten me.

my problem is, that a query like:

  String params[][2] = {{}};
  String req[][2] = {{"NewLayer1DownstreamMaxBitRate",""},{"NewLayer1UpstreamMaxBitRate", ""},{"NewWANAccessType",""},{"NewPhysicalLinkStatus",""}};
  connection.action("urn:dslforum-org:service:WANCommonInterfaceConfig:1", "GetCommonLinkProperties", params, 0, req, 4);

runs perfectly fine, but getting connection information via

  String params[][2] = {{}};
  String req[][2] = {{"NewEnable",""},{"NewStatus", ""},{"NewDataPath",""},{"NewUpstreamCurrRate",""},{"NewDownstreamCurrRate",""},{"NewUpstreamMaxRate", ""},{"NewDownstreamMaxRate",""},{"NewUpstreamNoiseMargin",""},{"NewDownstreamNoiseMargin",""},{"NewUpstreamAttenuation", ""},{"NewDownstreamAttenuation",""},{"NewATURVendor",""},{"NewATURCountry",""},{"NewUpstreamPower", ""},{"NewDownstreamPower",""}};
  connection.action("urn:dslforum-org:service:WANDSLInterfaceConfig:1", "GetInfo", params, 0, req, 15);

seems to always return an empty result. I was wondering, if I'd be doing something obviously wrong, maybe you could help me out?

Thanks a million!

Aypac commented 6 years ago

Hi @myaliaswastaken! It's good to hear, that you enjoy using the library!

I've just checked and the call seems to be right on first glance (see below for how I did that). I've not tested running it on one of my ESPs yet. Will try to do this this WE, not 100% sure if I'll find the time. But I have three suggestions for you!

1.) Have you tried only requesting one parameter at a time (so i.e.

String params[][2] = {{}};
  String req[][2] = {{"NewEnable",""},{"NewStatus", ""},{"NewDataPath",""},{"NewUpstreamCurrRate",""},{"NewDownstreamCurrRate",""},{"NewUpstreamMaxRate", ""},{"NewDownstreamMaxRate",""},{"NewUpstreamNoiseMargin",""},{"NewDownstreamNoiseMargin",""},{"NewUpstreamAttenuation", ""},{"NewDownstreamAttenuation",""},{"NewATURVendor",""},{"NewATURCountry",""},{"NewUpstreamPower", ""},{"NewDownstreamPower",""}};
  connection.action("urn:dslforum-org:service:WANDSLInterfaceConfig:1", "GetInfo", params, 0, req, 15);

2.) You might try is to check whether the account you use has all required permissions (though I don't expect this to be a problem in this case).

3.) Try to send manual requests from your browser to the API and check if the fbox gives the right replies or if something is wrong with the library. I used to do this when developing this library, using some SOAP browser addon. You can generate the required Nonces with this website (if you trust me enough to enter your password there): http://aypac.de/tr064_nonce.php?realm=_&uid=_&pw=_&sn=_ (replace the underscores with the according information) Here is a guy doing the same from a linux shell. This is a bit annoying however and might take some time to figure out.

Good luck :+1:


For future reference and maybe for others who are struggeling with using the library:

Click here to see how I checked myaliaswastaken's commands. Start at https://192.168.179.1:49443/tr64desc.xml (assuming the default IP for your fbox). Then go to the service-node with the serviceType 'urn:dslforum-org:service:WANDSLInterfaceConfig:1'. You see, that the associated SCPDURL is '/wandslifconfigSCPD.xml', so if you head over to https://192.168.179.1:49443/wandslifconfigSCPD.xml you see what actions are available on this service. You see there is a service called 'GetInfo', so I know I can call this service with connection.action("urn:dslforum-org:service:WANDSLInterfaceConfig:1", "GetInfo", params, a, req, b); Now I want to also get arguments from that service, so I put together the req array. This looks like this: String req[][2] = {{"argumentName1",""},{"argumentName2", ""},...}; b = 2 //or whatever number of arguments you are requesting where is one of the name nodes inside one of the argument nodes inside the argumentList nodes of the action that I chose above (and where the direction is 'out'). The empty string behind the argumentName is then filled with the value of the associated variable. Some action also take input parameters (like when you want to change the password of your WIFI), which then would be marked by a direction tag with the value 'in'. This is then done in a similar fashion with String params[][2] = {{"argumentName1","value1"},{"argumentName2","value2"}, ...}; a = 2 //or whatever number of arguments you are passing
myaliaswastaken commented 6 years ago

Hi Aypac,

thanks for your reply and effort much appreciated!

Running with only one parameter also delivers an empty result, unfortunately. Query used was this one:

  String params[][2] = {{}};
  String req[][2] = {{"NewEnable",""}};
  connection.action("urn:dslforum-org:service:WANDSLInterfaceConfig:1", "GetInfo", params, 0, req, 1);

I tried querying the Fritz!Box from the shell using wget, like in your referenced example here:
https://idefix.net/~koos/newsitem.cgi/1417032285.

Interesting enough, everything works fine, using the example provided and querying for GetCommonLinkProperties But when I run a query for GetInfo, as reply I do get an internal 500 error.

Meanwhile I'm wondering if this might be supported by my 6590 Cable.

Thanks for all your help!

Aypac commented 6 years ago

Ok, so we can assume that the problem is not related with this library? I will still try to run it on my box, see if it works there this WE. I also think I remember a forum thread somewhere which was a community effort to "map" the functionalities of different fritz box API's, I'll try to find it later.

Aypac commented 4 years ago

Any news on this?

myaliaswastaken commented 4 years ago

Hi, thanks for asking ;) Actually not really. I ran into the issue mentioned and simply couldn't solve it

Aypac commented 4 years ago

Some additional ideas of things to check:

Aypac commented 4 years ago

As the library has had some major improvements in the meantime and OP seems to have move on, I'll close the issue. Please create a new issue and reference this one if you encounter a similar problem.