onvif 客戶端發現
1、解壓:unzip -X gsoap_2.8.10.zip 編譯
2、下載:
wget http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl
3、複製:
cp gsoap-2.8/gsoap/typemap.dat .
4、在typemap.dat 中新增:
[cpp] view plaincopyprint?- #Use gSOAP 2.8.10 and up. In the typemap.dat file used by wsdl2h, add:
- # ONVIF recommended prefixes
- tds =
- tev = "http://www.onvif.org/ver10/events/wsdl"
- tls = "http://www.onvif.org/ver10/display/wsdl"
- tmd = "http://www.onvif.org/ver10/deviceIO/wsdl"
- timg = "http://www.onvif.org/ver20/imaging/wsdl"
- trt = "http://www.onvif.org/ver10/media/wsdl"
- tptz = "http://www.onvif.org/ver20/ptz/wsdl"
- trv = "http://www.onvif.org/ver10/receiver/wsdl"
- trc = "http://www.onvif.org/ver10/recording/wsdl"
- tse = "http://www.onvif.org/ver10/search/wsdl"
- trp = "http://www.onvif.org/ver10/replay/wsdl"
- tan = "http://www.onvif.org/ver20/analytics/wsdl"
- tad = "http://www.onvif.org/ver10/analyticsdevice/wsdl"
- tdn = "http://www.onvif.org/ver10/network/wsdl"
- tt = "http://www.onvif.org/ver10/schema"
- # OASIS recommended prefixes
- wsnt = "http://docs.oasis-open.org/wsn/b-2"
- wsntw = "http://docs.oasis-open.org/wsn/bw-2"
- wsrfbf = "http://docs.oasis-open.org/wsrf/bf-2"
- wsrfr = "http://docs.oasis-open.org/wsrf/r-2"
- wsrfrw = "http://docs.oasis-open.org/wsrf/rw-2"
- wstop = "http://docs.oasis-open.org/wsn/t-1"
- # WS-Discovery 1.0 remapping
- wsdd10__HelloType = | wsdd__HelloType
- wsdd10__ByeType = | wsdd__ByeType
- wsdd10__ProbeType = | wsdd__ProbeType
- wsdd10__ProbeMatchesType = | wsdd__ProbeMatchesType
- wsdd10__ProbeMatchType = | wsdd__ProbeMatchType
- wsdd10__ResolveType = | wsdd__ResolveType
- wsdd10__ResolveMatchesType = | wsdd__ResolveMatchesType
- wsdd10__ResolveMatchType = | wsdd__ResolveMatchType
- # SOAP-ENV mapping
- SOAP_ENV__Envelope = struct SOAP_ENV__Envelope { struct SOAP_ENV__Header *SOAP_ENV__Header; _XML SOAP_ENV__Body; }; | struct SOAP_ENV__Envelope
- SOAP_ENV__Header = | struct SOAP_ENV__Header
- SOAP_ENV__Fault = | struct SOAP_ENV__Fault
- SOAP_ENV__Detail = | struct SOAP_ENV__Detail
- SOAP_ENV__Code = | struct SOAP_ENV__Code
- SOAP_ENV__Subcode = | struct SOAP_ENV__Subcode
- SOAP_ENV__Reason = | struct SOAP_ENV__Reason
#Use gSOAP 2.8.10 and up. In the typemap.dat file used by wsdl2h, add:
# ONVIF recommended prefixes
tds = "http://www.onvif.org/ver10/device/wsdl"
tev = "http://www.onvif.org/ver10/events/wsdl"
tls = "http://www.onvif.org/ver10/display/wsdl"
tmd = "http://www.onvif.org/ver10/deviceIO/wsdl"
timg = "http://www.onvif.org/ver20/imaging/wsdl"
trt = "http://www.onvif.org/ver10/media/wsdl"
tptz = "http://www.onvif.org/ver20/ptz/wsdl"
trv = "http://www.onvif.org/ver10/receiver/wsdl"
trc = "http://www.onvif.org/ver10/recording/wsdl"
tse = "http://www.onvif.org/ver10/search/wsdl"
trp = "http://www.onvif.org/ver10/replay/wsdl"
tan = "http://www.onvif.org/ver20/analytics/wsdl"
tad = "http://www.onvif.org/ver10/analyticsdevice/wsdl"
tdn = "http://www.onvif.org/ver10/network/wsdl"
tt = "http://www.onvif.org/ver10/schema"
# OASIS recommended prefixes
wsnt = "http://docs.oasis-open.org/wsn/b-2"
wsntw = "http://docs.oasis-open.org/wsn/bw-2"
wsrfbf = "http://docs.oasis-open.org/wsrf/bf-2"
wsrfr = "http://docs.oasis-open.org/wsrf/r-2"
wsrfrw = "http://docs.oasis-open.org/wsrf/rw-2"
wstop = "http://docs.oasis-open.org/wsn/t-1"
# WS-Discovery 1.0 remapping
wsdd10__HelloType = | wsdd__HelloType
wsdd10__ByeType = | wsdd__ByeType
wsdd10__ProbeType = | wsdd__ProbeType
wsdd10__ProbeMatchesType = | wsdd__ProbeMatchesType
wsdd10__ProbeMatchType = | wsdd__ProbeMatchType
wsdd10__ResolveType = | wsdd__ResolveType
wsdd10__ResolveMatchesType = | wsdd__ResolveMatchesType
wsdd10__ResolveMatchType = | wsdd__ResolveMatchType
# SOAP-ENV mapping
SOAP_ENV__Envelope = struct SOAP_ENV__Envelope { struct SOAP_ENV__Header *SOAP_ENV__Header; _XML SOAP_ENV__Body; }; | struct SOAP_ENV__Envelope
SOAP_ENV__Header = | struct SOAP_ENV__Header
SOAP_ENV__Fault = | struct SOAP_ENV__Fault
SOAP_ENV__Detail = | struct SOAP_ENV__Detail
SOAP_ENV__Code = | struct SOAP_ENV__Code
SOAP_ENV__Subcode = | struct SOAP_ENV__Subcode
SOAP_ENV__Reason = | struct SOAP_ENV__Reason
5、把編譯好的wsdl2h,soapcpp2複製到本目錄6、./wsdl2h -o onvif.h -c -s -t typemap.dat remotediscovery.wsdl
7、./soapcpp2 -c onvif.h -x -I /workplace/mywork/onvif/gsoap-x86/gsoap-2.8/gsoap/import
8、複製檔案:
cp gsoap-2.8/gsoap/stdsoap2.* .
9、測試程式碼:
[cpp] view plaincopyprint?- #include <iostream>
- #include "wsdd.nsmap"
- #include "soapH.h"
- usingnamespace std;
- int main()
- {
- struct soap *soap;
- struct wsdd__ProbeType req;
- struct __wsdd__ProbeMatches resp;
- struct wsdd__ScopesType sScope;
- struct SOAP_ENV__Header header;
- int count = 0;
- int result = 0;
- char guid_string[100];
- soap = soap_new();
- if(soap==NULL)
- {
- return -1;
- }
- soap_set_namespaces(soap, namespaces);
- soap->recv_timeout = 5; //超過5秒鐘沒有資料就退出
- soap_default_SOAP_ENV__Header(soap, &header);
- header.wsa__MessageID = guid_string;
- header.wsa__To= "urn:schemas-xmlsoap-org:ws:2005:04:discovery";
- header.wsa__Action= "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe";
- soap->header = &header;
- soap_default_wsdd__ScopesType(soap, &sScope);
- sScope.__item = "";
- soap_default_wsdd__ProbeType(soap, &req);
- req.Scopes = &sScope;
- req.Types = "";
- result = soap_send___wsdd__Probe(soap, "soap.udp://239.255.255.250:3702", NULL, &req);
- do{
- result = soap_recv___wsdd__ProbeMatches(soap, &resp);
- if (soap->error)
- {
- cout<<"soap error:"<<soap->error<<soap_faultcode(soap)<<"---"<<soap_faultstring(soap)<<endl;
- result = soap->error;
- break;
- }
- else
- {
- cout<<"========================================="<<endl;
- cout<<"Match size:"<<resp.wsdd__ProbeMatches->__sizeProbeMatch<<endl;
- cout<<"xsd-unsignedInt:"<<resp.wsdd__ProbeMatches->ProbeMatch->MetadataVersion<<endl;
- cout<<"scopes item:"<<resp.wsdd__ProbeMatches->ProbeMatch->Scopes->__item<<endl;
- //cout<<"scopes matchby:"<<resp.wsdd__ProbeMatches->ProbeMatch->Scopes->MatchBy<<endl;
- cout<<"QName:"<<resp.wsdd__ProbeMatches->ProbeMatch->Types<<endl;
- cout<<"xsd:string:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.Address<<endl;
- cout<<"xsd:QName:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.PortType<<endl;
- cout<<"wsa:ServiceNameType:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.ServiceName<<endl;
- cout<<"sequence of elements:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.__size<<endl;
- cout<<"xsd:anyType:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.__anyAttribute<<endl;
- cout<<"endpoint any:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.__any<<endl;
- cout<<"wsdd:UriListType:"<<resp.wsdd__ProbeMatches->ProbeMatch->XAddrs<<endl;
- }
- }while(1);
- soap_destroy(soap); // remove deserialized class instances (C++ only)
- soap_end(soap); // clean up and remove deserialized data
- soap_done(soap);
- return result;
- }
#include <iostream>
#include "wsdd.nsmap"
#include "soapH.h"
using namespace std;
int main()
{
struct soap *soap;
struct wsdd__ProbeType req;
struct __wsdd__ProbeMatches resp;
struct wsdd__ScopesType sScope;
struct SOAP_ENV__Header header;
int count = 0;
int result = 0;
char guid_string[100];
soap = soap_new();
if(soap==NULL)
{
return -1;
}
soap_set_namespaces(soap, namespaces);
soap->recv_timeout = 5; //超過5秒鐘沒有資料就退出
soap_default_SOAP_ENV__Header(soap, &header);
header.wsa__MessageID = guid_string;
header.wsa__To= "urn:schemas-xmlsoap-org:ws:2005:04:discovery";
header.wsa__Action= "http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe";
soap->header = &header;
soap_default_wsdd__ScopesType(soap, &sScope);
sScope.__item = "";
soap_default_wsdd__ProbeType(soap, &req);
req.Scopes = &sScope;
req.Types = "";
result = soap_send___wsdd__Probe(soap, "soap.udp://239.255.255.250:3702", NULL, &req);
do{
result = soap_recv___wsdd__ProbeMatches(soap, &resp);
if (soap->error)
{
cout<<"soap error:"<<soap->error<<soap_faultcode(soap)<<"---"<<soap_faultstring(soap)<<endl;
result = soap->error;
break;
}
else
{
cout<<"========================================="<<endl;
cout<<"Match size:"<<resp.wsdd__ProbeMatches->__sizeProbeMatch<<endl;
cout<<"xsd-unsignedInt:"<<resp.wsdd__ProbeMatches->ProbeMatch->MetadataVersion<<endl;
cout<<"scopes item:"<<resp.wsdd__ProbeMatches->ProbeMatch->Scopes->__item<<endl;
//cout<<"scopes matchby:"<<resp.wsdd__ProbeMatches->ProbeMatch->Scopes->MatchBy<<endl;
cout<<"QName:"<<resp.wsdd__ProbeMatches->ProbeMatch->Types<<endl;
cout<<"xsd:string:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.Address<<endl;
cout<<"xsd:QName:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.PortType<<endl;
cout<<"wsa:ServiceNameType:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.ServiceName<<endl;
cout<<"sequence of elements:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.__size<<endl;
cout<<"xsd:anyType:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.__anyAttribute<<endl;
cout<<"endpoint any:"<<resp.wsdd__ProbeMatches->ProbeMatch->wsa__EndpointReference.__any<<endl;
cout<<"wsdd:UriListType:"<<resp.wsdd__ProbeMatches->ProbeMatch->XAddrs<<endl;
}
}while(1);
soap_destroy(soap); // remove deserialized class instances (C++ only)
soap_end(soap); // clean up and remove deserialized data
soap_done(soap);
return result;
}
編譯:g++ cc.cpp soapC.c stdsoap2.cpp soapClient.c -I/gsoap-2.8/gsoap
10、執行:./a.out
結果:
1、因為有多個ip(多個網絡卡)
[cpp] view plaincopyprint?- [email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$ ./a.out
- soap error:-10x8a29778---0x8a2977c
[email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$ ./a.out
soap error:-10x8a29778---0x8a2977c
2、只有一個網絡卡,且ip所在網段正好有兩個支援onvif的裝置: [cpp] view plaincopyprint?
- [email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$ ./a.out
- =========================================
- Match size:1
- xsd-unsignedInt:1
- scopes item:onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/ptz onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/DM368 onvif://www.onvif.org/location/country/china onvif://www.onvif.org/name/Dahua
- QName:tdn:NetworkVideoTransmitter
- xsd:string:urn:uuid:5b71c61f-220b-475d-9eca-dd7941f07767
- xsd:QName:0
- wsa:ServiceNameType:0
- sequence of elements:0
- xsd:anyType:
- endpoint any:0
- wsdd:UriListType:http://192.168.9.110:9988/onvif/device_service
- soap error:-10x87a99f8---0x87a99fc
- [email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$
- [email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$
- [email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$ ./a.out
- =========================================
- Match size:1
- xsd-unsignedInt:1
- scopes item:onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/ptz onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/DM368 onvif://www.onvif.org/location/country/china onvif://www.onvif.org/name/Dahua
- QName:tdn:NetworkVideoTransmitter
- xsd:string:urn:uuid:5b71c61f-220b-475d-9eca-dd7941f07767
- xsd:QName:0
- wsa:ServiceNameType:0
- sequence of elements:0
- xsd:anyType:
- endpoint any:0
- wsdd:UriListType:http://192.168.9.110:9988/onvif/device_service
- soap error:-10x86929f8---0x86929fc
[email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$ ./a.out
=========================================
Match size:1
xsd-unsignedInt:1
scopes item:onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/ptz onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/DM368 onvif://www.onvif.org/location/country/china onvif://www.onvif.org/name/Dahua
QName:tdn:NetworkVideoTransmitter
xsd:string:urn:uuid:5b71c61f-220b-475d-9eca-dd7941f07767
xsd:QName:0
wsa:ServiceNameType:0
sequence of elements:0
xsd:anyType:
endpoint any:0
wsdd:UriListType:http://192.168.9.110:9988/onvif/device_service
soap error:-10x87a99f8---0x87a99fc
[email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$
[email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$
[email protected]:/workplace/mywork/onvif/gsoap-x86/mytest/myonvif/test$ ./a.out
=========================================
Match size:1
xsd-unsignedInt:1
scopes item:onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/ptz onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/type/network_video_transmitter onvif://www.onvif.org/hardware/DM368 onvif://www.onvif.org/location/country/china onvif://www.onvif.org/name/Dahua
QName:tdn:NetworkVideoTransmitter
xsd:string:urn:uuid:5b71c61f-220b-475d-9eca-dd7941f07767
xsd:QName:0
wsa:ServiceNameType:0
sequence of elements:0
xsd:anyType:
endpoint any:0
wsdd:UriListType:http://192.168.9.110:9988/onvif/device_service
soap error:-10x86929f8---0x86929fc
參考:
http://my.oschina.net/yunuo/blog/119206
http://blog.csdn.net/ghostyu/article/details/8182516
相關推薦
onvif 客戶端發現
1、解壓:unzip -X gsoap_2.8.10.zip 編譯 2、下載: wget http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl 3、複製: cp gsoap-2.8/gsoap/typemap.dat . 4、在
Webservice報錯客戶端發現響應內容類型為“application/json;charset=UTF-8”,但應為“text/xml”。
san 有關 棧跟蹤 手動 cat mil not soap con 控制臺對接Webservice正常,同樣的方法在Web項目上報錯: 客戶端發現響應內容類型為“application/json;charset=UTF-8”,但應為“
onvif開發之利用gSOAP生成onvif客戶端程式碼框架
cd gsoap-2.8 ./configure make sudo make install 命令列模式下敲入命令:wsdl2h -V 檢視gSOAP軟體版本,有版本出現則安裝成功。 2. 利用gSOAP生成onvif客戶端程式碼框架 2.1 在當前目錄下
onvif客戶端對接大華IPC出現錯誤分析。
前段時間除錯onvif客戶端的時候出現了一個奇怪的問題,手頭有大華和海康的IPC各一個,海康的IPC使用onvif與待測試的onvif客戶端完美測試通過。但是在用大華裝置測試onvif客戶端的時候出現了一些奇怪的問題。這兩個奇怪的問題糾結了我2-3天,經過一段時間的努力終於
Onvif客戶端出現“SOAP 1.2 fault: SOAP-ENV:Sender [no subcode]”錯誤解釋
用Onvif test tool測試自己寫的Onvif client時,Probe收到此資訊: SOAP 1.2 fault: SOAP-ENV:Sender [no subcode] "Stopped: no response sent or received (info
onvif客戶端
nap str c_str digest image 找到 ref 完成 earch 前言 做開發有8年時間了,ffmpeg和onvif與我是特別有緣的了(說著玩的,我更認為是因為他們確實強大^_^)。 ffmpeg在畢業設計時就有用到,5年後做windows、linux播
Onvif客戶端與伺服器通訊時鑑權的自實現
OnvifDigest.h /** SHA1 digest size in octets */ #define SOAP_SMD_SHA1_SIZE (20) /** Size of the random nonce */ #define SOAP_WSSE_NONCELEN (20) #define
soap工具生成onvif客戶端
新年開始,回到公司第一件事情就是處理年前沒有弄完的onvif客戶端;按照計劃,使用soap包直接生成onvif客戶端程式碼;經過若干次整理測試,最終整理了一個簡單的指令碼和一段示例程式碼。做技術的人是苦逼的人,希望看到這篇文章的人不要像我一樣,折騰那麼久;下面就說一說我的操
kubernetes Service:讓客戶端發現pod並與之通訊
5.1.Service介紹 5.1.1.Serice簡介 5.1.1.1什麼是Service service是k8s中的一個重要概念,主要是提供負載均衡和服務自動發現。 Service 是由 kube-proxy 元件,加上 iptables 來共同實現的。 5.1.1.2.Service的
Spring Cloud官方文檔中文版-服務發現:Eureka客戶端
auth locate inter attr context 本地緩存 數據集 god ati 官方文檔地址為:http://cloud.spring.io/spring-cloud-static/Brixton.SR7/#_spring_cloud_netflix 文中例
使用shell腳本一鍵安裝zabbix並配置客戶端的自動發現選項
監控 shell zabbix 自動註冊 zabbix_agent 1.緣由: 我自己的ESXi服務器上上最近新加了好多虛擬主機,但我現在還不會安裝,使用,那種批量運維工具(saltstack,ansible,puppet等)。雖然還有一種方法:就是通過shell工具一次打開
SCOM 2016 之 發現客戶端
scom2016 發現客戶端 operations manager 前面的三篇文章向大家詳細介紹了SCOM2016 的部署過程,今天就來和大家分享一下 SCOM 2016的一些基礎功能操作步驟,希望對大家有幫助。關於SCOM 2016的功能,我們的第一篇部署文章已經說了,其實SCOM就是一個管理和
zabbix自動發現和註冊agent客戶端
zabbix自動發現 zabbix 1、創建自動發現規則2、查看是否發現主機3、創建自動發現的動作4、檢查主機有沒有自動添加成功zabbix自動發現和註冊agent客戶端
深入淺出高性能服務發現、配置框架Nacos系列 3: 服務發現:Nacos客戶端初始化流程
tor trim 如何 try 文件的 client 註冊 rgs erro 上一章節,我們從全局了解了一下Nacos項目的模塊架構,做到了心中有數,現在,我們去逐步去挖掘裏面的代碼細節,很多人在學習開源的時候,無從下手,代碼那麽多,從哪個地方開始看呢?我們可以從一個接口開
zabbix 4.0 客戶端服務器自動註冊和自動發現配置
proc sha auto dbd mar test ext -o zabb 一.Discovery 此種方法是由服務器端發起的,對服務端性能消耗大。 把內網地址寫進去 創建actions ?選擇Discovery創建自動發發現Linux的Actions,自動添加到指定
zookeeper開源客戶端Curator典型應用場景之-服務註冊與發現(十一)
隨著業務增加,以前簡單的系統已經變得越來越複雜,單純的提升伺服器效能也不是辦法,而且程式碼也是越來越龐大,維護也變得越來越困難,這一切都催生了新的架構設計風格 – 微服務架構的出現。 微服務給我們帶來了很多好處,例如:獨立可擴充套件、易維護。但是隨著應用的分解
Spring Cloud 服務發現與註冊(Eureka)- 客戶端
一、環境說明: spring:2.1.0.RELEASE maven:3.5.3 JDK:1.8 IDE:IntelliJ IDEA 2018.2 二、實現步驟 a:新建專案:File->New->Project... b、填寫專案資訊: G
《Spring Cloud Netflix官方文件》1.服務發現:Eureka客戶端
原文連結 譯者:Acamy 1. 服務發現:Eureka客戶端 服務發現是微服務架構的關鍵原則之一。使用手動配置或一些約定方式來處理多服務多例項的方式是非常困難,並且十分脆弱的。Eureka同時是Netflix服務發現的服務端和客戶端。服務端可以通過配置和部署實現高可用,實現方式是每個
Spring系列學習之Spring Cloud Netflix微服務發現容錯及路由客戶端負載均衡
英文原文:https://spring.io/projects/spring-cloud-netflix 目錄 概述 特性 入門 快速開始 學習 文件 示例 概述 Spring Cloud Netflix通過自動配置和Spring環境以及其他Spring程
ONVIF協議網路攝像機(IPC)客戶端程式開發(7):裝置搜尋
1 專欄導讀 本專欄第一篇文章「專欄開篇」列出了專欄的完整目錄,按目錄順序閱讀,有助於你的理解,專欄前面文章講過的知識點(或程式碼段),後面文章不會贅述。為了節省篇幅,突出重點,在文章中展示的示例程式碼僅僅是關鍵程式碼,你可以在「專欄開篇」中獲取完整程式碼。