【问题标题】:Can't compile gSOAP with WS-Security support (i.e. wsse-plugin)无法使用 WS-Security 支持编译 gSOAP(即 wsse-plugin)
【发布时间】:2012-05-16 10:32:41
【问题描述】:

在 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() 替换为 soap_in_xsd__duration(),它在 custom/duration.c 中实现

尽管如此,谁能给我提示这里出了什么问题?!提前致谢

【问题讨论】:

    标签: ws-security gsoap


    【解决方案1】:

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

    【讨论】:

    • 我没有明白你的意思,我已经包含了soapmyServiceProxy.h,而这又包含了soapH.h 那么,这应该如何帮助?
    • 对不起,我没有意识到,但在包括之后,您也会收到此错误,这意味着它需要处理头文件以及您调用方法的方式。当我开始使用 gsoap 2.8.8 时我遇到了类似的问题并且我能够修复它,所以如果你能提供一些你正在做的详细代码,我可以尝试修复它。我知道很难解决这些 gsoap 问题,我为此付出了很多努力。请提供详细代码,我会尽力帮助您弄清楚。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-17
    • 1970-01-01
    • 2013-08-06
    • 2016-09-21
    • 1970-01-01
    • 1970-01-01
    • 2012-08-07
    相关资源
    最近更新 更多