How to receive sms in a web application in java ? - 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.

Related

Retrieve last sent messages from xmpp servers after disconnect

I have created an IM app that uses asmack to connect to various xmpp protocols such as google talk and facebook.
Occasionally some messages are lost in transit (both sent and received messages) when switching between Wifi/Data or when you lose signal altogether. Is there any way to retrieve the last received messages for that particular protocol when the app manages to reconnect? I find myself having to constantly check the default messaging app to see if any messages came through while I was disconnected.
Also, how about a way to get obtain delivery confirmation upon sending a message?
Thanks!
If you use a server that supports XEP-0136: Message Archiving or XEP-0313: Message Archive Management, you'll be able to obtain all messages previously sent.
However, neither Google Talk nor Facebook Chat implements these, and afaik they have no alternative XMPP API for it either.

Using JMS in RESTFull Web services

I am developing the Rest Full services in Java+Spring, that can be used by Mobile Apps(iPhone+Android) and on Web Applications.
Would it be better choice to choose JMS(Java Messasing service) for Sending asynchronous and Reliable Email messages to Mobile Apps and Web application or is there any better alternative other than JMS for asynchronous messaging. Please help.
EDIT :
I want my RESTFull web services to send email messages that not only provide the guarantee of delivery of the Email messages but also use the asyancronous messaging mode so that server would not be waiting for reciever to recieve the message. Also please suggest if i use JMS at server end to Publish/Produce the messages in a Queue, how will the Mobile Apps will recieve the messages from the JMS Queue? Is it possible for IPhone/Android/PHP web application to recieve the message that was published by JAVA server.
Thanks,
Arun Kumar
JMS isn't appropriate for mobile applications. Mobile applications can't be expected to be always running and listening for connections. For these reasons Push Notifications are used for sending messages to mobile devices. Both Apple and Google offer this kind of services.

How to listen for email messages

Is there a way to listen for incoming/outgoing email messages or access the inbox directly?
I read that since there is no default mail client in the Android SDK it is not possible unless the client used on the phone implements some custom mechanisms. Is this still the case?
Emails are not part of the Android OS so you cannot code a global Broadcast Receiver (like you would for incoming SMS). The obvious workaround is to code Broadcast Receivers for the top X most popular email clients on Android OS which do broadcast incoming emails.
K9 does give you the flexibility of registering Broadcast Receivers for incoming emails - see https://github.com/k9mail/k-9/wiki/Intents.
Gmail does not have any official / documented API for receiving info about incoming emails. But until a while back, you could make use of Content Observers for monitoring changes to Gmail. I believe this no longer works though.
I think the real issue here is privacy and security. Emails contain much more info compared to SMS. As a user, you really would not want an app ecosystem where third party apps can start monitoring your personal and professional emails.

Sending SMS using Java

I am developing a Java web application . I will need to send SMS to a mobile user from the application . How do I achieve this without using a mobile phone for sending SMS?.
I am relatively new to Networks . Please advice .
If you are in the US you could use Twilio. It costs 1 cent per SMS and you can send the messages through their REST API. They also have Java libraries.
http://sourceforge.net/projects/java-sms-api/
http://www.ozekisms.com/index.php?owpn=581
https://www.google.com/search?gcx=w&sourceid=chrome&ie=UTF-8&q=java+sms&safe=images
You should use SMS gateway. See here some gateways
Did you make a decision of what protocol has to be used for sms sending? A lot of SMS centers provide REST or SOAP API to send SMS messages. SOAP and REST are much more simpler than SMPP protocol (that is rather low-level) to my mind.
If you will decide to use SMPP protocol, there is SMPPSim tool which is SMSC (Short Message Service Centre) simulator and allows to test SMS sending functionality in a simple way. So you don't need access to any of real SMSCs.
If your SMS provider allows to use SOAP to send SMS messages, you can use SoapUI Service Mocking that also allows to develop a client for a SOAP service without access to the real one.

GPRS Application using Java

We developed application written in Java/J2EE using which send and receives SMS from service provider and presently we are facing problem that there is some delay in messages and it cost's more for us.
by considering above situation we planned to move to GPRS technology (which is more cheaper and considerably fast).
So please suggest a course of action I can start with and post any sample application for GPRS-enabled system in Java.
With GPRS you would need a client application running in the mobile device. This means a lot of headaches for developing, deploying and supporting. Also, although it would be trivial for the clients to send messages, receiving won't be so straightforward. You would need to implement some kind of a "push" service. One of the problems would be that the client application should be always running.
In general, it isn't easy to replace SMS messages with GPRS communication. You may need to considerably change the architecture of your system.
To make a GPRS application using java you have to need GPRS Modem. First of all you have to make one container which handle request and replay of GPRS modem and your API. API contain private ip and port number wich send the request to container and container then send request to modelm and modem will give response to container and it send back to API.
By using methd Socket("IP Address", port number) you can connect with container and modem .
You have to need a public Ip Address andPort Number, it create virtual pipline between modem and container like as a telnet.
Using GPRS instead of GSM to send an SMS will not cause the SMS to be delivered any faster. You're barking up the wrong tree.

Categories

Resources