Gsoap generationCode
Onvif compilation (win32)
Compile header files
Wsdl2h.exe-O onvif. H-C-s-t./typemap. dat
Http://www.onvif.org/onvif/ver10/network/wsdl/remotediscovery.wsdl...
Compile C files
Soapcpp2.exe-C-X-I ../; ../import; ../custom onvif. h
Required file
(File generation) soapclient. c soapc. c soaph. h soapstub. h
(Gsoap file) stdsoap2.c stdsoap2.h custom/duration. c custom/duratio. h
Modify namespace. C (implemented through nsmap)
The following are the options for wsdl2h:
- -O file name, specifying the output header file
- -N Space prefixes Replace the default NS
- -C: generate pure C code; otherwise, it is C ++ code.
- -S: Do not use STL code
- -T file name, specifying the type map file. The default value is typemap. dat.
- -E: Do not add a namespace prefix to an Enum member.
The type map file is used to specify the conversion rules between types in soap/XML and C/C ++. For example
XSD _ string = | STD: wstring | wchar_t *
Then, the string in soap/XML will be converted to STD: wstring or wchar_t * to better support Chinese characters.
Next we will talk about generating the. cpp file in the. h file.
The options for soapcpp2.exe are as follows:
- -C: only generate client code
- -S: only generate server code
- -L do not generate soapclientlib. C and soapserverlib. c files
- -C generates pure C code; otherwise, it is C ++ code (related to header files)
- -I specifies impORT path (see the preceding Section)
- -X: do not generate xml sample files.
- -I generates C ++ packaging. The client is xxxxproxy. H (. cpp), and the server side is xxxxservice. H (. cpp ).
Here, we usually need to include-X, or a lot of XML files will be generated.
-I option must be included, otherwise soapxxxxbindingservice. cpp and soapxxxxbindingservice. H files will not be generated.
-I options must also be included.-I is followed by the import directory in the gsoap path.
Generally-I E: \ workspace \ onvif \ gsoap-2.8 \ gsoap \ import; E: \ workspace \ onvif \ gsoap-2.8 \ gsoap
For example: soapcpp2.exe-X-I-s media. H-I E: \ workspace \ onvif \ gsoap-2.8 \ gsoap \ import; E: \ workspace \ onvif \ gsoap-2.8 \ gsoap