Sample code for 30+ languages & platforms
Dart

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 Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

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

  final http = CkHttp();
  final xml = CkXml();

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

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

  final req = CkHttpRequest();
  req.httpVerb = 'POST';
  req.sendCharset = false;
  req.addHeader('Content-Type', 'application/soap+xml; charset=utf-8');
  req.path = path;
  req.loadBodyFromString(soapEnvelope, 'utf-8');

  // User name and Password for Basic Authentication 
  http.login = 'XXXXXXAAABBBCCC';
  http.password = 'MYPASSWORD';

  final resp = CkHttpResponse();
  try {
    http.httpSReq(domain, 443, true, req, resp);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  final xmlResp = CkXml();
  xmlResp.loadXml(resp.bodyStr);
  print(xmlResp.getXml());
}