Score:0

Where to install SSL Certificate for CURL request to external API

kz flag

This is a bit of a strange situation, but I'm hoping someone here can provide some assistance. I have a legacy Java application that communicates with an external 3rd party API (UPS online tools). We recently received a notification that we need to update our server certificate by January 21 or our transactions will no longer work.

Our application is sending ssl requests to the external API via a curl request (it HAS to be curl due to the way this application is designed, it's a long story and not really relevant here). What I need to know is, where do I need to install the certificate? We have a front-end web server (Apache), a jboss backend, and an HAProxy service in between. The curl request is being made by the backend via a groovy class executing a curl command. Which of those is the external API looking for a certificate on when doing an ssl handshake?

In case it helps, here is what the groovy method looks like:

public String[] requestTracking(String url, String action, String trackingNumber, String access_license_number, String user_id, String password) {

        String request = """<?xml version="1.0"?>
            <AccessRequest xml:lang="en-US">
             <AccessLicenseNumber>${access_license_number}</AccessLicenseNumber>
            <UserId>${user_id}</UserId>
            <Password>${password}</Password>
            </AccessRequest>
            <?xml version="1.0"?>
            <TrackRequest xml:lang="en-US">
                <Request>
                <TransactionReference>
                    <CustomerContext>My Context</CustomerContext>
                    <XpciVersion>1.0001</XpciVersion>
                </TransactionReference>
                <RequestAction>Track</RequestAction>
                <RequestOption>${action}</RequestOption>
                </Request>
                <ShipmentIdentificationNumber>${trackingNumber}</ShipmentIdentificationNumber>
            </TrackRequest>
""";

        def command = [
            'sh',
            '-c',
            "curl -s -w '%{http_code}' '${url}' -X POST -d '" + request + "'"
        ];

        def proc = command.execute();
        def outputStream = new StringBuffer();
        def errorStream = new StringBuffer();
        proc.waitForProcessOutput(outputStream, errorStream);
        //      System.out.println("error: " + errorStream.toString());
        String result = outputStream.toString().trim();
        //split off the html status code
        String code = result.substring(result.length() -3);
        String body = result.substring(0,result.length() -3);

        String[] output = [code, body];
        return output;
    }
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.