几天以来,我一直在尝试从我的 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>
有人知道我缺少什么吗?