Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Unicode C) SOAP Request to fseservicetest.sanita.finanze.it with Basic AuthenticationDemonstrates sending a SOAP request to fseservicetest.sanita.finanze.it with Basic Authentication.
#include <C_CkHttpW.h> #include <C_CkXmlW.h> #include <C_CkHttpRequestW.h> #include <C_CkHttpResponseW.h> void ChilkatSample(void) { HCkHttpW http; HCkXmlW xml; BOOL success; const wchar_t *soapEnvelope; const wchar_t *domain; const wchar_t *path; HCkHttpRequestW req; HCkHttpResponseW resp; HCkXmlW xmlResp; // 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 = CkHttpW_SynchronousRequest(http,domain,443,TRUE,req); if (CkHttpW_getLastMethodSuccess(http) == FALSE) { wprintf(L"%s\n",CkHttpW_lastErrorText(http)); CkHttpW_Dispose(http); CkXmlW_Dispose(xml); CkHttpRequestW_Dispose(req); return; } xmlResp = CkXmlW_Create(); success = CkXmlW_LoadXml(xmlResp,CkHttpResponseW_bodyStr(resp)); wprintf(L"%s\n",CkXmlW_getXml(xmlResp)); CkHttpResponseW_Dispose(resp); CkHttpW_Dispose(http); CkXmlW_Dispose(xml); CkHttpRequestW_Dispose(req); CkXmlW_Dispose(xmlResp); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.