2

在 linux 系统上,我想使用 gSOAP-2.8.8 创建一个客户端应用程序,该应用程序与基于 WCF 的 SOAP 服务交互。因此,我经历了以下几点:

wsdl2h -t typemap.dat -o myService.h myService.wsdl    
soapcpp2 -Igsoap/import -CLix myService.h

并将 wsseapi.h 中的 '#include soapH.h' 替换为 wsseapi.h 中提到的 soapcpp2 生成的 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_ns4__duration()替换为在 custom/duration.c 中实现的soap_in_xsd__duration()

不过,谁能给我一个提示这里出了什么问题?!提前致谢

4

1 回答 1

1

您必须在您编写的主文件中包含“soapH.h”文件。

于 2012-05-22T13:32:33.063 回答