简体   繁体   中英

How to receive sms in a web application in java ?

i'm trying to create a web application that sends and receive SMS. I've already contacted a local SMS gateway and the connection is working.

I'm using Jsmpp as the library and i'm able to send and receive SMS through a sample application i build using Java SE.

Now i need to migrate this feature to web application. Sending SMS should be ok. But how can i add a listener to listen to the SMSC through my web application ? I'm using Spring and j2ee.

The SMSC doesnt expose a web api and dont have the ability to send sms to a api i expose. The only way they allow is the communicate through the SMPP protocol.

Thanks In Advance.

did you try the program in the link - http://www.java-samples.com/showtutorial.php?tutorialid=22 ?

If you are looking for any Bulk SMS Solution, You can use APIs provided by vendors such as https://www.textlocal.in/ or any other vendor whichever is feasible.

If you are looking to setup a gateway for yourself, you can check a solution like http://www.ozekisms.com/

Earlier there were Network Vendor provided Gateway which you can freely use, now there are no such gateway you can use freely.

More links, https://www.quora.com/How-can-I-send-a-SMS-with-a-Java-code http://www.airtel.in/aes/Global+Business/Global+Voice/Enterprise+Voice+Solutions/Mobility+Solutions/Enterprise+VAS/Bulk+SMS+Solutions

After lots of trial and error i managed to find a solution for the question.

The way i implemented it was to run a standalone java application as a Linux service that would listen to the SMSC. I used the sample project SMSRouter ( https://smsrouter.org/ ) as the basis. Apache camel smpp component was used in this sample project to handle sms sending and receiving.

I then created queues inside Jboss application server for inbox and outbox to store incoming and outgoing sms messages.

Once a SMS is received by SMSRouter it will use JMS to add the SMS message to the inbox queue inside Jboss which will trigger a Message Driven bean that would keep listening to the inbox queue.

When the Web Application needs to send a SMS it will add a JMS message to the outbox queue which will then trigger the SMSRouter which is listening to the outbox queue. SMSRouter will use Apache Camel to send the SMS to the SMSC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM