我是媒体流媒体新手。 我项目中的一个模块包括来自ONVIF设备的实时流媒体。 我找到了几个关于ONVIF直播的教程。 我从onvif官方网站下载了wsdl文件。并从wsdl生成源代码(我使用的是netbeans IDE)。 并配置了onvif设备。 现在我有一个onvif设备的IP地址和生成的WS。 我对这个ws与设备的集成非常困惑。 如何使用这些WS连接到设备?
试验的代码如下
URL url = new URL("file://"+System.getProperty("user.home")+"/Desktop/devicemgmt.wsdl"); Service service = Service.create(url, qname); Device device = service.getPort(Device.class); System.out.println("device : "+device); ((BindingProvider) device).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + camIp + "/onvif/device_service"); Holder<String> manufacturer = new Holder<String>(); Holder<String> model = new Holder<String>(); Holder<String> firmwareVersion = new Holder<String>(); Holder<String> serialNumber = new Holder<String>(); Holder<String> hardwareId = new Holder<String>(); device.getDeviceInformation(manufacturer, model, firmwareVersion, serialNumber, hardwareId);尝试运行时,会发生给定的异常
run:device : Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown: Stub for http://192.168.2.22/onvif/device_service Exception in thread "main" com.sun.xml.ws.protocol.soap.VersionMismatchException: Couldn't create SOAP message. Expecting Envelope in namespace http://www.w3.org/2003/05/soap-envelope, but got http://schemas.xmlsoap.org/soap/envelope/ at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:198) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:328) at com.sun.xml.ws.encoding.StreamSOAP12Codec.decode(StreamSOAP12Codec.java:102) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:149) at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:361) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:279) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:228) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143) at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:139) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:961) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775) at com.sun.xml.ws.client.Stub.process(Stub.java:429) at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:168) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151) at com.sun.proxy.$Proxy44.getDeviceInformation(Unknown Source) at devicetest.OnvifTest.main(OnvifTest.java:52) Java Result: 1 BUILD SUCCESSFUL (total time: 17 seconds) System.out.println(manufacturer.value); System.out.println(model.value); System.out.println(firmwareVersion.value); System.out.println(serialNumber.value); System.out.println(hardwareId.value);谢谢你的任何建议。
I am new to media streaming. One of the modules in my project includes live streaming from ONVIF devices. I have found several tutorials regarding ONVIF live streaming. I downloaded the wsdl files from the onvif official site.And generated source code from wsdl(i'm using netbeans IDE). And configured the onvif device. Now I have an IPAddress of the onvif device and the generated WS. I am very confused about the integration of this ws with device. How can I connect to the device using these WS?
The code have tried is given below
URL url = new URL("file://"+System.getProperty("user.home")+"/Desktop/devicemgmt.wsdl"); Service service = Service.create(url, qname); Device device = service.getPort(Device.class); System.out.println("device : "+device); ((BindingProvider) device).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + camIp + "/onvif/device_service"); Holder<String> manufacturer = new Holder<String>(); Holder<String> model = new Holder<String>(); Holder<String> firmwareVersion = new Holder<String>(); Holder<String> serialNumber = new Holder<String>(); Holder<String> hardwareId = new Holder<String>(); device.getDeviceInformation(manufacturer, model, firmwareVersion, serialNumber, hardwareId);When trying to run, the given exception occurs
run:device : Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown: Stub for http://192.168.2.22/onvif/device_service Exception in thread "main" com.sun.xml.ws.protocol.soap.VersionMismatchException: Couldn't create SOAP message. Expecting Envelope in namespace http://www.w3.org/2003/05/soap-envelope, but got http://schemas.xmlsoap.org/soap/envelope/ at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:198) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:328) at com.sun.xml.ws.encoding.StreamSOAP12Codec.decode(StreamSOAP12Codec.java:102) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:149) at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:361) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:279) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:228) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143) at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:139) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:961) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775) at com.sun.xml.ws.client.Stub.process(Stub.java:429) at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:168) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151) at com.sun.proxy.$Proxy44.getDeviceInformation(Unknown Source) at devicetest.OnvifTest.main(OnvifTest.java:52) Java Result: 1 BUILD SUCCESSFUL (total time: 17 seconds) System.out.println(manufacturer.value); System.out.println(model.value); System.out.println(firmwareVersion.value); System.out.println(serialNumber.value); System.out.println(hardwareId.value);Thanks for any suggestion.
最满意答案
谢谢大家。 最后我找到了解决方案。 错误是由于我的设备和soap版本的版本不匹配。 我通过更改wsdl中的架构信封URL解决了这个问题。
Thanks to all. Finally I found a solution. The error was due to the version mismatch b/w my device and soap version. I resolved the issue by changing the schema envelope url in the wsdl.
使用java进行ONVIF设备集成(ONVIF device integration using java)我是媒体流媒体新手。 我项目中的一个模块包括来自ONVIF设备的实时流媒体。 我找到了几个关于ONVIF直播的教程。 我从onvif官方网站下载了wsdl文件。并从wsdl生成源代码(我使用的是netbeans IDE)。 并配置了onvif设备。 现在我有一个onvif设备的IP地址和生成的WS。 我对这个ws与设备的集成非常困惑。 如何使用这些WS连接到设备?
试验的代码如下
URL url = new URL("file://"+System.getProperty("user.home")+"/Desktop/devicemgmt.wsdl"); Service service = Service.create(url, qname); Device device = service.getPort(Device.class); System.out.println("device : "+device); ((BindingProvider) device).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + camIp + "/onvif/device_service"); Holder<String> manufacturer = new Holder<String>(); Holder<String> model = new Holder<String>(); Holder<String> firmwareVersion = new Holder<String>(); Holder<String> serialNumber = new Holder<String>(); Holder<String> hardwareId = new Holder<String>(); device.getDeviceInformation(manufacturer, model, firmwareVersion, serialNumber, hardwareId);尝试运行时,会发生给定的异常
run:device : Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown: Stub for http://192.168.2.22/onvif/device_service Exception in thread "main" com.sun.xml.ws.protocol.soap.VersionMismatchException: Couldn't create SOAP message. Expecting Envelope in namespace http://www.w3.org/2003/05/soap-envelope, but got http://schemas.xmlsoap.org/soap/envelope/ at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:198) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:328) at com.sun.xml.ws.encoding.StreamSOAP12Codec.decode(StreamSOAP12Codec.java:102) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:149) at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:361) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:279) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:228) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143) at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:139) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:961) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775) at com.sun.xml.ws.client.Stub.process(Stub.java:429) at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:168) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151) at com.sun.proxy.$Proxy44.getDeviceInformation(Unknown Source) at devicetest.OnvifTest.main(OnvifTest.java:52) Java Result: 1 BUILD SUCCESSFUL (total time: 17 seconds) System.out.println(manufacturer.value); System.out.println(model.value); System.out.println(firmwareVersion.value); System.out.println(serialNumber.value); System.out.println(hardwareId.value);谢谢你的任何建议。
I am new to media streaming. One of the modules in my project includes live streaming from ONVIF devices. I have found several tutorials regarding ONVIF live streaming. I downloaded the wsdl files from the onvif official site.And generated source code from wsdl(i'm using netbeans IDE). And configured the onvif device. Now I have an IPAddress of the onvif device and the generated WS. I am very confused about the integration of this ws with device. How can I connect to the device using these WS?
The code have tried is given below
URL url = new URL("file://"+System.getProperty("user.home")+"/Desktop/devicemgmt.wsdl"); Service service = Service.create(url, qname); Device device = service.getPort(Device.class); System.out.println("device : "+device); ((BindingProvider) device).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + camIp + "/onvif/device_service"); Holder<String> manufacturer = new Holder<String>(); Holder<String> model = new Holder<String>(); Holder<String> firmwareVersion = new Holder<String>(); Holder<String> serialNumber = new Holder<String>(); Holder<String> hardwareId = new Holder<String>(); device.getDeviceInformation(manufacturer, model, firmwareVersion, serialNumber, hardwareId);When trying to run, the given exception occurs
run:device : Metro/2.2.0-1 (tags/2.2.0u1-7139; 2012-06-02T10:55:19+0000) JAXWS-RI/2.2.6-2 JAXWS/2.2 svn-revision#unknown: Stub for http://192.168.2.22/onvif/device_service Exception in thread "main" com.sun.xml.ws.protocol.soap.VersionMismatchException: Couldn't create SOAP message. Expecting Envelope in namespace http://www.w3.org/2003/05/soap-envelope, but got http://schemas.xmlsoap.org/soap/envelope/ at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:198) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:328) at com.sun.xml.ws.encoding.StreamSOAP12Codec.decode(StreamSOAP12Codec.java:102) at com.sun.xml.ws.encoding.StreamSOAPCodec.decode(StreamSOAPCodec.java:149) at com.sun.xml.ws.encoding.SOAPBindingCodec.decode(SOAPBindingCodec.java:361) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:279) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:228) at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143) at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:139) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:961) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:910) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:873) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:775) at com.sun.xml.ws.client.Stub.process(Stub.java:429) at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:168) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:151) at com.sun.proxy.$Proxy44.getDeviceInformation(Unknown Source) at devicetest.OnvifTest.main(OnvifTest.java:52) Java Result: 1 BUILD SUCCESSFUL (total time: 17 seconds) System.out.println(manufacturer.value); System.out.println(model.value); System.out.println(firmwareVersion.value); System.out.println(serialNumber.value); System.out.println(hardwareId.value);Thanks for any suggestion.
最满意答案
谢谢大家。 最后我找到了解决方案。 错误是由于我的设备和soap版本的版本不匹配。 我通过更改wsdl中的架构信封URL解决了这个问题。
Thanks to all. Finally I found a solution. The error was due to the version mismatch b/w my device and soap version. I resolved the issue by changing the schema envelope url in the wsdl.
发布评论