这篇文章采用中英文混合了,不再对官网英文做翻译了,中间加入了我用中文写的自己补充的内容。
Make sure that you have Flex and Bison installed to build the soapccp2 tool:
sudo apt-get install flex bison
If you run into trouble installing Flex or Bison, then see the next section.
You may want to install OpenSSL to enable HTTPS for gSOAP clients and servers:
sudo apt-get install libssl-dev
接下来,想进行下面的操作,需要把下载的软件包解压到 home 文件夹,然后进入此文件夹。在我的机器上,我在 home 文件夹下执行
cd gsoap-2.8
这还不行,需要把文件 configure 属性设成可执行文件,不然的话后面的安装无法进行。命令如下:
sudo chmod 777 configure
接下来,按照官网介绍继续执行就行了。如此看来,官网的安装步骤说明,写的也是马马虎虎的,新手很难理解。
If you run into trouble installing OpenSSL, then see further below how to disable OpenSSL support in gSOAP.
Install the gSOAP software on Unix/Linux systems as follows:
下面的命令一句一句来,不要全部复制粘贴到 linux 命令终端窗口里去。另外,make 命令需要执行一小会,要耐心等待完成。软件包安装过程总起来还是很顺利的。
./configure
make
sudo make install
For the last step we use admin (root) permissions using sudo. To install the executables in a local folder, say in $HOME/bin without requiring root access, use:
./configure
make
sudo make install exec_prefix=$HOME
The ./configure command takes the following configuration options:
--enable-samplesalso builds the examples--enable-ipv6builds the library with IPv6 support (with compiler option-DWITH_IPV6)--enable-ipv6-v6onlybuilds the library with IPv6 support without remapping IPv4 to IPv6 (with compiler option-DWITH_IPV6_V6ONLY)--disable-sslremoves all dependences on OpenSSL from the tools and libraries--enable-gnutlsreplaces the dependence on OpenSSL by GNU TLS (with compiler option-DWITH_GNUTLS)--enable-debugbuilds the software (with compiler option-DDEBUG) to produce audit logs (slow, not recommended for production)--disable-namespacesremoves global namespaces table linkage requirement (recommended for experts only)--disable-c-localeremoves the C locale and locale_t type that is internally used to override the local locale (the C locale is needed for proper use of decimal point in float values)--enable-xlocaleforces the inclusion of xlocale.h to define the locale_t type, which is useful if the build fails due to an undefinedlocale_ttype--with-openssl=DIRspecifies the OpenSSL installation directory--with-zlib=DIR specifies the Zlib installation directory
After successful configuration and completion of the build steps, the following two tools are produced:gsoap/bin/wsdl2htranslator of WSDL/XSD to services and XML data bindings (interface tool)gsoap/bin/soapcpp2code generator for services and XML data bindings (implementation tool)
The following libraries are produced depending on the configuration options:gsoap/libgsoap++.athe C++ runtime engine (plain, no HTTPS)gsoap/libgsoapssl++.athe C++ runtime engine with DOM support, cookies, zlib, and SSLgsoap/libgsoap.athe C runtime engine (plain, no HTTPS)gsoap/libgsoapssl.athe C runtime engine with DOM support, cookies, zlib, and SSL
If you got these files, you are now ready to use gSOAP.
If the above fails, then please verify that you have:- Automake tools installed (make and GNU m4)
- Bison installed from www.gnu.org/software/bison or Yacc
- Flex installed from GitHub
- OpenSSL from www.openssl.org or GNUTLS from www.gnu.org/software/gnutls or you must disable SSL with
./configure --disable-ssl, see below - Optionally Zlib to support compression from www.zlib.net.
To build the tools and libraries without SSL/TLS (i.e. removing HTTPS support and WS-Security support from wsdl2h and the libraries), rerun:
./configure --disable-ssl
make
sudo make install
For the last step use admin (root) permissions (e.g. using sudo) or use exec_prefix to install locally (see above).
To pass compile-time flags to make, such as -DWITH_NO_C_LOCALE:
make CFLAGS="-DWITH_NO_C_LOCALE" CXXFLAG="-DWITH_NO_C_LOCALE"
where CFLAGS applies to compiling C applications and CXXFLAGS applies to compiling C++ applications.
If you are having trouble with automake, Bison, or Flex then see the additional instructions below.
我检查了一下,发现可执行的命令文件安装到了目录 /usr/local/bin,其中有两个很关键的命令文件
gSoap开发包的下载地址http://sourceforge.net/projects/gsoap2,在bin目录下提供了两个工具:
1:wsdl2h:利用WSDL和XML schemas生成包含WS属性和操作的C++风格gSoap头文件。
2:soapcpp2:编译头文件并生成xml等文件。其中,soapH.h and soapC.cpp包含了数据类型的描述,soapClient.cpp给客户端使用,soapServer.cpp给服务端使用。
通过官方给出的介绍可知,wsdl2h用作wsdl和.h文件的转换。soapcpp2用头文件生成客户端/服务端等开发需要的h和cpp文件。下面是官方给出的一个例子:

本文详细指导如何在Unix/Linux系统上安装gSOAP,涉及Flex, Bison, OpenSSL和gSOAP配置选项,包括--enable-ssl、--disable-ssl等,重点在于解决常见安装难题并生成wsdl2h和soapcpp2工具。
901

被折叠的 条评论
为什么被折叠?



