ONVIF : How to form the device web service address from the IP address of an NVT

元气小坏坏 提交于 2019-12-04 08:31:18
Şafak

According to the official document (section 5.1.1), you can access the service at http://<IP address>/onvif/device_service

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

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.

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*.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!