[英]Using WSSE plugin for Gsoap in C++/Linux
How can we implement WSSE plugin for Gsoap in C++/Linux ? 我们如何在C ++ / Linux中为Gsoap实现WSSE插件? This link doesn't give all the information. 此链接不提供所有信息。
The problem is what do I have to include in my header file generated by WSDL , to make it wsse compatible so that soapcpp2 header.h generates sufficient code so that I can compile wsseapi.c successfully ? 问题是我必须包含在我的WSDL生成的头文件中,使它与wsse兼容,以便soapcpp2 header.h生成足够的代码,以便我可以成功编译wsseapi.c?
Also ,if possible please provide working sample code(C++ only , no C plz) which implements wsse plugin? 另外,如果可能的话请提供实现wsse插件的工作示例代码(仅限C ++,没有C plz)?
To automatically add an #import "wsse.h"
to the wsdl2h-generated header file if it is not already there (wsdl2h detects WS-Security requirements with WS-Policy), then first modify typemap.dat
to include these three lines: 要自动将#import "wsse.h"
添加到wsdl2h生成的头文件(如果它尚未存在(wsdl2h使用WS-Policy检测WS-Security要求)),则首先修改typemap.dat
以包含以下三行:
[
#import "wsse.h"
]
Then (assuming C++): 然后(假设是C ++):
wsdl2h -Iimport -o service.h <your-wsdls-xsds-etc>
and make sure wsdl2h uses the modified typemap.dat
(if it is in the current dir you are OK) and the import option points to the gsoap import
directory with wsse.h
运行wsdl2h -Iimport -o service.h <your-wsdls-xsds-etc>
并确保wsdl2h使用修改后的typemap.dat
(如果它在当前dir中你没问题)并且import选项指向gsoap import
目录用wsse.h
soapcpp2 service.h
运行soapcpp2 service.h
soapC.cpp
, soapClient.cpp
(if client), soapServer.cpp
(if server), stdsoap2.cpp
, dom.cpp
, plugin/wsseapi.c
, plugin/smdevp.c
, plugin/mecevp.c
编译生成的soapC.cpp
, soapClient.cpp
(如果客户端), soapServer.cpp
(如果服务器), stdsoap2.cpp
, dom.cpp
, plugin/wsseapi.c
, plugin/smdevp.c
, plugin/mecevp.c
-DWITH_OPENSSL
-DWITH_DOM
在编译上面的内容时,必须使用-DWITH_OPENSSL
-DWITH_DOM
-lssl
and -lcrypto
链接-lssl
和-lcrypto
-DWITH_GZIP
and link with -lz
启用HTTP压缩,与编译-DWITH_GZIP
和链路与-lz
When compiling in C, do all of the above but use wsdl2h option -c
and use the .c files. 在C中编译时,请执行以上所有操作,但使用wsdl2h选项-c
并使用.c文件。
See the WSSE documentation and also the gsoap/samples/wssedemo
example in the gsoap package, which shows the API calls to use WS-Security in several possible ways, tells you how to register the plugin etc. 请参阅WSSE文档以及gsoap包中的gsoap/samples/wssedemo
示例,该示例显示了以几种可能的方式使用WS-Security的API调用,告诉您如何注册插件等。
what do I have to include in my header file 我需要在头文件中包含什么内容
#import "wsse.h"
(See comments in the header file, or the generated documentation for part starting " Policy Enablers of Binding ") (请参阅头文件中的注释,或者部分启动“ 绑定策略启动器”的生成文档)
Update: Copy & Paste from generated documentation: 更新:从生成的文档中复制和粘贴:
WS-Security (SOAP Message Security) 1.0 (accepts 1.1):
#import "wsse.h" // to be added to this header file for the soapcpp2 build step
#include "plugin/wsseapi.h"
soap_register_plugin(soap, soap_wsse); // register the wsse plugin in your code
// See the user guide gsoap/doc/wsse/html/index.html
(this can be found in generated doxygen documentation for your bindings) (这可以在为绑定生成的doxygen文档中找到)
See also how-to section . 另请参见操作方法部分 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.