【问题标题】:Getting Request from FritzBox TR-064 API fails从 FritzBox TR-064 API 获取请求失败
【发布时间】:2019-07-09 10:40:02
【问题描述】:

我几天以来一直在尝试从我的 FritzRepeater 获取通过 Wifi 连接的主机的信息,FritzRepeater 为此提供了一个 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>

有人知道我缺少什么吗?

【问题讨论】:

    标签: api soap fritzbox


    【解决方案1】:

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

    【讨论】:

    • 参数 NewAssociatedDeviceIPAddress 也确实存在,但它需要 IP 地址作为输入(例如,param="192.168.178.92") 和操作 X_AVM-DE_GetSpecificAssociatedDeviceInfoByIp 而不是 GetGenericAssociatedDeviceInfo,后者可以在后者之后使用传递的 IP 地址调用。
    猜你喜欢
    • 2018-05-21
    • 2022-11-06
    • 2018-12-04
    • 2017-03-10
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-18
    相关资源
    最近更新 更多