Using WSSE plugin for Gsoap in C++/Linux
Asked Answered
D

2

8

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?

Disguise answered 20/6, 2011 at 12:47 Comment(0)
P
5

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.

Pettifog answered 4/2, 2016 at 15:17 Comment(0)
C
-1

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.

Cathern answered 1/7, 2013 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.