Unicode C
Unicode C
SOAP Request to fseservicetest.sanita.finanze.it with Basic Authentication
See more HTTP Misc Examples
Demonstrates sending a SOAP request to fseservicetest.sanita.finanze.it with Basic Authentication.Chilkat Unicode C Downloads
#include <C_CkHttpW.h>
#include <C_CkXmlW.h>
#include <C_CkHttpRequestW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
BOOL success;
HCkHttpW http;
HCkXmlW xml;
const wchar_t *soapEnvelope;
const wchar_t *domain;
const wchar_t *path;
HCkHttpRequestW req;
HCkHttpResponseW resp;
HCkXmlW xmlResp;
success = FALSE;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
xml = CkXmlW_Create();
success = FALSE;
// Create the SOAP envelope...
CkXmlW_putTag(xml,L"soapenv:Envelope");
CkXmlW_AddAttribute(xml,L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
CkXmlW_AddAttribute(xml,L"xmlns:stat",L"http://statoconsensirichiesta.xsd.fse.ini.finanze.it");
CkXmlW_AddAttribute(xml,L"xmlns:tip",L"http://tipodatistatoconsensi.xsd.fse.ini.finanze.it");
CkXmlW_UpdateChildContent(xml,L"soapenv:Header",L"");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente",L"XXXXXXAAABBBCCC");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode",L"...");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione",L"999");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente",L"123456789");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente",L"ZZZ");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo",L"");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore",L"");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico",L"true");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita",L"READ");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso",L"ABCDEFGHIJKLM");
soapEnvelope = CkXmlW_getXml(xml);
domain = L"fseservicetest.sanita.finanze.it";
path = L"/FseInsServicesWeb/services/fseStatoConsensi";
req = CkHttpRequestW_Create();
CkHttpRequestW_putHttpVerb(req,L"POST");
CkHttpRequestW_putSendCharset(req,FALSE);
CkHttpRequestW_AddHeader(req,L"Content-Type",L"application/soap+xml; charset=utf-8");
CkHttpRequestW_putPath(req,path);
success = CkHttpRequestW_LoadBodyFromString(req,soapEnvelope,L"utf-8");
// User name and Password for Basic Authentication
CkHttpW_putLogin(http,L"XXXXXXAAABBBCCC");
CkHttpW_putPassword(http,L"MYPASSWORD");
resp = CkHttpResponseW_Create();
success = CkHttpW_HttpSReq(http,domain,443,TRUE,req,resp);
if (success == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkXmlW_Dispose(xml);
CkHttpRequestW_Dispose(req);
CkHttpResponseW_Dispose(resp);
return;
}
xmlResp = CkXmlW_Create();
success = CkXmlW_LoadXml(xmlResp,CkHttpResponseW_bodyStr(resp));
wprintf(L"%s\n",CkXmlW_getXml(xmlResp));
CkHttpW_Dispose(http);
CkXmlW_Dispose(xml);
CkHttpRequestW_Dispose(req);
CkHttpResponseW_Dispose(resp);
CkXmlW_Dispose(xmlResp);
}