Objective-C
Objective-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 Objective-C Downloads
#import <CkoHttp.h>
#import <CkoXml.h>
#import <NSString.h>
#import <CkoHttpRequest.h>
#import <CkoHttpResponse.h>
BOOL success = NO;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
CkoXml *xml = [[CkoXml alloc] init];
success = NO;
// Create the SOAP envelope...
xml.Tag = @"soapenv:Envelope";
[xml AddAttribute: @"xmlns:soapenv" value: @"http://schemas.xmlsoap.org/soap/envelope/"];
[xml AddAttribute: @"xmlns:stat" value: @"http://statoconsensirichiesta.xsd.fse.ini.finanze.it"];
[xml AddAttribute: @"xmlns:tip" value: @"http://tipodatistatoconsensi.xsd.fse.ini.finanze.it"];
[xml UpdateChildContent: @"soapenv:Header" value: @""];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente" value: @"XXXXXXAAABBBCCC"];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode" value: @"..."];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione" value: @"999"];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente" value: @"123456789"];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente" value: @"ZZZ"];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo" value: @""];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore" value: @""];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico" value: @"true"];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita" value: @"READ"];
[xml UpdateChildContent: @"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso" value: @"ABCDEFGHIJKLM"];
NSString *soapEnvelope = [xml GetXml];
NSString *domain = @"fseservicetest.sanita.finanze.it";
NSString *path = @"/FseInsServicesWeb/services/fseStatoConsensi";
CkoHttpRequest *req = [[CkoHttpRequest alloc] init];
req.HttpVerb = @"POST";
req.SendCharset = NO;
[req AddHeader: @"Content-Type" value: @"application/soap+xml; charset=utf-8"];
req.Path = path;
success = [req LoadBodyFromString: soapEnvelope charset: @"utf-8"];
// User name and Password for Basic Authentication
http.Login = @"XXXXXXAAABBBCCC";
http.Password = @"MYPASSWORD";
CkoHttpResponse *resp = [[CkoHttpResponse alloc] init];
success = [http HttpSReq: domain port: [NSNumber numberWithInt: 443] ssl: YES request: req response: resp];
if (success == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
CkoXml *xmlResp = [[CkoXml alloc] init];
success = [xmlResp LoadXml: resp.BodyStr];
NSLog(@"%@",[xmlResp GetXml]);