Send WAP Push from Java (or JSP)

Posted by on Mar 23, 2009 in Support Blog

Topic Keywords: , ,

The previously posted examples for sending SMS and MMS messages from a Java application with NowSMS can also be used for sending WAP Push messages.
Normally, when we talk about WAP Push messages, we are talking about “Service Indication” (SI) messages, which are a common type of WAP Push message. MMS Messages also use WAP Push for part of the delivery process, but they are handled by a separate client. “Service Indication” WAP Push messages are the push messages that include some informational text, and a URL link for retrieving additional content.

To send a WAP Push message where you have already created the URL containing your content, the SMS example can be used. This example is described in the article http://www.nowsms.com/nowsms-java-example-send-sms-message, and can be downloaded directly at http://www.nowsms.com/download/sendsms.java.txt.

Using that script, the following code can be used to send a WAP Push message:

sendsms.init();
sendsms.server = “http://localhost:8800/”;
sendsms.user = “test”;
sendsms.password = “test”;
sendsms.phonenumber = “+9999999999”;
sendsms.text = “This is a test WAP Push message”;
sendsms.wapurl = “http://www.nowsms.com/”;
sendsms.send();

Another type of WAP Push supported by NowSMS is something that we refer to as Multimedia WAP Push.

Multimedia WAP Push also uses the “Service Indication” WAP Push message. However, when you send a Multimedia WAP Push message, you post all of the message content (e.g., images, video, text, applet) to the NowSMS server. NowSMS packages the content and dynamically generates a URL on the NowSMS server. A WAP Push message is then sent which includes a link to the content.

To send a Multimedia WAP Push message via NowSMS, the same APIs are used as for sending an MMS message, with a special flag set to indicate that the message should be sent out as a Multimedia WAP Push instead of as an MMS message. The subject of the message is used as the text in the WAP Push, and the remainder of the content is packaged into the dynamically generated URL that accompanies the WAP Push message.

To send a Multimedia WAP Push message from Java, use the MMS example script described at http://www.nowsms.com/nowsms-java-example-send-mms-message, and available for download at http://www.nowsms.com/download/sendmms.java.txt.

Follow the example for sending an MMS message, but include the following additional parameter setting when building the MMS message:

mms.addparameter (“MMSWAPPush”, “Yes”);

NowSMS 2009 also supports a concept of Multimedia Content Push where the push is sent via a text SMS instead of using WAP Push. The concept is similar to Multimedia WAP Push, except that the message that is sent to the recipient is a standard text message.

This alternative is useful in environments where WAP Push is not supported (such as environments where there is a mix of GSM and CDMA technologies), or where binary messaging required by WAP Push is more expensive than standard text messaging. It is also useful for delivering content to devices that do not support WAP Push, such as the Apple iPhone.

To send a Multimedia Content Push via SMS with NowSMS 2009, follow the example for sending an MMS message, but include the following additional parameter setting when building the MMS message:

mms.addparameter (“MMSSMSPush”, “Yes”);

For comments and further discussion, please click here to visit the NowSMS Technical Forums (Discussion Board)...