发现期间未找到Onvif设备(摄像头)

时间:2014-11-28 11:16:01

标签: web-services cxf onvif

我正在开发Camera固件以支持ONVIF规范(使用Java)。我正在使用Apache CXF来运行服务。我已导入remotediscovery.wsdldevicemngmt.wsdl并为其创建了服务。

我确定服务正在运行并绑定到SOAP UDP:

Starting Server
[Fatal Error] addressing:2:2: The markup in the document following the root element must be well-formed.
28.11.2014 16:01:12 org.apache.cxf.service.factory.ReflectionServiceFactoryBean isEmptywsdl
28.11.2014 16:01:12 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://www.onvif.org/ver10/network/wsdl}DiscoveryService from class org.onvif.ver10.network.wsdl.DiscoveryLookupPort
28.11.2014 16:01:13 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://localhost:8080/onvif/device_service
28.11.2014 16:01:13 org.eclipse.jetty.server.Server doStart
INFO: jetty-8.1.15.v20140411
28.11.2014 16:01:13 org.eclipse.jetty.server.AbstractConnector doStart
INFO: Started SelectChannelConnector@localhost:8080
28.11.2014 16:01:13 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}Discovery from WSDL: classpath:/org/apache/cxf/ws/discovery/wsdl/wsdd-discovery-1.1-wsdl-os.wsdl
28.11.2014 16:01:13 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be soap.udp://239.255.255.250:3702
28.11.2014 16:01:13 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}DiscoveryProxy from class org.apache.cxf.jaxws.support.DummyImpl
Starting Server
28.11.2014 16:01:31 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://www.onvif.org/ver10/device/wsdl}DeviceService from WSDL: /tmp/wsdl/devicemgmt.wsdl
28.11.2014 16:01:51 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://localhost:8080/onvif/DeviceService/device
Starting Server
[Fatal Error] addressing:2:2: The markup in the document following the root element must be well-formed.
28.11.2014 16:01:58 org.apache.cxf.service.factory.ReflectionServiceFactoryBean isEmptywsdl
28.11.2014 16:01:58 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
INFO: Creating Service {http://www.onvif.org/ver10/network/wsdl}DiscoveryService from class org.onvif.ver10.network.wsdl.RemoteDiscoveryPort
28.11.2014 16:01:58 org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be http://localhost:8080/service/DiscoveryService/discovery
Server ready...

我使用CXF WSDiscoveryClient对其进行了测试,可以找到它们:

16 clients found
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><EndpointReference xmlns="http://www.w3.org/2005/08/addressing"><Address>http://localhost:8080/onvif/device_service</Address><ReferenceParameters/></EndpointReference>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><EndpointReference xmlns="http://www.w3.org/2005/08/addressing"><Address>http://localhost:8080/onvif/DeviceService/device</Address><ReferenceParameters/></EndpointReference>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><EndpointReference xmlns="http://www.w3.org/2005/08/addressing"><Address>http://localhost:8080/service/DiscoveryService/discovery</Address><ReferenceParameters/></EndpointReference>
...

但我看不到我的设备使用的是SmartICRSS或任何ONVIF客户端。

怎么了?我希望通过WS-Discovery发现我的设备,然后我希望客户端调用probe方法。我有断点并且没有被调用。

PS。我已经安装了网络流量拦截器应用程序,发现生成IPCameras响应ProbeMatches响应(在soap body中)和CXF的impl没有回复。如何使用ProbeMatches进行CXF服务回复?

1 个答案:

答案 0 :(得分:2)

WS-Discovery不是ONVIF,它是XML SOAP WS-Discovery

http://specs.xmlsoap.org/ws/2005/04/discovery/ws-discovery.pdf

并且,您必须使用的版本:April2005 version11

请参考 https://code.google.com/p/java-ws-discovery/