首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从FritzBox TR-064接口获取请求失败

从FritzBox TR-064接口获取请求失败
EN

Stack Overflow用户
提问于 2019-02-15 17:56:48
回答 1查看 665关注 0票数 0

几天以来,我一直在尝试从我的FritzRepeater上获取via Wifi连接主机的信息,它提供了一个SOAP API。我用的是卷曲...在我不得不使用参数之前,一切都运行得很好。看起来我遗漏了一些关于正确的身体形式的东西。

代码语言:javascript
复制
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>"

响应:

代码语言:javascript
复制
<?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也是如此:

代码语言:javascript
复制
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>"

响应:

代码语言:javascript
复制
<?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>

有人知道我错过了什么吗?

EN

回答 1

Stack Overflow用户

发布于 2019-03-18 19:01:01

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54706744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档