ReceiveSMS with jsp

ReceiveSMS with jsp SearchSearch
Author Message
Ahmed chaari
New member
Username: Stoner2008

Post Number: 2
Registered: 05-2013
Posted on Monday, May 27, 2013 - 09:31 am:   

hello every one,
i'm starting to make a script java or jsp that should receive a message, treat it (if it starts with "d"), then it should reply something like "test succeed". also i want to extract data from text and place it into my database.
please can someone help me?

sincerly,
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 4500
Registered: 08-2008
Posted on Tuesday, May 28, 2013 - 03:33 pm:   

Hi Ahmed,

We do not have any Java or JSP examples for processing a received SMS.

When NowSMS receives an SMS message, it can then either connect to an HTTP URL to process the message, or it can run a local command to process the message.

Since I'm not a Java expert, let me explain what the above means, and then we'll relate it back to Java.

To pass the message to an application over HTTP, you'd define a 2-way command with a URL of something like http://server/path?sender=@@SENDER@@&text=@@TEXT@@

Let's say that you received an SMS message from "123456789" with text of "test message".

NowSMS would issue the following 2-way command:

http://server/path?sender=1234567890&text=test+message

An HTTP server application would be able to pass the "sender" and "text" variables to obtain the details about the received message.

If you're building this in Java, you'd probably create a Java servlet on your web server to process this received message.

The servlet would process HTTP GET requests, and use request.getParameter("sender") and request.getParameter("text") to parse the message details. The variable names are configurable ... sender and text are the variable names I used in the 2-way command example above.

Obviously, you'd want to test your servlet with simple URL request examples like my example above ... before you went and activated it as a 2-way command.

Alternatively, you could write a simple Java class that ran outside of a web server. In this case, NowSMS could launch the Java to run the command each time a message was received, and message details would be passed as command line parameters.

--
Des
NowSMS Support