/usr/local/gsoap-2.8/gsoap/wsdl/wsdl2h -s -o calc.h http://www.cs.fsu.edu/~engelen/calc.wsdl
/usr/local/gsoap-2.8/gsoap/src/soapcpp2 -cL -I/usr/local/gsoap-2.8/gsoap/import:/uar/local/gsoap-2.8/gsoap calc.h
********************************************************************************************
cc -o calcserver calcserver.c soapC.c soapServer.c ../../../gsoap/stdsoap2.c -lm
cc -o calcclient calcclient.c soapC.c soapClient.c ../../../gsoap/stdsoap2.c -lm
**********************************************************************************************
上面两句可以用下面两句替换
*******************************************************************************************
cc -o calcclient calcclient.c soapC.c soapClient.c ../../../gsoap/libgsoap.a -lm
cc -o calcserver calcserver.c soapC.c soapServer.c ../../../gsoap/libgsoap.a -lm
***************************************************************************************************
头文件不是自己手写的,而是通过工具生成的
wsdl2h -s -o calc.h http://www.cs.fsu.edu/~engelen/calc.wsdl
******************************************************************************************
/usr/local/gsoap-2.8/gsoap/wsdl/wsdl2h -s -o calc.h http://www.cs.fsu.edu/~engelen/calc.wsdl
产生一个calc.h头文件
生成框架:
soapcpp2 -c calc.h
***********************************************************
事实证明,必须用这样的语句生成代码,不能简单地使用soapcpp2 -c
************************************************************
/usr/local/gsoap-2.8/gsoap/src/soapcpp2 -cL -I/usr/local/gsoap-2.8/gsoap/import:/uar/local/gsoap-2.8/gsoap calc.h
Compilation successful
***********************************************************
功能和soapcpp2 -c calc.h一样
**********************************************************
*******************************************************************
** The gSOAP code generator for C and C++, soapcpp2 release 2.8.30
** Copyright (C) 2000-2016, Robert van Engelen, Genivia Inc.
** All Rights Reserved. This product is provided "as is", without any warranty.
** The soapcpp2 tool and its generated software are released under the GPL.
** ----------------------------------------------------------------------------
** A commercial use license is available from Genivia Inc., contact@genivia.com
** ----------------------------------------------------------------------------
**********************************************************************
** The gSOAP Stub and Skeleton Compiler for C and C++ 2.7.9l
** Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc.
** All Rights Reserved. This product is provided "as is", without any warranty.
** The gSOAP compiler is released under one of the following three licenses:
** GPL, the gSOAP public license, or the commercial license by Genivia Inc.
***********************************************************************
make
gcc -DLINUX -g -O2 -o calcclient calcclient.o soapClient.o soapC.o ../../../gsoap/libgsoap.a -lm
gcc -DLINUX -g -O2 -o calcserver calcserver.o soapServer.o soapC.o ../../../gsoap/libgsoap.a ../../../gsoap/libgsoapck.a ../../../gsoap/libgsoapssl.a -lm
makefile没写出来
2016、4、19
soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_byte);
soap_embed(struct soap *soap, const void *p, const void *a, int n, int type);
depbase=`echo calcclient.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../gsoap -I../../../gsoap/plugin -DLINUX -g -O2 -MT calcclient.o -MD -MP -MF $depbase.Tpo -c -o calcclient.o calcclient.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo soapClient.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../gsoap -I../../../gsoap/plugin -DLINUX -g -O2 -MT soapClient.o -MD -MP -MF $depbase.Tpo -c -o soapClient.o soapClient.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo soapC.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../gsoap -I../../../gsoap/plugin -DLINUX -g -O2 -MT soapC.o -MD -MP -MF $depbase.Tpo -c -o soapC.o soapC.c &&\
mv -f $depbase.Tpo $depbase.Po
gcc -DLINUX -g -O2 -o calcclient calcclient.o soapClient.o soapC.o ../../../gsoap/libgsoap.a -lm
depbase=`echo calcserver.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../gsoap -I../../../gsoap/plugin -DLINUX -g -O2 -MT calcserver.o -MD -MP -MF $depbase.Tpo -c -o calcserver.o calcserver.c &&\
mv -f $depbase.Tpo $depbase.Po
depbase=`echo soapServer.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DHAVE_CONFIG_H -I. -I../../.. -I../../../gsoap -I../../../gsoap/plugin -DLINUX -g -O2 -MT soapServer.o -MD -MP -MF $depbase.Tpo -c -o soapServer.o soapServer.c &&\
mv -f $depbase.Tpo $depbase.Po
gcc -DLINUX -g -O2 -o calcserver calcserver.o soapServer.o soapC.o ../../../gsoap/libgsoap.a -lm -lm
soapServer.o: In function `soap_serve_ns2__add':
soapServer.c:(.text+0x2a6): undefined reference to `ns2__add'
soapServer.o: In function `soap_serve_ns2(short, bool __restrict)':
soapServer.c:(.text+0x533): undefined reference to `ns2(short, bool __restrict)'
soapServer.o: In function `soap_serve_ns2__mul':
soapServer.c:(.text+0x7c0): undefined reference to `ns2__mul'
soapServer.o: In function `soap_serve_ns2(double, int, void)':
soapServer.c:(.text+0xa4d): undefined reference to `ns2(double, int, void)'
soapServer.o: In function `soap_serve_ns2__pow':
soapServer.c:(.text+0xcda): undefined reference to `ns2__pow'
GSOAP_ROOT = ../../../gsoap
S_OBJ = calcserver.o soapC.o soapServer.o
calcserver:${S_OBJ}
gcc -g -o -I${GSAOP_ROOT} calcserver ${S_OBJ}
soapC.0:soapH.h soapStub.h stdsoap2.h
soapServer.o:soapH.h soapStub.h stdsoap2.h calc.h calc.nsmap
calcserver.o:soapH.h calc.nsmap soapStub.h stdsoap2.h
cc -c -o calcserver.o calcserver.c
cc -c -o soapC.o soapC.c
gcc -M -c -o calcserver.o calcserver.c
gcc -M -c -o soapC.o soapC.c
gcc -M -c -o soapServer.o soapServer.c
*****************************************************************************
这一步没问题,问题出在.o文件的生成
gcc -g -o calcserver calcserver.o soapServer.o soapC.o ../../../gsoap/libgsoap.a -lm -lm
the soapdefs.h header file
>c++ -DWITH_SOAPDEFS_H -c stdsoap2.cpp