gsoap使用小结

参考博文:

http://www.cnblogs.com/linxr/archive/2011/10/17/2215285.html


要点一:

wsdl2h(利用wsdl文件生成对应的h文件)用法

**  The gSOAP WSDL parser for C and C++ 1.2.9c
**  Copyright (C) 2000-2007 Robert van Engelen, Genivia Inc.
**  All Rights Reserved. This product is provided "as is", without any warranty.

**  The gSOAP WSDL parser is released under one of the following two licenses:
**  GPL or the commercial license by Genivia Inc. Use option -l for more info.

Usage: wsdl2h [-a] [-c] [-d] [-e] [-f] [-g] [-h] [-I path] [-j] [-l] [-m] [-n na
me] [-N name] [-p] [-q name] [-r proxyhost:port] [-s] [-t typemapfile.dat] [-u]
[-v] [-w] [-x] [-y] [-z] [-o outfile.h] infile.wsdl infile.xsd http://www... ...


<<<<<<
-o 文件名,指定输出头文件
-n 名空间前缀代替默认的ns
-c 产生纯C代码,否则是C++代码
-s 不要使用STL代码   ?
-t 文件名,指定type map文件,默认为typemap.dat  ?  
-e 禁止为enum成员加上名空间前缀 
<<<<<<

-a      generate indexed struct names for local elements with anonymous types
-c      generate C source code
-d      use DOM to populate xs:any and xsd:anyType elements
-e      don't qualify enum names
-f       generate flat C++ class hierarchy
-g      generate global top-level element declarations
-h      display help info
-Ipath  use path to find files
-j      don't generate SOAP_ENV__Header and SOAP_ENV__Detail definitions
-l      include license information in output
-m    use xsd.h module to import primitive types
-n name  use name as the base namespace prefix instead of 'ns'
-N name  use name as the base namespace prefix for service namespaces
-o file  output to file
-p     create polymorphic types with C++ inheritance with base xsd__anyType
-q name  use name for the C++ namespace for all service declarations
-rhost:port
        connect via proxy host and port
-s      don't generate STL code (no std::string and no std::vector)
-tfile  use type map file instead of the default file typemap.dat
-u      don't generate unions
-v      verbose output
-w      always wrap response parameters in a response struct (<=1.1.4 behavior)
-x      don't generate _XML any/anyAttribute extensibility elements
-y      generate typedef synonyms for structs and enums
-z      generate pointer-based arrays for backward compatibility < gSOAP 2.7.6e
infile.wsdl infile.xsd http://www... list of input sources (if none: use stdin)


要点二:

soapcpp2(利用1中生成的h文件生成对应的cpp文件)用法
Usage: soapcpp2 [-1|-2] [-C|-S] [-L] [-a] [-c] [-d path] [-e] [-h] [-i] [-I path
;path;...] [-l] [-m] [-n] [-p name] [-s] [-t] [-v] [-w] [-x] [infile]

-1      generate SOAP 1.1 bindings
-2      generate SOAP 1.2 bindings
-C      generate client-side code only
-S      generate server-side code only
-L      don't generate soapClientLib/soapServerLib
-a      use value of SOAPAction HTTP header to dispatch method at server side
-c      generate C source code
-dpath  use path to save files
-e      generate SOAP RPC encoding style bindings
-h      display help info
-i      generate service proxies and objects inherited from soap struct
-Ipath  use path(s) for #import
-l      generate linkable modules (experimental)
-m      generate Matlab(tm) code for MEX compiler
-n      use service name to rename service functions and namespace table
-pname  save files with new prefix name instead of 'soap'
-s      generate deserialization code with strict XML validation checks
-t      generate code for fully xsi:type typed SOAP/XML messaging
-v      display version info
-w      don't generate WSDL and schema files
-x      don't generate sample XML message files
infile  header file to parse (or stdin)


要点三:

gsoap生成c/c++代理时候需要指定协议编码,比如:

MyFirstSQLServSoap11BindingProxy Proxy(SOAP_C_UTFSTRING);

你可能感兴趣的:(gsoap使用小结)