Java Code to send SMS from my Web Application to any Mobile in India

In this article, I am going to tell you how to send SMS from web application with the help of Java code.
Using Java SMS we can send bulk SMS from your own Java application with the help of an SMS Gateway API.
Nowadays SMS messaging is a most popular way of mobile communication. Many organizations and IT companies are using Bulk SMS service to communicate with their customers. Bulk SMS is an expressly widely used marketing tool across the world and companies are using it to increase their ROI and customer interaction. There are many companies which provide SMS gateway API at affordable along with special features. If you take SMS gateway API from MSG91 than you can send images, campaigns and many more.

If you want to write a Java code for sending an SMS by the web application to any mobile in India, you should know all the library functions of JAVA. I prefer HTTP protocol for sending requests and responses over it because this is a simple way to send information from an application to another.

Java Code to send SMS from my Web Application to any Mobile in India

Java Code to send SMS from my Web Application to any Mobile in India

As Java has inbuilt method calls to send HTTP requests, therefore, HTTP provides a better facility to send messages in remote mobile phones. You will need following things to send bulk SMS by Java code:

* Java SMS application:

A software is written in Java language that can be used to send text messages. Use basic SMS application. I used HTTP to set up a connection between the SMS gateway and Java application.

* SMS Gateway:

Select SMS Gateway from MSG91 that allow your system to send or receive SMS messages from
a telecommunications network. It enables a user to send the SMS messages from Java application through HTTP via GSM modem. For sending SMS using HTTP, you will need an SMS Gateway that has a built-in web server. Therefore select that SMS gateway which supports HTTP and compatible with Windows PC.

* Mobile phone user:

You need a mobile phone user to send SMS. It is a recipient of your SMS and could be a colleague, your customer, your business partner, a friend or any other. The message that has been sent from Java app will be sent to the telephone number. If you want to build a Java application, probably you are a Java developer so must be aware of the following term:

Eclipse IDE for Java
the Java SE Development Kit (JDK)
SMS gateway
HTTP-based solution

1. Create a new Java project in Eclipse

File > New > Java Project

2 Now define a Project name for your project

3 Then click on the Finish button

4 After that define a new class

File > New > Class

5 Specify a Name for the new class.

6 Then click on the Finish button

7 Now import the with the SMS application.

8 Now enter the telephone number of the recipient(s), the text message and the sender’s phone number.

9 Now connect the SMS gateway through HTTP, here you need to provide the URL of the SMS gateway