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: https://ozeki.hu/p_488-sms-message-types.html.
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.*; public class PostExample { // Configure the form parameters // Execute the POST method |
Step 4 - compile
the file
javac PostExample.java
Step 5 -
send the WAP push message
java
PostExample.java
More information