(Objective-C) POST XML to https://apicert.sii.cl/recursos/v1/boleta.electronica.token
Demonstrates how to send an HTTPS POST XML request to POST XML to https://apicert.sii.cl/recursos/v1/boleta.electronica.token and retrieve the response.
#import <CkoHttp.h>
#import <NSString.h>
#import <CkoHttpResponse.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
// XML to send in the body of the HTTPS POST
NSString *xmlStr = @"...";
NSString *urlEndpoint = @"https://apicert.sii.cl/recursos/v1/boleta.electronica.token";
NSString *xmlCharset = @"utf-8";
CkoHttpResponse *resp = [http PostXml: urlEndpoint xmlDoc: xmlStr charset: xmlCharset];
if (http.LastMethodSuccess != YES) {
NSLog(@"%@",http.LastErrorText);
return;
}
// Get the response status code and body
NSLog(@"%@%d",@"response status code = ",[resp.StatusCode intValue]);
// This would be the XML response sent by the server.
NSLog(@"%@",resp.BodyStr);
|