开发者

Using WSSE plugin for Gsoap in C++/Linux

开发者 https://www.devze.com 2023-03-14 07:18 出处:网络
How can we implement WSSE plugin for 开发者_如何转开发Gsoap in C++/Linux ? This link doesn\'t give all the information.

How can we implement WSSE plugin for 开发者_如何转开发Gsoap in C++/Linux ? 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 ?

Also ,if possible please provide working sample code(C++ only , no C plz) which implements wsse plugin?


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"
]

Then (assuming C++):

  1. run 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
  2. run soapcpp2 service.h
  3. compile the generated soapC.cpp, soapClient.cpp (if client), soapServer.cpp (if server), stdsoap2.cpp, dom.cpp, plugin/wsseapi.c, plugin/smdevp.c, plugin/mecevp.c
  4. when compiling the above, you must use -DWITH_OPENSSL -DWITH_DOM
  5. link against -lssl and -lcrypto
  6. to enable HTTP compression, compile with -DWITH_GZIP and link with -lz

When compiling in C, do all of the above but use wsdl2h option -c and use the .c files.

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.


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)

See also how-to section.

0

精彩评论

暂无评论...
验证码 换一张
取 消