在linux系统上,我想使用gSOAP-2.8.8创建一个客户端应用程序,该应用程序与WCF上的SOAP服务构建进行交互。因此,我经历了以下几点:
wsdl2h -t typemap.dat -o myService.h myService.wsdl
soapcpp2 -Igsoap/import -CLix myService.h
用wsseapi.h中提到的soapcpp2生成的soapH.h替换wsseapi.h中的'#include soapH.h'
然后,关键步骤是手动将以下行添加到myService.h
#import "wsse.h"
struct SOAP_ENV__Header"
{
mustUnderstand // must be understood by receiver
_wsse__Security *wsse__Security; ///< TODO: Check element type (imported type)
};
...并编译这些文件,如
g++ -DWITH_DOM -DWITH_OPENSSL -Igsoap -Igsoap/import -Igsoap/plugin -o test \
myService.cpp soapC.cpp soapmyServiceProxy.cpp gsoap/stdsoap2.cpp gsoap/dom.cpp \
gsoap/custom/duration.c gsoap/plugin/wsseapi.cpp gsoap/plugin/smdevp.c gsoap/plugin/mecevp.c \
-L/usr/lib -lssl -lcrypt
我确实得到了所有来源的目标文件;-)但在链接阶段仍然有两个错误。
soapC.cpp:203: undefined reference to `soap_in_ns4__duration(soap*, char const*, long long*, char const*)'
soapC.cpp:676: undefined reference to `soap_in_ns4__duration(soap*, char const*, long long*, char const*)'
编辑:作为一种解决方法,我目前用 soap_in_xsd__duration()替换 soap_in_ns4__duration(),这是在custom / duration.c中实现的。
然而,任何人都可以给我一个提示,这里出了什么问题?!提前致谢
答案 0 :(得分:1)
您必须在您编写的主文件中包含“soapH.h”文件。