Sample code for 30+ languages & platforms
Java Requires Chilkat v11.0.0+

POST XML to https://apicert.sii.cl/recursos/v1/boleta.electronica.token

See more HTTP Misc Examples

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.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
import com.chilkatsoft.chilkat2.HttpResponse;

public class ChilkatExample {

    public static void main(String[] args) {
        // This example assumes the Chilkat API to have been previously unlocked.
        // See Global Unlock Sample for sample code.

        Http http = new Http();

        // XML to send in the body of the HTTPS POST
        String xmlStr = "...";

        String urlEndpoint = "https://apicert.sii.cl/recursos/v1/boleta.electronica.token";
        String xmlCharset = "utf-8";

        HttpResponse resp = new HttpResponse();
        try {
            http.httpStr("POST", urlEndpoint, xmlStr, "utf-8", "application/xml", resp);
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }

        // Get the response status code and body
        System.out.println("response status code = " + resp.getStatusCode());

        // This would be the XML response sent by the server.
        System.out.println(resp.getBodyStr());
    }
}