从FritzBox TR-064 API获取请求失败

时间:2019-02-15 09:56:48

标签: api soap fritzbox

几天以来,我一直在尝试从我的FritzRepeater中获取通过Wifi连接的主机的信息,后者为此提供了SOAP API。我正在使用curl ...一切正常,直到必须使用参数/参数为止。似乎我缺少正确的身体身材。

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>

与参数/参数相同:

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>

有人知道我想念什么吗?

1 个答案:

答案 0 :(得分:0)

手册wlanconfigSCPD.pdf 列出输入参数NewAssociatedDeviceIndex而不是NewAssociatedDeviceIPAddress。 参数NewAssociatedDeviceIndex要求从0GetTotalAssociations()减去1的数值。