Sample code for 30+ languages & platforms
Delphi DLL

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 Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Http, HttpRequest, HttpResponse, Xml;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
http: HCkHttp;
xml: HCkXml;
soapEnvelope: PWideChar;
domain: PWideChar;
path: PWideChar;
req: HCkHttpRequest;
resp: HCkHttpResponse;
xmlResp: HCkXml;

begin
success := False;

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

http := CkHttp_Create();
xml := CkXml_Create();

success := False;

// Create the SOAP envelope...
CkXml_putTag(xml,'soapenv:Envelope');
CkXml_AddAttribute(xml,'xmlns:soapenv','http://schemas.xmlsoap.org/soap/envelope/');
CkXml_AddAttribute(xml,'xmlns:stat','http://statoconsensirichiesta.xsd.fse.ini.finanze.it');
CkXml_AddAttribute(xml,'xmlns:tip','http://tipodatistatoconsensi.xsd.fse.ini.finanze.it');
CkXml_UpdateChildContent(xml,'soapenv:Header','');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente','XXXXXXAAABBBCCC');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode','...');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione','999');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente','123456789');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente','ZZZ');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo','');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore','');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico','true');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita','READ');
CkXml_UpdateChildContent(xml,'soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso','ABCDEFGHIJKLM');
soapEnvelope := CkXml__getXml(xml);

domain := 'fseservicetest.sanita.finanze.it';
path := '/FseInsServicesWeb/services/fseStatoConsensi';

req := CkHttpRequest_Create();
CkHttpRequest_putHttpVerb(req,'POST');
CkHttpRequest_putSendCharset(req,False);
CkHttpRequest_AddHeader(req,'Content-Type','application/soap+xml; charset=utf-8');
CkHttpRequest_putPath(req,path);
success := CkHttpRequest_LoadBodyFromString(req,soapEnvelope,'utf-8');

// User name and Password for Basic Authentication 
CkHttp_putLogin(http,'XXXXXXAAABBBCCC');
CkHttp_putPassword(http,'MYPASSWORD');

resp := CkHttpResponse_Create();
success := CkHttp_HttpSReq(http,domain,443,True,req,resp);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

xmlResp := CkXml_Create();
success := CkXml_LoadXml(xmlResp,CkHttpResponse__bodyStr(resp));
Memo1.Lines.Add(CkXml__getXml(xmlResp));

CkHttp_Dispose(http);
CkXml_Dispose(xml);
CkHttpRequest_Dispose(req);
CkHttpResponse_Dispose(resp);
CkXml_Dispose(xmlResp);

end;