Sample code for 30+ languages & platforms
Rust

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

Rust

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

let http = chilkat::Http::new();
let xml = chilkat::Xml::new();

let _ = false;

// Create the SOAP envelope...
xml.set_tag("soapenv:Envelope");
let _ = xml.add_attribute("xmlns:soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
let _ = xml.add_attribute("xmlns:stat", "http://statoconsensirichiesta.xsd.fse.ini.finanze.it");
let _ = xml.add_attribute("xmlns:tip", "http://tipodatistatoconsensi.xsd.fse.ini.finanze.it");
xml.update_child_content("soapenv:Header", "");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente", "XXXXXXAAABBBCCC");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode", "...");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione", "999");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente", "123456789");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente", "ZZZ");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo", "");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore", "");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico", "true");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita", "READ");
xml.update_child_content("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso", "ABCDEFGHIJKLM");
let soap_envelope = xml.get_xml().unwrap_or_default();

let domain = "fseservicetest.sanita.finanze.it".to_string();
let path = "/FseInsServicesWeb/services/fseStatoConsensi".to_string();

let req = chilkat::HttpRequest::new();
req.set_http_verb("POST");
req.set_send_charset(false);
req.add_header("Content-Type", "application/soap+xml; charset=utf-8");
req.set_path(&path);
let _ = req.load_body_from_string(&soap_envelope, "utf-8").is_ok();

// User name and Password for Basic Authentication 
http.set_login("XXXXXXAAABBBCCC");
http.set_password("MYPASSWORD");

let resp = chilkat::HttpResponse::new();
if http.http_s_req(&domain, 443, true, &req, &resp).is_err() {
    println!("{}", http.last_error_text());
    return;
}

let xml_resp = chilkat::Xml::new();
let _ = xml_resp.load_xml(&resp.body_str()).is_ok();
println!("{}", xml_resp.get_xml().unwrap_or_default());