@param callbackData (optional) will be passed back to the notifyURL location, so you can use it to identify the message the receipt relates to (or any other useful data, such as a function name)
@see SMSSendResponse
*/
public SMSSendResponse sendSMS(String senderAddress, String[] address, String message, String clientCorrelator, String notifyURL, String senderName, String callbackData) {
SMSSendResponse response=new SMSSendResponse();
FormParameters formParameters=new FormParameters();
formParameters.put("senderAddress", senderAddress);
for (String addr:address) formParameters.put("address", addr);
formParameters.put("message", message);
formParameters.put("clientCorrelator", clientCorrelator);
formParameters.put("notifyURL", notifyURL);
formParameters.put("senderName", senderName);
formParameters.put("callbackData", callbackData);
String endpoint=endPoints.getSendSMSEndpoint();
int responseCode=0;
String contentType = null;
try {
if (dumpRequestAndResponse) JSONRequest.dumpRequestVariables(endpoint, authorisationHeader, formParameters);
HttpURLConnection con = JSONRequest.setupConnection(endpoint, authorisationHeader);
con.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
String requestBody=JSONRequest.formEncodeParams(formParameters);
out.write(requestBody);
out.close();
responseCode=con.getResponseCode();
contentType = con.getContentType();
response=smsSendResponseProcessor.getResponse(con, OneAPIServlet.CREATED);
} catch (Exception e) {
response.setHTTPResponseCode(responseCode);
response.setContentType(contentType);
response.setRequestError(new RequestError(RequestError.SERVICEEXCEPTION, "SVCJAVA", e.getMessage(), e.getClass().getName()));
logger.error("Exception "+e.getMessage()+" "+e.getLocalizedMessage());
}
return response;
}