views:

645

answers:

1

Hello All,

I need to add WS Addressing in my Soap header (I am using the gsoap framework). Is there a way to add that automatically? I looked up gsoap documentation but didnt find any info on that. So right now I have manually added the WS-Addressing to my SOAP_ENV_Header as shown below

struct SOAP_ENV__Header
{
   mustUnderstand _wsa__MessageID wsa__MessageID 0;
   mustUnderstand _wsa__RelatesTo *wsa__RelatesTo 0;
   mustUnderstand _wsa__From *wsa__From 0;
   mustUnderstand _wsa__ReplyTo *wsa__ReplyTo 0;
   mustUnderstand _wsa__FaultTo *wsa__FaultTo 0;
   mustUnderstand _wsa__To wsa__To 0;
   mustUnderstand _wsa__Action wsa__Action 0;
};

But I would like to generate it automatically since I have to add some other structs to the Soap Header which are autogenerated from my wsdl/xsd files.

Thanks

A: 

You can define the SOAP_ENV_Header in your typemap.dat like so:

wsa = <http://schemas.xmlsoap.org/ws/2004/08/addressing&gt;

SOAP_ENV__Header =\
#import "wsa.h"\n\
struct SOAP_ENV__Header\n\
{\n\
   mustUnderstand _wsa__MessageID    wsa__MessageID 0;\n\
   mustUnderstand _wsa__RelatesTo *  wsa__RelatesTo 0;\n\
   mustUnderstand _wsa__From *       wsa__From      0;\n\
   mustUnderstand _wsa__ReplyTo *    wsa__ReplyTo   0;\n\
   mustUnderstand _wsa__FaultTo *    wsa__FaultTo   0;\n\
   mustUnderstand _wsa__To           wsa__To        0;\n\
   mustUnderstand _wsa__Action       wsa__Action    0;\n\
};

Then use wsdl2h with option "-t " to specify an external typemap.dat.

AndersO