
SMS API for JAVA developers

Hi,
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.4any.org/httpcomponents/commons-httpclient/source/commons-httpclient-3.1-src.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
Reference: http://www.ozeki.hu/index.php?ow_page_number=566
Thanks

he friend its too good , but if i want to put----
String entryXML= "
then what name shall i give in place of messageData in addPara?
method.addParameter( "?????????", entryXML );
Please help........
Thanks. Regards, Milind
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.