ServiceSoap12 / GestioneAppartamenti_FileUnico_Test
ASP AutoIt C C (Unicode) C++ C++ (Unicode) C# DataFlex Delphi Foxpro Go Java Node.js Objective-C Perl PHP Extension PowerBuilder Powershell PureBasic Python CkPython Ruby SQL Server Swift TCL VB.NET VB6 VBScript Xojo
#import <CkoXml.h>
#import <NSString.h>
#import <CkoHttp.h>
#import <CkoHttpResponse.h>
CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"soap:Envelope";
[xml AddAttribute: @"xmlns:soap" value: @"http://www.w3.org/2003/05/soap-envelope"];
[xml AddAttribute: @"xmlns:all" value: @"AlloggiatiService"];
[xml UpdateChildContent: @"soap:Header" value: @""];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:Utente" value: @"string"];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:token" value: @"string"];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:ElencoSchedine|all:string" value: @"string"];
[xml UpdateChildContentInt: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:SchedineValide" value: [NSNumber numberWithInt: 1042]];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:esito" value: @"true"];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:ErroreCod" value: @"string"];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:ErroreDes" value: @"string"];
[xml UpdateChildContent: @"soap:Body|all:GestioneAppartamenti_FileUnico_Test|all:result|all:Dettaglio|all:EsitoOperazioneServizio|all:ErroreDettaglio" value: @"string"];
// In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
xml.EmitXmlDecl = NO;
NSString *soapRequestBody = [xml GetXml];
NSString *endpoint = @"https://alloggiatiweb.poliziadistato.it/service/service.asmx";
NSString *soapAction = @"AlloggiatiService/GestioneAppartamenti_FileUnico_Test";
// For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
NSString *contentType = @"text/xml";
CkoHttp *http = [[CkoHttp alloc] init];
[http ClearHeaders];
[http SetRequestHeader: @"Content-Type" value: contentType];
[http SetRequestHeader: @"SOAPAction" value: soapAction];
CkoHttpResponse *resp = [http PostXml: endpoint xmlDoc: soapRequestBody charset: @"utf-8"];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
NSLog(@"%@",@"Failed to send SOAP request.");
return;
}
// Get the XML response body.
CkoXml *responseXml = [[CkoXml alloc] init];
[resp GetBodyXml: responseXml];
int statusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"response status code: ",statusCode);
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
NSLog(@"%@",[responseXml GetXml]);
return;
}
NSLog(@"%@",[responseXml GetXml]);
// Parse the successful SOAP response XML.
// This is a sample of the response XML, but the namespace prefixes will be different.
// We can parse the result using "*" for the namespace prefixes (see below).
NSString *esito = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:esito"];
NSString *ErroreCod = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:ErroreCod"];
NSString *ErroreDes = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:ErroreDes"];
NSString *ErroreDettaglio = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:GestioneAppartamenti_FileUnico_TestResult|*:ErroreDettaglio"];
int SchedineValide = [[responseXml GetChildIntValue: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:SchedineValide"] intValue];
esito = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:esito"];
ErroreCod = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:ErroreCod"];
ErroreDes = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:ErroreDes"];
ErroreDettaglio = [responseXml GetChildContent: @"*:Body|*:GestioneAppartamenti_FileUnico_TestResponse|*:result|*:Dettaglio|*:EsitoOperazioneServizio|*:ErroreDettaglio"];
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:all="AlloggiatiService">
<soap:Header/>
<soap:Body>
<all:GestioneAppartamenti_FileUnico_Test>
<all:Utente>string</all:Utente>
<all:token>string</all:token>
<all:ElencoSchedine>
<all:string>string</all:string>
</all:ElencoSchedine>
<all:result>
<all:SchedineValide>1042</all:SchedineValide>
<all:Dettaglio>
<all:EsitoOperazioneServizio>
<all:esito>true</all:esito>
<all:ErroreCod>string</all:ErroreCod>
<all:ErroreDes>string</all:ErroreDes>
<all:ErroreDettaglio>string</all:ErroreDettaglio>
</all:EsitoOperazioneServizio>
</all:Dettaglio>
</all:result>
</all:GestioneAppartamenti_FileUnico_Test>
</soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:all="AlloggiatiService">
<soap:Header/>
<soap:Body>
<all:GestioneAppartamenti_FileUnico_TestResponse>
<all:GestioneAppartamenti_FileUnico_TestResult>
<all:esito>true</all:esito>
<all:ErroreCod>string</all:ErroreCod>
<all:ErroreDes>string</all:ErroreDes>
<all:ErroreDettaglio>string</all:ErroreDettaglio>
</all:GestioneAppartamenti_FileUnico_TestResult>
<all:result>
<all:SchedineValide>1042</all:SchedineValide>
<all:Dettaglio>
<all:EsitoOperazioneServizio>
<all:esito>true</all:esito>
<all:ErroreCod>string</all:ErroreCod>
<all:ErroreDes>string</all:ErroreDes>
<all:ErroreDettaglio>string</all:ErroreDettaglio>
</all:EsitoOperazioneServizio>
</all:Dettaglio>
</all:result>
</all:GestioneAppartamenti_FileUnico_TestResponse>
</soap:Body>
</soap:Envelope>