Sending SMS from CUBA Application

Hi
I want to send SMS from my CUBA application. I see two options are viable i.e. Use of SMS API or using GSM mobile operator service. for the option #2, I have received the following URL info from
my mobile company that is required to be called from my CUBA application.

String requestUrl ="https://vas.canlinkgsm.com/sendSMS/sendSMS?msisdn=1880193676238&message=test_message&userID
    =userid&passwd=uyd4r6wdjewasfhgueshfsdi=";

when I run the above URL in a browser, sms works.

I have converted the above hard coded SMS into variables and passed the value of the variables from an Entity to the URL. How do I run the URL (here requestURL) from CUBA application to send the SMS?

Hi,

You can use thirdparty Java libraries to send HTTP requests, for instance, apache-httpclient (already added to CUBA dependencies): https://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/index.html

Also, I’d recommend that you try to use retrofit2 http://square.github.io/retrofit/ or Unirest: http://unirest.io/java.html , they are simpler than Apache HttpClient and have fluent APIs

Hi Yuriy
Thanks. Will this be enough to call as follows?

   String requestUrl ="https://vas.canlinkgsm.com/sendSMS/sendSMS?msisdn=1880193676238&message=test_message&userID
=userid&passwd=uyd4r6wdjewasfhgueshfsdi=";

HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet(requestUrl);
HttpResponse response = client.execute(request);