0

Here is a target: build client app using N wsdl's and when some SOAP requests launched - add some specific SOAP:Header ( session tokens and client data as usual )

Here we got a few limitations:

  • Wsdl's provided by services cannot be modified
  • Generated gSOAP code also cannot be modified (IOW generated code contain dummy SOAP_ENV_Header )
  • Wsdl's provided by services DO NOT contain any headers definition ( and by the by it looks reasonable Adding SOAP implicit headers to WSDL )

So here is the question: How to add custom generated XML into SOAP:Header field in requests ?

ps. Frankly speaking I got one solution resolving this question via gsoap plugin's but I think its a bit "ugly-hacky" and really appreciate more beautiful and elegant solution

Community
  • 1
  • 1
armigero
  • 73
  • 6

1 Answers1

0

Ok, here is proper solution to do it:

Add #import "header.h" to typemap.dat:

      [
      #import "header.h"
      ]

The content of the SOAP_ENV__Header struct in header.h is user-defined, typically with members that are pointers and member names qualified:

struct SOAP_ENV__Header
{
   type *prefix__name;
};

If you want "arbitrary" headers, then use DOM:

#import "dom.h"
struct SOAP_ENV__Header
{
   xsd__anyType *dom;
};

when using DOM object in custom SOAP headers - don't forget to pass "-d" option in soapcpp2 execution - otherwise there will be compilation/linking problems.

armigero
  • 73
  • 6