I use java to create a desktop application, and this application uses the API. To provide connectivity with the API, I was informed of their support for using HTTPS. Let me know how to configure https connection with java client.
The API has this function, which states that it can choose a secure connection:
private String getUrlAddress(XmlRequest request) { // determine if this is a secure connection String url = this.ssl ? "https://" : "http://"; // determine service endpoint based on type of class/request passed in if( request.getClass() == MessageRequest.class) { url += ClockWorkSmsService.SMS_URL; } else { url += ClockWorkSmsService.CREDIT_URL; } return url; }
this code gives me an idea that the βrequestβ will be my current url or server, so I will configure an https connection on my side.
Clockworksms Toolbars:
import com.clockworksms.*; public class DemoSms { public static void main(String[] args) { try { ClockWorkSmsService clockWorkSmsService = new ClockWorkSmsService("apikey"); SMS sms = new SMS("441234567890", "Hello World"); ClockworkSmsResult result = clockWorkSmsService.send(sms); if(result.isSuccess()) { System.out.println("Sent with ID: " + result.getId()); } else { System.out.println("Error: " + result.getErrorMessage()); } } catch (ClockworkException e) { e.printStackTrace(); } } }
source share