一、移植
1、下载源码
http://sourceforge.net/projects/gsoap2/files/
本例下载最新版本为:gsoap_2.8.33.zip
2、解压源码
$ unzip gsoap_2.8.33.zip
3、平台准备unbuntu1204
$sudo apt-get install build-essential
$sudo apt-get install libgtk2.0-dev libglib2.0-dev
$sudo apt-get install checkinstall
$sudo apt-get install flex bison
$sudo apt-get install openssl
$sudo apt-cache search libssl | grep SSL
$sudo apt-get install libssl-dev
4、编译x86 平台下工具
$ ./configure --prefix=/usr/local/gsopa-x86
$ make
$ make install
$ export PATH=/usr/local/gSOAP-x86/bin:$PATH
5、编译arm平台工具
./configure --prefix=/usr/local/gsopa-arm --host=arm-linux
再次配置源码,这次配置目标平台变为arm-linux
修改源码,根据编译错误提示进行适当修改:
修改源码目录下的config.h
注释掉:
#define malloc rpl_malloc
soapcpp和wsdl2h在编译过程中会生成同事这两个工具也在编译时会被用来生成一些特定的文件,所以如果soapcpp和wsdl2h如果被编译成arm架构则无法在PC上执行,也就意味着接下的编译无法完成,所以这里选择不编译这两个文件,而选择使用上节编译所生产的x86架构的对应文件。
修改gsoap/src/Makefile
注释掉
soapcpp2$(EXEEXT): $(soapcpp2_OBJECTS) $(soapcpp2_DEPENDENCIES) $(EXTRA_soapcpp2_DEPENDENCIES)
@rm -f soapcpp2$(EXEEXT)
$(AM_V_CCLD)$(soapcpp2_LINK) $(soapcpp2_OBJECTS) $(soapcpp2_LDADD) $(LIBS)
修改gsoap/wsdl/Makefile
wsdl2h$(EXEEXT): $(wsdl2h_OBJECTS) $(wsdl2h_DEPENDENCIES) $(EXTRA_wsdl2h_DEPENDENCIES)
@rm -f wsdl2h$(EXEEXT)
$(AM_V_CXXLD)$(wsdl2h_LINK) $(wsdl2h_OBJECTS) $(wsdl2h_LDADD) $(LIBS)
拷贝x86架构下的soapcpp和wsdl2h到工程源码目录下:
$ cp /home/linux/gsoap/gsoap-x86/bin/soapcpp2 /home/linux/gsoap/gsoap-2.8/gsoap/src/
$ cp /home/linux/gsoap/gsoap-x86/bin/wsdl2h /home/linux/gsoap/gsoap-2.8/gsoap/wsdl/
编译
$ make
安装
$ make install
二 程序
1、代码
add.h
点击(此处)折叠或打开
//gsoapopt cw
//gsoap ns2 schema namespace: urn:add
//gsoap ns2 schemaform: unqualified
//gsoap ns