我从几天起就尝试从我的Fritzrepeater获取Via Wifi连接的主机的信息,该信息为此提供了肥皂API。我正在使用卷发...一切正常,直到我必须使用参数/参数为止。似乎我缺少有关正确的身体格式的东西。
For example - working request NOT using arguments:
location="/upnp/control/deviceinfo"
uri="urn:dslforum-org:service:DeviceInfo:1"
action="GetInfo"
par=""
param=""
curl -k -m 5 --anyauth -u "$FRITZUSER:$FRITZPW" http://$IP:49000$location
-H 'Content-Type: text/xml; charset="utf-8"'
-H "SoapAction:$uri#$action"
-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:$action xmlns:u='$uri'>
$param
</u:$action>
</s:Body>
</s:Envelope>"
响应:
<?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:GetInfoResponse xmlns:u="urn:dslforum-org:service:DeviceInfo:1">
<NewManufacturerName>AVM</NewManufacturerName>
<NewManufacturerOUI>00040E</NewManufacturerOUI>
<NewModelName>FRITZ!WLAN Repeater 310</NewModelName>
<NewDescription>FRITZ!WLAN Repeater 310 122.06.92</NewDescription>
<NewProductClass>FRITZ!WLAN Repeater</NewProductClass>
<NewSerialNumber>9CC7A6D3BE8F</NewSerialNumber>
<NewSoftwareVersion>122.06.92</NewSoftwareVersion>
<NewHardwareVersion>FRITZ!WLAN Repeater 310</NewHardwareVersion>
<NewSpecVersion>1.0</NewSpecVersion>
<NewProvisioningCode></NewProvisioningCode>
<NewUpTime>296364</NewUpTime>
<NewDeviceLog></NewDeviceLog>
</u:GetInfoResponse>
</s:Body>
</s:Envelope>
和参数/args相同:
location="/upnp/control/wlanconfig1"
uri="urn:dslforum-org:service:WLANConfiguration:1"
action="GetGenericAssociatedDeviceInfo"
par="NewAssociatedDeviceIPAddress"
param="<s:$par></s:$par>"
curl -k -m 5 --anyauth -u "$FRITZUSER:$FRITZPW" http://$IP:49000$location
-H 'Content-Type: text/xml; charset="utf-8"'
-H "SoapAction:$uri#$action"
-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:$action xmlns:u='$uri'>
$param
</u:$action>
</s:Body>
</s:Envelope>"
响应:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:dslforum-org:control-1-0">
<errorCode>402</errorCode>
<errorDescription>Invalid Args</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
任何人都知道我缺少什么?
手册wlanconfigSCPD.pdf
列出输入参数NewAssociatedDeviceIndex
而不是NewAssociatedDeviceIPAddress
。参数NewAssociatedDeviceIndex
需要0
的数值值,以 GetTotalAssociations()
减去1
。