Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using WSSE plugin for Gsoap in C++/Linux

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?

like image 553
Aditya Arora Avatar asked Jun 20 '11 12:06

Aditya Arora


1 Answers

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.

like image 146
Dr. Alex RE Avatar answered Oct 29 '22 10:10

Dr. Alex RE