gSOAP + onvif Compilation

Source: Internet
Author: User
Tags wsdl

/*********************************************gsoap onvif client Function Development *********************************************** *****************************************/

1. Compile SSL, where the installation directory will be used by gSOAP compile
See line 17

2.gsoap
Unzip Gsoap_2.8.34.zip
./configure--with-openssl=/home/llf/x86/openssl-install (This is the OpenSSL installation directory) If you are arm, you also need to--host=
Make
sudo make install

3. Gsoap/import/wsa5.h Logoff 277 line int Soap_env__fault definition

4. Modify Gsoap/typemap.dat
Use gSOAP 2.8.10 or greater. The Typemap.dat file is used by wsdl2h, and the add the following if not already there:

# 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

4.onvif.h generation
Copy Typedamp.dat to the directory where the command is located
Wsdl2h-p-x-t./typemap.dat-o onvif.h http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl/http WWW.ONVIF.ORG/ONVIF/VER10/EVENTS/WSDL/EVENT.WSDL http://www.onvif.org/onvif/ver10/display.wsdl/HTTP WWW.ONVIF.ORG/ONVIF/VER10/DEVICEIO.WSDL http://www.onvif.org/onvif/ver20/imaging/wsdl/imaging.wsdl/HTTP WWW.ONVIF.ORG/ONVIF/VER10/MEDIA/WSDL/MEDIA.WSDL http://www.onvif.org/onvif/ver20/ptz/wsdl/ptz.wsdl/HTTP WWW.ONVIF.ORG/ONVIF/VER10/RECEIVER.WSDL http://www.onvif.org/onvif/ver10/recording.wsdl http://www.onvif.org/ ONVIF/VER10/SEARCH.WSDL http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl http://www.onvif.org/ onvif/ver10/replay.wsdl
Note that the specifications is substantial in size. Option Wsdl2h-p removes unnecessary class hierarchy dependences on the root type Xsd__anytype. This option would reduce the code size. Option Wsdl2h-x Removes extensibility elements (Xsd:anyattribute attributes and Xsd:any elements). If attribute and element extensions to a complexType is needed, then use the Typemap.dat file to add these as additional Optional. For example, to extend Tt__audiodecoderconfigurationoptionsextension ComplexType class with an element Address of type TT: IPAddress, then add to Typemap.dat:
Tt__audiodecoderconfigurationoptionsextension = $ tt__ipaddress Address;

Add #import "Wsse.h" in 5.onvif.h

6. Generate gSOAP Skeleton code
Soapcpp2-2-l-x-i-ed-f100-d. /.. /onvifgen-i. /.. /gsoap/import:.. /.. /gsoap onvif.h
Note:-f100 generates multiple SOAP files, each with n serializer definitions. If this option is not added, the generated soapC.cpp file is 16M large and the compilation will die
Note: Option soapcpp2-2 forces SOAP 1.2, which is required by ONVIF. In some cases the WSDL2H conversion could not detect SOAP 1.2 and therefore we recommend this option.
Compile the soapcpp2-generated code together with CUSTOM/DURATION.C.
If ws-discovery is used (e.g. with ONVIF Remotediscovery), also include plugin/wsddapi.h in your code and compile plugin/w SDDAPI.C (see ws-discovery documentation.
If It appears that multiple service operations is generated with the same name, such as GetServices and Getservices_ then Remove http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl from the command line list of URLs because this WSDL is already imported by another WSDL.

7. Logout of the generated soapStub.h #define SOAP_WSA_2005

8. Compiling your own program
Need to add SSL header file location-i/home/llf/x86/openssl-install/include and library file location-l/home/llf/x86/openssl-install/lib/

9.g++ compile-time-lgsoapssl++-lssl-lcrypto-lz-lpthread must be placed at the end, and must be in this order, not to the front of-O. Otherwise, the link will be reported undedined reference ....

This article is from the "Software Technology" blog, please make sure to keep this source http://danielllf.blog.51cto.com/2442311/1872518

gSOAP + onvif Compilation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.