OZEKI
Message Server 6
"The world's favourite SMS server"
info@ozeki.hu
Tel.: 00 36 52 532 731

SMS Server 6
On-line manual
Introduction
SMS technology
MMS technology
About
Product features
Installation guide
User guide
Developers guide
General information
Languages
C++ SMS
SQL SMS
HTTP SMS
Files SMS
Java SMS
Port numbers
PHP SMS
ASP SMS
Delphi SMS
C# SMS
Access SMS
SMS FAQ
Case studies
Appendix
Search
Download
Home
Support
How to buy
Resellers
SMS Wall
IP SMS Gateway
Excel SMS
Company


On-line manual:
  Explore all the features in this on-line HTML documentation.
Product guide:
  This downloadable pdf explains all the features of Message Server 6.


Newsletter:
  Sign up to get news about product updates!

E-mail:
  You can send tech. questions in e-mail to the following address: info @ ozeki.hu


Did you know?
Ozeki offers a very high performance SMS Gateway system as well called Ozeki NG SMS Gateway. It can send and receive up to 500 SMS messages per second.

Ozeki Phone System XE VoIP PBX software is an advanced PBX built for automated voice calls and 2 way SMS messaging. It has outstanding APIs for software developers.

Ozeki VoIP SIP SDK is a great tool for software developers who wish to get involved in voip phone client or voip phone service development.

OZEKI MESSAGE SERVER - Product Guide

Files SMS Contents | SearchPort numbers

Home > Developers guide > Languages > Java SMS

SMS API for JAVA developers

The following example gives you detailed instructions on how you can send a WAP Push SMS messages from Java. The example uses HTTP Client functionality to pass the outgoing messages to the built in HTTP server of Ozeki Message Server. In the example we assume, that Ozeki Message Server is already installed and configured. A WAP push message contains a description of a WAP page and an URL that points to it.

Ozeki Message server can also be used to send text messages and various binary SMSes such as vCard and vCalendar messages, Operator Logos and Ringtones. All you have to do is change the messageType field and the message content in this example. A list of supported message types can be found on the following URL: http://www.ozeki.hu/index.php?owpn=488.

To send a WAP push message we use the HTTP client library of Apache.org. First you need to download this library:

Step 1. - download the apache HTTP client library

Go to the following webpage: http://apache.mirrors.crysys.hit.bme.hu/dist/httpcomponents/commons-httpclient/binary/commons-httpclient-3.1.zip, and download version 3.1.

After you have downloaded the file (commons-httpclient-3.1-src.zip) unzip it! The unzip will create the following jar file, that contains the HTTP client utilities: commons-httpclient-3.1.jar

Setp 2 - set the CLASSPATH to have access to the functions stored in this jar.

SET CLASSPATH=C:/tmp/commons-httpclient-3.1/commons-httpclient-3.1.jar

Step 3 - create a .java source file, that will connect to Ozeki Message Server and will post a message.

PostExample.java

import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;

public class PostExample {
 public static void main( String[] args ) {
   String url = "http://127.0.0.1:9333/ozeki";
   String wapPush= " <si>"+
                   "    <indication href=\"http://wap.yahoo.com/\" action=\"signal-high\">"+
                   "        A WAP Push message, that sends the browser to wap.yahoo.com."+
                   "    </indication>"+
                   "</si>";
   try {
    HttpClient client = new HttpClient();
    PostMethod method = new PostMethod( url );

  // Configure the form parameters
  method.addParameter( "login", "admin" );
  method.addParameter( "password", "abc123" );
  // method.addParameter( "operator", "Vodafone" );
  method.addParameter( "action", "sendMessage" );
  method.addParameter( "messageType", "SMS:WAPPUSH:application/vnd.wap.sic" );
  method.addParameter( "recepient", "+36205222245" );
  method.addParameter( "messageData", wapPush );

  // Execute the POST method
    int statusCode = client.executeMethod( method );
    if( statusCode != -1 ) {
      String contents = method.getResponseBodyAsString();
      method.releaseConnection();
      System.out.println( contents );
    }
   }
   catch( Exception e ) {
    e.printStackTrace();
   }
 }
}


Step 4 - compile the file

javac PostExample.java

Step 5 - send the WAP push message

java PostExample.java





Next page: Port numbers