I wish to send some information like authentication token inside SOAP header. I am using gSOAP/c/Linux. Please help me how to pass?
My SOAP_ENV__Header
looks like
/* SOAP Header: */
struct SOAP_ENV__Header
{
struct ns3__Header *ns3__MyHeader; /* mustUnderstand */
};
and ns3__Header
looks like
/* ns3:Header */
struct ns3__Header
{
char *Value; /* optional element of type xsd:string */
};
Sorry for bothering everybody. I figured it out. I did it like:
soap_init(&mysoap);
mysoap.header = (SOAP_ENV__Header *)soap_malloc(&mysoap, sizeof(SOAP_ENV__Header));
mysoap.header->ns3__MyHeader = (ns3__Header*)malloc(sizeof(ns3__Header));
mysoap.header->ns3__MyHeader->Value = (char*)malloc(10 * sizeof(char));
strcpy(mysoap.header->ns3__MyHeader->Value, str);
But I had to suppress the MustUnderstand attribute like the following:
SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type)
{
if (soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type))
return soap->error;
//KNG
//soap->mustUnderstand = 1;
if (soap_out_PointerTons3__Header(soap, "ns3:MyHeader", -1, &a->ns3__MyHeader, ""))
return soap->error;
return soap_element_end_out(soap, tag);
}