一旦我从UDP多播请求中得到对239.255.255.250的响应
我得到一个带有XAddrs http://10.10.10.10:1234/onvif/device_service的ProbeMatch
现在如何执行GetSystemDateAndTime和GetDeviceInformation
这是对10.10.10.10端口1234的TCP/UDP请求吗?这是对10.10.10.10端口80的HTTP请求吗?
或者一旦我有了设备的地址http:10.10.10.10:1234/onvif/device_service
然后呢?
提前感谢
发布于 2014-03-14 18:08:06
您只需要在那里发送一个HTTP请求,因为SOAP在HTTP上工作。例如,通过CURL,它将如下所示:
curl 10.10.10.10:1234/onvif/device_service -d '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>'因此,您将获得类似以下内容的内容,其中包含一些标题:
<tds:GetSystemDateAndTimeResponse>
<tds:SystemDateAndTime>
<tt:DateTimeType>Manual</tt:DateTimeType>
<tt:DaylightSavings>false</tt:DaylightSavings>
<tt:TimeZone>
<tt:TZ>MoroccoStandardTime0</tt:TZ>
</tt:TimeZone>
<tt:UTCDateTime>
<tt:Time>
<tt:Hour>10</tt:Hour>
<tt:Minute>5</tt:Minute>
<tt:Second>35</tt:Second>
</tt:Time>
<tt:Date>
<tt:Year>2014</tt:Year>
<tt:Month>3</tt:Month>
<tt:Day>14</tt:Day>
</tt:Date>
</tt:UTCDateTime>
</tds:SystemDateAndTime>
</tds:GetSystemDateAndTimeResponse>另外,不要忘记大多数操作都需要包含在请求中的authorization头。
AUTHENTICATION
在第35页的ONVIF Application Programmer's Guide中,描述了如何完成身份验证。例如,它看起来像这样:
<s:Header>
<Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<UsernameToken>
<Username>admin</Username>
<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">MuMnyh3wTxGWOCc=</Password>
<Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">8Qqve9KCkNhQAAAAAAA==</Nonce>
<Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2014-03-04T14:03:05.130Z</Created>
</UsernameToken>
</Security>
</s:Header>发布于 2014-03-22 03:16:23
@Kirix解决方案不适用于我的特定相机。然而,在大量的代码研究和试验/错误之后..我决定我的Trendnet相机坚持标题是完美的。我想出了一个卷曲的变种:
curl http://192.168.xxx.xxx/onvif/device_service --data '<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetSystemDateAndTime xmlns="http://www.onvif.org/ver10/device/wsdl"/></s:Body></s:Envelope>' --header 'Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime";'发布于 2014-03-05 18:39:14
在本例中,http://10.10.10.10:1234/onvif/device_service是设备管理服务的地址。您需要根据SOAP协议发送GetSystemDateAndTime请求。
如何发送此类请求取决于您正在使用的系统。你可以使用Visual Studio或gsoap (有一个关于ONVIF的FAQ )
https://stackoverflow.com/questions/22185508
复制相似问题