I am new to SOAP and am trying to implement user authentication, i kindly request some help,
Here is the XML request sent from client
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tt="http://www.onvif.org/ver10/schema"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
<soapenv:Header>
<wsse:Security>
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-token-profile-
1.0#PasswordDigest">tuOSpGlFlIXsozq4HFNeeGeFLEI=</wsse:Password>
<wsse:Nonce>LKqI6G/AikKCQrN0zqZFlg==</wsse:Nonce>
<wsu:Created>2010-09-16T07:50:45Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<tds:SetHostname>
<tds:Name>camera1</tds:Name>
</tds:SetHostname>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
and I want to access that username
sent in this XML request
In the Soap generated SoapServer.c it has a function named
`SOAP_FMAC5 int SOAP_FMAC6 soap_serve___tds__SetHostname(struct soap *soap)
the below function is where the parsing of xml to SOAP structure take places,
`
SOAP_FMAC5 int SOAP_FMAC6 soap_serve___tds__SetHostname(struct soap *soap) {
struct __tds__SetHostname soap_tmp___tds__SetHostname;
struct _tds__SetHostnameResponse tds__SetHostnameResponse;
soap_default__tds__SetHostnameResponse(soap, &tds__SetHostnameResponse);
soap_default___tds__SetHostname(soap, &soap_tmp___tds__SetHostname);
soap->encodingStyle = NULL;
if (!soap_get___tds__SetHostname(soap, &soap_tmp___tds__SetHostname, "-tds:SetHostname", NULL))
return soap->error;
if (soap_body_end_in(soap)
|| soap_envelope_end_in(soap)
|| soap_end_recv(soap))
return soap->error;
soap->error = __tds__SetHostname(soap, soap_tmp___tds__SetHostname.tds__SetHostname, &tds__SetHostnameResponse);
if (soap->error)
return soap->error;
soap_serializeheader(soap);
soap_serialize__tds__SetHostnameResponse(soap, &tds__SetHostnameResponse);
if (soap_begin_count(soap))
return soap->error;
if (soap->mode & SOAP_IO_LENGTH)
{ if (soap_envelope_begin_out(soap)
|| soap_putheader(soap)
|| soap_body_begin_out(soap)
|| soap_put__tds__SetHostnameResponse(soap, &tds__SetHostnameResponse, "tds:SetHostnameResponse", NULL)
|| soap_body_end_out(soap)
|| soap_envelope_end_out(soap))
return soap->error;
};
if (soap_end_count(soap)
|| soap_response(soap, SOAP_OK)
|| soap_envelope_begin_out(soap)
|| soap_putheader(soap)
|| soap_body_begin_out(soap)
|| soap_put__tds__SetHostnameResponse(soap, &tds__SetHostnameResponse, "tds:SetHostnameResponse", NULL)
|| soap_body_end_out(soap)
|| soap_envelope_end_out(soap)
|| soap_end_send(soap))
return soap->error;
return soap_closesock(soap);
}
` so tried to access/print the username in this method (Starting off with the basic access as of now)
fprintf(stderr,"%s\n",soap->header->wsse__Security->UsernameToken->Username);
But this prints some junk value everytime,accessing of the Username by pointings to structures is also perfectly correct, it would be help full if some one give some pointers as to how to access the SOAP header.