TransWikia.com

Why UPNP gives me error 501 even thought the Curl request I sent is correct?

Super User Asked by mina nageh on November 12, 2021

i am trying to use the UPNP on my router but keeps giving me the 501 error

the command i am using

curl "192.168.1.1:52869/control/igd/devinfo" --header "SOAPAction: urn:dslforum-org:service:DeviceInfo:1#GetInfo" -vv -d @1.xml -H "Content-Type: text/xml;charset=utf-8"

the deviceinfo.xml that i got the information from … and the IGD.xml that i got the SOAPAction from … exactly this part

<serviceList>
<service>
<serviceType>urn:dslforum-org:service:DeviceInfo:1</serviceType>
<serviceId>DeviceInfo</serviceId>
<controlURL>/control/igd/devinfo</controlURL>
<eventSubURL>/event/igd/devinfo</eventSubURL>
<SCPDURL>/DeviceInfo.xml</SCPDURL>

from some unknown reason the only request that are working are these too from this tool

enter image description here

even thought the IGD.xml provides tons of options .. port forwarding and some wan options are the only ones available in the tool

the command that works

curl "192.168.1.1:52869/upnp/control/WANIPConn1"  --header "SOAPAction: urn:schemas-upnp-org:service:WANIPConnection:1#GetExternalIPAddress" -vv -d @1.xml -H "Content-Type: text/xml;charset=utf-8"

the 1.xml file looks like this mostly a mix of the soap action and regular xml soap request.

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetExternalIPAddress xmlns:u=”urn:schemas-upnp-org:service:WANIPConnection:1″></u:GetExternalIPAddress></s:Body></s:Envelope>

i didn’t even know where the tool got that url that is totally different from the ones in the igd.xml file so i searched the strings in the firmware files of the device and found a file called gatedesc.skl with only the two options that are in the image… how is that and where does the problem lie?

2 Answers

in addition to what @gaddman (thanks mate)said.... here is some info that sure will help anyone coming across this problem.

if you are doing it manually then mostly the request is made in this way (i am using curl for the job)

curl "(here you type the device ip and upnp port + control url of the config you want make that you sure will find using tools like miniupnpc-2.1)" then this header --header "SOAPAction: (and a long part that you will find on the top of the action url just like the this image )+#(the action you want) then -vv -d @the file where the you put the info of the action you want.xml then this static header -H "Content-Type: text/xml;charset=utf-8"

so basically the command looks like this

curl "192.168.1.1:52869/control/igd/wlanc_1_1" --header "SOAPAction: urn:dslforum-org:service:WLANConfiguration:1#GetInfo" -vv -d @2.xml -H "Content-Type: text/xml;charset=utf-8"

enter image description here

you get the urls by typing listdevices.exe in the command line in the miniupnpc-2.1 folder. the xml file is mostly static and dynamic part is made of the soap action header like this

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetInfo xmlns:u="urn:dslforum-org:service:WLANConfiguration:1"></u:GetInfo></s:Body></s:Envelope>

i really recommend using a gui tool if you have no clue about this like UPnP Tester for windows or UPnP Tool which i really prefer over the other cause it gets updates and functions better mostly.

sorry for the not clear explanation , i am still new at this.

Answered by mina nageh on November 12, 2021

You've got smart quotes around the schema in 1.xml, correct those first (unless that's just from pasting here).

Answered by gaddman on November 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP