Linux下gsoap生成onvif客户端代码
- 准备工作
- 编译gsoap
- 生成onvif头文件
- 生成源文件
准备工作
1、下载gsoap,地址:https://sourceforge.net/projects/gsoap2/
2、安装openssl,命令
复制代码
1
2apt install openssl libssl-dev
3、安装编译过程依赖库
复制代码
1
2apt install bison flex byacc
编译gsoap
复制代码
1
2
3
4
5cd /root/gsoap-2.8 ./configure --prefix=/root/onvif/ make make install
编译成功后,会在/root/onvif生成gsoap目录
生成onvif头文件
复制代码
1
2
3cd /root/onvif cp ./gsoap/share/gsoap/WS/typemap.dat .
修改typemap.dat,讲下面一行注释去掉
复制代码
1
2xsd__duration = #import "custom/duration.h" | xsd__duration
C代码
复制代码
1
2./gsoap/bin/wsdl2h -o onvif.h -P -x -c -s -t ./typemap.dat http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl http://www.onvif.org/onvif/ver10/deviceio.wsdl http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl http://www.onvif.org/ver20/ptz/wsdl/ptz.wsdl
C++代码
复制代码
1
2./gsoap/bin/wsdl2h -o onvif.h -P -x -c++ -s -t ./typemap.dat http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl http://www.onvif.org/onvif/ver10/media/wsdl/media.wsdl http://www.onvif.org/onvif/ver10/deviceio.wsdl http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl http://www.onvif.org/ver20/ptz/wsdl/ptz.wsdl
在onvif开头加入
复制代码
1
2#import "wsse.h"
生成源文件
C代码
复制代码
1
2./gsoap/bin/soapcpp2 -2 -x -L -C -c -d . onvif.h -I/root/gsoap-2.8/gsoap/ -I /root/gsoap-2.8/gsoap/import/ -I /root/gsoap-2.8/gsoap/plugin -I/root/gsoap-2.8/gsoap/custom
C++代码
复制代码
1
2./gsoap/bin/soapcpp2 -2 -x -L -C -c++ -d . onvif.h -I/root/gsoap-2.8/gsoap/ -I /root/gsoap-2.8/gsoap/import/ -I /root/gsoap-2.8/gsoap/plugin -I/root/gsoap-2.8/gsoap/custom
成功后,将在/root/onvif下生成 .c .cpp 和 .h文件,另外还有 .nsmap文件,几个 .nsmap内容相同,另外需要拷贝以下一些依赖代码
C代码
复制代码
1
2
3cd /root/gsoap-2.8/gsoap cp stdsoap2.c stdsoap2.h dom.c plugin/wsaapi.c plugin/wsaapi.h plugin/wsseapi.c plugin/wsseapi.h plugin/mecevp.c plugin/mecevp.h plugin/smdevp.c plugin/smdevp.h plugin/threads.c plugin/threads.h custom/duration.c custom/duration.h custom/struct_timeval.c custom/struct_timeval.h /root/onvif/
C++代码
复制代码
1
2
3cd /root/gsoap-2.8/gsoap cp stdsoap2.cpp stdsoap2.h dom.cpp plugin/wsaapi.c plugin/wsaapi.h plugin/wsseapi.cpp plugin/wsseapi.h plugin/mecevp.c plugin/mecevp.h plugin/smdevp.c plugin/smdevp.h plugin/threads.c plugin/threads.h custom/duration.c custom/duration.h custom/struct_timeval.c custom/struct_timeval.h /root/onvif/
目前C代码编译会报错,尚未解决
复制代码
1
2
3
4
5
6
7
8
9
10
11
12../onvif/libonvif.a(dom.o): In function `soap_serialize_xsd__anyType(soap*, soap_dom_element const*)': /root/publicmediaserver/src/onvif/dom.c:157: undefined reference to `soap_markelement' ../onvif/libonvif.a(dom.o): In function `out_element(soap*, soap_dom_element const*, char const*, char const*)': /root/publicmediaserver/src/onvif/dom.c:274: undefined reference to `soap_putelement' ../onvif/libonvif.a(dom.o): In function `soap_in_xsd__anyType(soap*, char const*, soap_dom_element*, char const*)': /root/publicmediaserver/src/onvif/dom.c:664: undefined reference to `soap_getelement' ../onvif/libonvif.a(dom.o): In function `soap_dup_xsd__anyType(soap*, soap_dom_element*, soap_dom_element const*)': /root/publicmediaserver/src/onvif/dom.c:838: undefined reference to `soap_dupelement' ../onvif/libonvif.a(dom.o): In function `soap_del_xsd__anyType(soap_dom_element const*)': /root/publicmediaserver/src/onvif/dom.c:881: undefined reference to `soap_delelement' collect2: error: ld returned 1 exit status
最后
以上就是飘逸鸭子最近收集整理的关于Ubuntu下gsoap编译onvif代码准备工作编译gsoap生成onvif头文件生成源文件的全部内容,更多相关Ubuntu下gsoap编译onvif代码准备工作编译gsoap生成onvif头文件生成源文件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复