Using the WSSE plugin for Gsoap in C ++ / Linux

How can we implement the WSSE plugin for Gsoap in C ++ / Linux? This link does not provide all information.

The problem is that I need to include in my header file generated by WSDL to make it compatible with wsse, so that soapcpp2 header.h generates enough code to successfully compile wsseapi.c?

In addition, if possible, specify a working code example (only C ++, no C PLZ) that the wsse plugin implements?

+7
source share
2 answers

To automatically add #import "wsse.h" to the header file created by wsdl2h, if it does not already exist (wsdl2h detects WS-Security requirements with WS-Policy), first modify typemap.dat to include these three lines:

 [ #import "wsse.h" ] 

Then (assuming C ++):

  • 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 directory where OK is located) and the import option points to the gsoap import directory from wsse.h
  • run soapcpp2 service.h
  • compile the generated soapC.cpp , soapClient.cpp (if the client), soapServer.cpp (if the server), stdsoap2.cpp , dom.cpp , plugin/wsseapi.c , plugin/smdevp.c , plugin/mecevp.c
  • when compiling the above, you should use -DWITH_OPENSSL -DWITH_DOM
  • link to -lssl and -lcrypto
  • to enable HTTP compression, compile with -DWITH_GZIP and associate with -lz

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

See the WSSE documentation, as well as the gsoap/samples/wssedemo in the gsoap package, which shows API calls for using WS-Security in several possible ways, tells you how to register a plugin, etc.

+3
source

what do i need to include in the header file

 #import "wsse.h" 

(See comments in the header file or generated documentation for the part starting with "Policy Enablers of Binding")

Update: Copy and paste from the 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 the generated oxygen documentation for your bindings)

See also .

-one
source

All Articles