devicemgmt.wsdl 与发现过程无关,ONVIF 发现过程基于http://specs.xmlsoap.org/ws/2005/04/discovery,它使用 UDP 上的 SOAP。
如果您使用 apache-cxf,这可以通过使用来实现
org.apache.cxf.ws.discovery.WSDiscoveryClient
一个简单的示例代码可以是:
import java.util.List;
import javax.xml.ws.EndpointReference;
import org.apache.cxf.ws.discovery.WSDiscoveryClient;
public class Main
{
public static void main(String[] args)
{
WSDiscoveryClient client = new WSDiscoveryClient();
client.setVersion10(); // use WS-discovery 1.0
client.setDefaultProbeTimeout(1000); // timeout 1s
System.out.println("Probe:" + client.getAddress());
List<EndpointReference> references = client.probe();
System.out.println("Nb answsers:" + references.size());
for (EndpointReference ref : references)
{
System.out.println(ref.toString());
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7668 次 |
| 最近记录: |