VOOZH about

URL: https://www.javacodegeeks.com/2010/05/java-api-for-kannel-smswap-gateway-v_24.html

⇱ Java API for Kannel SMS/WAP gateway v 1.0.2 released - Java Code Geeks


Hello all, we released version 1.0.2 of Java API for Kannel SMS/WAP gateway.

The latest version introduces prioritized WAP Push functionality and bulk WAP Push messaging.

You can download the new version here

An example use of the API is shown below :
 
 
 
 

public static void main(String[] args) {

 SMSManager smsManager = SMSManager.getInstance();

 // We can change the prefetch size of the background worker thread
 smsManager.setMessagesPrefetchSize(30);

 // We can change the send message rate
 smsManager.setMessagesSendRate(65);

 try {

 // Send SMS to a single destination
 smsManager.sendSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", "receiver_mobile_number", "the_message");

 // Send SMS to a single destination with a specific priority and send rate
 smsManager.sendSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", "receiver_mobile_number", "the_message", SMSManager.MESSAGE_PRIORITY_3);

 // Send SMS to multiple recipients
 List<String> recipientsGroupA = new ArrayList<String>();
 recipientsGroupA.add("receiver_mobile_number_1");
 recipientsGroupA.add("receiver_mobile_number_2");
 recipientsGroupA.add("receiver_mobile_number_3");
 recipientsGroupA.add("receiver_mobile_number_4");
 recipientsGroupA.add("receiver_mobile_number_5");
 smsManager.sendSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", recipientsGroupA, "the_message");

 // Send SMS to multiple recipients with a specific priority and send rate
 List<String> recipientsGroupB = new ArrayList<String>();
 recipientsGroupB.add("receiver_mobile_number_1");
 recipientsGroupB.add("receiver_mobile_number_2");
 recipientsGroupB.add("receiver_mobile_number_3");
 recipientsGroupB.add("receiver_mobile_number_4");
 recipientsGroupB.add("receiver_mobile_number_5");
 smsManager.sendBulkSMS("localhost", "13013", "foo", "bar", "sender_mobile_number", recipientsGroupB, "the_message", SMSManager.MESSAGE_PRIORITY_7);

 // Send a WAP Push request to a single mobile recipient
 smsManager.sendWAPPush("localhost", "8181", "receiver_mobile_number", SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, "the_message", "http://localhost", 3);

 // Send a WAP Push request to a single destination with a specific priority and send rate
 smsManager.sendWAPPush("localhost", "8181", "receiver_mobile_number", SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, "the_message", "http://localhost", 3, SMSManager.MESSAGE_PRIORITY_8);

 // Send WAP Push request to multiple recipients with a specific priority and send rate
 List<String> recipientsGroupC = new ArrayList<String>();
 recipientsGroupC.add("receiver_mobile_number_1");
 recipientsGroupC.add("receiver_mobile_number_2");
 recipientsGroupC.add("receiver_mobile_number_3");
 recipientsGroupC.add("receiver_mobile_number_4");
 recipientsGroupC.add("receiver_mobile_number_5");
 smsManager.sendBulkWAPPush("localhost", "8181", recipientsGroupC, SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, "the_message", "http://localhost", 3, SMSManager.MESSAGE_PRIORITY_8);

 } catch (Exception ex) {
 ex.printStackTrace();
 }

 // Stops the background worker.
 // smsManager.stopSMSManagerWorker();

}

Best Regards

Justin

Related articles :
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Thank you!

We will contact you soon.

👁 Photo of Byron Kiourtzoglou
Byron Kiourtzoglou
May 24th, 2010Last Updated: November 21st, 2022
16 222 1 minute read

Byron Kiourtzoglou

Byron is a master software engineer working in the IT and Telecom domains. He is an applications developer in a wide variety of applications/services. He is currently acting as the team leader and technical architect for a proprietary service creation and integration platform for both the IT and Telecom industries in addition to a in-house big data real-time analytics solution. He is always fascinated by SOA, middleware services and mobile development. Byron is co-founder and Executive Editor at Java Code Geeks.
Subscribe

This site uses Akismet to reduce spam. Learn how your comment data is processed.

16 Comments
Oldest
Newest Most Voted
Xander
12 years ago

Hi Justin,

Can you please explain the steps required to configure the API. What all needs to be deployed on local machine on the port 13013 and all. I try to ran this example but as port 13013 on my local machine was not being listened by any program the socket connection failed.

Thanx,
X.

0
Reply
Mitesh Patel
12 years ago

Can you tell me how to use a send sms function with DLR..

0
Reply
Albert
12 years ago

Please help me!
I use:

// Send a WAP Push request to a single mobile recipient
smsManager.sendWAPPush(“localhost”, “8181”, “receiver_mobile_number”, SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, “the_message”, “http://localhost”, 3);

But
My errors:
java.io.FileNotFoundException: http://localhost:8080/wappush
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.javacodegeeks.kannel.api.SMSManager.sendWAPPush(SMSManager.java:793)
at com.javacodegeeks.kannel.api.SMSManager.sendWAPPush(SMSManager.java:708)

Thanks!

0
Reply
Albert
12 years ago
Reply to  Albert

Sorry, I’m using:
// Send a WAP Push request to a single mobile recipient
smsManager.sendWAPPush(“localhost”, “8080″, “receiver_mobile_number”, SMSManager.WAP_PUSH_RECEIVER_TYPE_MOBILE, “the_message”, “http://localhost”, 3);

0
Reply
12 years ago
Reply to  Albert

Hello Albert,

Please check if Kannel WAP gateway process is installed and running on your local machine. The java.io.FileNotFoundException: http://localhost:8080/wappush exceptions shows that Kannel is not running localy.

BRs
Byron

0
Reply
Albert
12 years ago

Hello Byron Kiourtzoglou,
Thank for supports.
I’ve tried running the Kannel WAP gateway (kannel.api-1.0.2.jar)
but it appears errors: Failed to load Main-Class manifest attribute from …

Please tell me how to run Kannel WAP gateway

BRs
Albert

0
Reply
Albert
12 years ago

Thank for supports.
I’ve tried running the Kannel WAP gateway (kannel.api-1.0.2.jar)
but it appears errors: Failed to load Main-Class manifest attribute from …

Please tell me how to run Kannel WAP gateway.

BRs
Albert

0
Reply
Albert
12 years ago
Reply to  Albert

Hi Byron,
I’ve tried: Run jar in command line on Windows 7 – 32 (Classpath)

BRs
Albert

0
Reply
Albert
12 years ago
Reply to  Albert

Please help me Mr. Byron

0
Reply
raju
12 years ago

HI ,

I am kannel sms API in my java application
smsManager.sendSMS(“localhost”, “9080”, “foo”, “bar”, “send_number”, “rec_number”, “Hi Test”);

I am getting below exception
java.net.ConnectException: Connection refused: connect.

please help to configure kannel sms api.

Thanks.

0
Reply
kishore
12 years ago

1)Send SMS with priority is not been sent to the SMPPsim that has been configured. SMS send without priority are submitted to the SMSC with no issues. Can anyone revert back on this, as on what need to be done to submit sms with priority.

2)How to get the delivery status if the submitted message from this program to the kannel router?

thanks.

0
Reply
hemanth
11 years ago

hi how can i get replay message (MO) from this api

0
Reply
Etapo
11 years ago

Hi, how to get Kannel Maven dependency?

0
Reply
Mehdi
11 years ago

Where is SMSManager File.? Please Help ME…

0
Reply
Mehdi
11 years ago

Now I’m getting this error

java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.http.HttpClient.(HttpClient.java:211)
at sun.net.www.http.HttpClient.New(HttpClient.java:308)
at sun.net.www.http.HttpClient.New(HttpClient.java:326)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:996)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:932)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:850)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
at com.javacodegeeks.kannel.api.SMSManager.sendSMS(SMSManager.java:357)
at com.javacodegeeks.kannel.api.SMSManager.sendSMS(SMSManager.java:128)
at sendSMS.main(Sms1.java:26)

0
Reply
leonardo
9 years ago

pls, explain how to setup Kannel correctly

java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.javacodegeeks.kannel.api.SMSManager.sendSMS(SMSManager.java:357)
at com.javacodegeeks.kannel.api.SMSManager.sendSMS(SMSManager.java:128)
at com.sms.app.senderSms.main(senderSms.java:23)

0
Reply
Back to top button
Close
wpDiscuz