问题
My question is about the ONVIF specification. http://www.onvif.org/imwp/download.asp?ContentID=18006 In section 5.10, it says :
A service is a collection of related ports. This specification does not mandate any service naming principles.
Lets say that I have the IP address of an NVT (Network Video Transmitter like an IP camera for example), how do I form the address of the device management web service? This service is the entry point of the whole system.
Thank you.
回答1:
According to the official document (section 5.1.1), you can access the service at http://<IP address>/onvif/device_service
回答2:
you have to add service in onvif xsdl file ( lets say http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl )
<wsdl:definitions ......>
..............
</wsdl:binding>
<!--===============================-->
<wsdl:service name="DeviceService">
<wsdl:port name="DevicePort" binding="tds:DeviceBinding">
<soap:address location="http://ip/onvif/device_service"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
and generate ws client source code ( for java can use wsimport )
As was mentioned the entry point for webservice is http://ip/onvif/device_service
回答3:
The convention pointed by Şafak is described in ONVIF standard. But in real life some devices does not follow it. In this case you try send unicast ws-discovery Probe request (or multicast and then filter ProbeMatch replies by ip-address), XAddrs field in ProbeMatch reply will contain the required address for device service.
回答4:
Just be aware to use everywhere the *http://IP/onvif/device_service*
url for reaching the services. According to GetServices request:
<env:Body>
<tds:GetServicesResponse>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/device/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/device_service</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/media/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/Media</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/events/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/Events</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver20/ptz/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/PTZ</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver20/imaging/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/Imaging</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver10/deviceIO/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/DeviceIO</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
<tds:Service>
<tds:Namespace>http://www.onvif.org/ver20/analytics/wsdl</tds:Namespace>
<tds:XAddr>http://IP/onvif/Analytics</tds:XAddr>
<tds:Version>
<tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tds:Version>
</tds:Service>
</tds:GetServicesResponse>
</env:Body>
You can have different services on different urls.
This has been seen on one of the HikVision cameras. Most of them uses the *http://IP/onvif/device_service*
.
回答5:
Actually via the WS-Discovery you could only get address of device service. The addresses of the other services you must get with DeviceService:GetServices request which works 100% with address you got before with WS-Discovery.
来源:https://stackoverflow.com/questions/3596868/onvif-how-to-form-the-device-web-service-address-from-the-ip-address-of-an-nvt