If you have used the Free SMS web service already and craved a java version, it is here :) . You can now send SMS from within your program by calling a simple method. Just download this JAR file and include it in your class path. Java source code for the class file is present in the JAR archive itself. So, if required you can browse through it.

How to use:

Please note that you need to create a free account at www.way2sms.com before attempting to use the library.

Here’s a simple program on how to use the JAR.

import com.aswinanand.sms;

public static void main(String… args) {

SMS.send(“9933445566″, “password”, “9001122334;9887712345″, “message”);

}

SMS should be sent now. If there are any errors then an exception will be thrown.

License:

This Java source code, the class file and the archive is licensed under “Creative Commons Attribution-Noncommercial”. License terms are here. Downloading the files means you agree to the license terms.

Download:

Download the sms.jar here.

Improvements:

Some immediate improvements are underway right now:

  1. Code cleanup.
  2. Organize the code in methods. Right now everything is in one big method.
  3. Invalid login notification.
  4. Support for authenticated proxy servers.

Change Log:

Version 0.2, 0.3:

  1. Implemented the major changes that happened at way2sms. Download here.

Version 0.1:

  1. First release with working code base for sending SMS through way2sms.

Please take it for a test drive and give feedback.

170 Responses to “Free SMS Web Service India – Java Library”

  1. Jaskirat Says:

    I ought to check this out ! :)

  2. Aswin Anand Says:

    Jaskirat, please do check it out and give feedback :)

  3. ARCHIE Says:

    I got his error !!

    Logging in
    Exception in thread “main” java.net.ConnectException: Connection refused: connec
    t
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:507)
    at java.net.Socket.connect(Socket.java:457)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
    at sun.net.www.http.HttpClient.(HttpClient.java:214)
    at sun.net.www.http.HttpClient.New(HttpClient.java:287)
    at sun.net.www.http.HttpClient.New(HttpClient.java:299)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
    onnection.java:792)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
    ction.java:744)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
    .java:669)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLCo
    nnection.java:836)
    at SMS.send(SMS.java:71)
    at Message.main(Message.java:10)

  4. Aswin Anand Says:

    Archie, I’m not getting this error. May I know how you tried to use this library? Please be more specific about the problem that’s occuring.

  5. Archie Says:

    Hai ,
    Instead of importing package I used SMS.java file directly by writing a main method in it too invoke SMS.send function and i modified the fields
    uid,pwd,phone,msg and then invoked the SMS.send function ..

    After Invoking i got this error

  6. Aswin Anand Says:

    Archie, if you are including the java source file in the same place as your Message.java, then I don’t think your program will compile properly. But the stack trace you pasted here doesn’t seem to be a compile time error. Is there any proxy server through which you are accessing internet? If so, the proxy server may be refusing connections.

  7. Archie Says:

    oh ok , i will try , is there any method to overcome from these proxy servers.

  8. Aswin Anand Says:

    Archie, support is being added for proxy servers. Please stay tuned to this post for more details.

  9. ARCHIE Says:

    hai , if u give u r mail id , i will send the code itself , so that you can check once that code , will u send u r Mail ID

  10. Aswin Anand Says:

    Archie, please use the “Contact Me” link on the sidebar.

  11. Waves » Blog Archive » Send Free SMS - Web Service Says:

    [...] Java JAR Library [...]

  12. vivin Says:

    Aswin its working fine and thanks a lot. U have done a very good job for all of us, u released this version in PHP, .Net and in Java. U are really great. Btw who helped u in preparing the Java version.

  13. Aswin Anand Says:

    Vivin, I prepared the java version myself. A .NET DLL is still in the works.

  14. vivin Says:

    that’s really great of u Aswin. thank you. how can we know that HiddenAction=loginPage, different Request Headers and Header values. please let me know how we can do all these.

  15. Aswin Anand Says:

    Vivin, there are various softwares that help you achieve this. One is to use firefox browser with the firebug and web developer add-ons. Other way is to have a proxy server like Fiddler. They show what data is being sent through & they also show response headers, cookies, content etc.

  16. vivin Says:

    thank you aswin, really u are helping me a lot, thanks for ur patience in answering to my questions. btw may i know on what u are currently working on?

  17. Waves » Blog Archive » HttpURLConnection.setFollowRedirects Bug Says:

    [...] did the above mentioned stuff for this Free SMS Java Library [...]

  18. shanmugam Says:

    hi, i am a final year student.my project requires sms service,but i am new to web services.i could not able to use the JAR file. can u help me

  19. Aswin Anand Says:

    Shanmugam, since yesterday there has been some major changes with way2sms. The web service is being modified to reflect those changes. We will be working fine in a couple of days.

  20. shanmugam Says:

    Thank you Aswin for your kind reply.Please intimate me as early as possible.Your reply will help me to further proceed my project.

  21. Vivin Says:

    hi aswin, i hope u are busy with ur works and i am sorry for disturbing you, the web service is not working, today when i tried to send sms, the return value from web service is: invalid login, is the same response when i used email id and mobile no. in the place of user id. so, plz look into this if u are free, thank u in advance.

  22. Aswin Anand Says:

    Vivin, can you download the java library again, try it and tell me?

  23. Balaji Says:

    Hi Aswin,

    I used this webservice and I was able to send sms successfully last week..today, i cant able to send sms using this service and it throws, “invalid login” error…but using the account, i am able to login to way2sms.com…
    Please help me how to proceed further.

  24. Aswin Anand Says:

    Balaji, giving your user id as your 10 digit phone number and try again.

  25. shanmugam Says:

    Thank you Aswin. It works fine.

  26. Waves » Blog Archive » Free SMS Web Service Updated Says:

    [...] Java Library to send SMS - http://www.aswinanand.com/blog/2009/01/free-sms-web-service-java-library/ [...]

  27. satya Says:

    I am developing web application and i have a feature called “send sms”.While i am searching for free sms services i found your site.

    I am using java for my application development,i saw your sms.jar file but i cant understood how to proceed to use your service.Please help me to use this service.

  28. Sanjay Says:

    Thanks a lot

  29. Camilo Says:

    Can any one tell me about another API that works in europe?
    Thanks

  30. Camilo Says:

    Anyone know an API to send sms to a mobiles in Europe?
    Any suggestion to cifuentesgenoy@yahoo.com
    Thanks!

  31. sk Says:

    Hi
    Aswin

    Thanks for ur webservice. It’s really great..

  32. Mohmmad Meerasaaheb Says:

    Hi aswin
    I started using ur library and run the program but it is not sending any sms. How much time will it took to send the sms. Please inform soon.Is the webservice u wrote is working correctly or not please check actually iam not getting any Exceptions.

  33. satya Says:

    i am trying to use your send sms application,please forward your code,its urgent.

    Thanking U

  34. Praveen Says:

    HI Ashwin…. u r simply brilliant, Hats off to you sir.

    The service and jar files are really useful for the starters.

  35. Pratush Says:

    Hi this blog is very useful thank you very much my friend

  36. vivin Says:

    Hi Ashwin, how are you. after a long time to see ur blog.

  37. Aswin Anand Says:

    Hey Vivin :) im very good. Hope you are doing good as well.

  38. Rajesh Says:

    Hello!

    I am new to Java, can you tell me where should have place the jar file? I have c:\jdi1.3\bin kind of structure in my computer.

  39. Vivin Says:

    Hi aswin, i am doing good and by the way today i tried the web service and the response string from the service is “Invalid login” so, can u please go through it(if you are free). Thanks in advance.

  40. Aswin Anand Says:

    Sure Vivin. Will check this and let you know.

  41. Vivin Says:

    Hi aswin, the webservice is working today and i think made some changes to it. If you don’t mind can you help me how to maintain(make changes in the java lib provided by you) when any changes are made to way2sms.com site and can refer me some docs to study which will help me in getting the required knowledge.

    Thanks and Regards,
    Bhaskar V.V.N.

  42. Ravindra Says:

    Dear Sir,

    I am developing web application in java and i have a feature called “send sms”.While i am searching for free sms services i found your site.

    it is working fine
    can u mail webservice coad in java so in can add it on my server

    Thanks and Regards,
    Ravindra

  43. Anirudh Says:

    i am getting this error

    Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at test.main(test.java:6)

  44. vinod Says:

    HI ,

    YOUR SMS API IS NICE.

    THANKS & REGARDS
    VINOD KELWANI

  45. akash Says:

    Thank you i worked nice for me

    great job

  46. Vikram Says:

    hey ashwin..
    great work buddy !!
    it works.. very efficiently :)

    -cheers

  47. bala krishna Says:

    Hi Ashwin,

    I have been using your java version to send SMS from the main method. But I am getting the following error. Please help me.

    “java.net.UnknownHostException: wwwd.way2sms.com”

    Is that because of any proxy, how to make it work, Please help

    Thanks
    Bala

  48. viki Says:

    hi i saw ur web sms service, its very nice, but i saw there is a java library but i am very beginner to this, can u tell me how to use it and if possible can u also tell me how to design an sms application for my nokia handset

  49. nani Says:

    i am getting the following exception

    Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at bash.Send.main(Send.java:13)

    by the way is there any version specifications?

  50. sandy Says:

    Hi,Ashwin,u r jar file is not working.

  51. sandy Says:

    Hi,I am not getting any errors also.

  52. anusha Says:

    hi,when i am using the SMS.class in my application i am getting the following error wwwa.way2sms.com is not working

    plz reply me soon about this error…

  53. anusha Says:

    hi ashwin great work!!!!!! its working after changing it with the other class file (updated 1 i guess)

  54. Rajesh Jain Says:

    Send Free SMS Across India with http://www.smswala.co.in. An excellent site for sending reliable SMS, Wallpapers, movie reviews, music reviews, chat.

  55. Avadhani Says:

    Really a great work Aswin! Congratz…i still want to know one more…… how to send and receive a SMS from a GSM mobile connected to the system using JAVA

  56. charu Says:

    thank a lot dear 4 ur support.i ws waitin 4 it…

  57. Piyush Lunagariya Says:

    Hi..
    How get Response to sending msgs..
    and any idea send only msg not send (sent via way2sms.com)

  58. Piyush Lunagariya Says:

    Hi..
    It send only 100 msg per day..
    I Send more msg
    any idea for that,
    give me Fast..

  59. kaushal Says:

    hi i am getting this problem when i try to run my project using your code and jar file. Plz can you help me out. i am using netbeans 6.7.1. thanks
    error is Warning: Could not find file C:\Users\kaushal\Documents\Downloads\sms.jar to copy

  60. Jass Says:

    Coming to this post after a long time!! Boy your sms api sure seems to be in demand.

    Anyway looking at the demand to circumvent proxy i must say that its just a couple parameters that can be set at runtime. If you want your application to use any particular proxy server. Use the following parameters when you run the java class.
    Example
    >java -Dhttp.proxyHost=ProxyHost -Dhttp.proxyPort=proxyPortNumber

  61. Somasundaram Says:

    Great job Aswin Anand. How can i change “Send via
    WAY2SMS.COM” to my name. :-)

  62. Vijay Says:

    Hey It is really Amazing…!

  63. Sarath Says:

    Thank you very much and greate efforts by you

  64. Sarath Says:

    Hi
    i tried this but the below error is throwing
    Exception in thread “main” java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:519)
    at java.net.Socket.connect(Socket.java:469)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
    at sun.net.www.http.HttpClient.(HttpClient.java:233)
    at sun.net.www.http.HttpClient.New(HttpClient.java:306)
    at sun.net.www.http.HttpClient.New(HttpClient.java:323)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:788)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:832)
    at com.aswinanand.sms.SMSSENDMSG.send(SMSSENDMSG.java:75)
    at com.aswinanand.sms.SMSSENDMSG.main(SMSSENDMSG.java:10)

    Please help me its very urgent

    Thank you very much

  65. shriram Says:

    How to execute that sms jar file to send sms.Pls tell some ideas.

  66. srikanth Says:

    hey, am getting this error.
    I added the jar in my project java build path.
    and imported com.aswinanand.sms;

    The method send(String, String, String, String) in the type SMS is not applicable for the arguments
    ()

  67. Aswin Anand Says:

    Srikanth, are you calling the method correctly?

  68. Priyatham Says:

    Can you please send me the source. My mail id is priyatham.prem@gmail.com

  69. Ravi Says:

    Thank you very much…. It worked

  70. manish Says:

    Can u help to create my own webservice for way2sms, 160by2.com. Can u send me your source code.Thank u.

  71. Nikhil Says:

    Hey Your url does not seem to work !!!

  72. Free SMS Web Service Updated | Waves Says:

    [...] Java [...]

  73. Ganesh Prabhu Says:

    Hi,
    Aswin thanks for a great stuff….

    Now i can able to send msg without seeing advertisement

  74. Aswin Anand Says:

    @Ganesh: Thanks buddy :) Nice to hear that you like it.

  75. Sivanesan Says:

    Dear Ashwin,
    I would like to include sms feature in linux shell script. How do I run this?.

    I saved your program in the name of send_sms.java and tried this,
    java -cp sms.jar send_sms.java
    Result is “The java class is not found: send_sms/java”

    Thanks and Regards,

    Sivanesan.P

  76. Shah Says:

    Hi Ashwin,
    Thank U for Ur Code .. Its a Nice Job..

    I’ve been using ur code in my application for the last 1 month. It was working well without any problem. i was able to send messages frequently without any problems..

    But,
    Now from 3rd December 2009,last Thursday. the message is not being send by accessing ur Jar file.

    Its not even showing any error its executing properly but the message has not been receiving to any mobiles..

    I have been tried with different Users Login In way2sms..

    the message is sending properly when i login directly into way2sms website.. But, its not working when i use through the Jar file..

    Please Tell any solution for this as soon as possible…

    Thanks In advance..

  77. Anu Says:

    hi anand

    tell me how to use sms.jar file in my asp.net website

  78. smsuser Says:

    Hi Aswinanad,

    Your code is a gr8 work..thanks a lot!!
    i have used it for sometime it was working fine.I
    agree with Shah that the code is unable to send sms after 3rd Dec 09.

    Can you pls check?

    Thanks in advance.

  79. Mahendra Vishwakarma Says:

    Hi Ashwinanand,
    I am using your webservice from past 8 months. It is really great. Its a very nice provision you have to all of us. But unfortunately we are unable to access this service now. We will be greatful to you. If you continue to provide the same.
    Thanks. Thanks for providing us such a great idea.

  80. Srikanta Mukherjee Says:

    Your application is not working…It is showing the exception
    The exception is:::::::::::::java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl

    Please help us……..

  81. Parag Says:

    Hi,
    The api is giving some exception now. It was working fine just 2 days back…looks like there has been some change as way2sms.

    The error is
    Exception in thread “main” java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1187)
    at com.aswinanand.sms.SMS.send(SMS.java:75)
    at com.retailnet.mainsite.SendSMS.main(SendSMS.java:8)

  82. Srikanta Mukherjee Says:

    i hava included sms.jar in my lib directory of prject
    and call SMS.send method bu showing:java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl exception….plz help me

  83. Aswin Anand Says:

    Parag, Ashwini, Srikanta, it will be resolved by Monday.

  84. Rakesh Says:

    Hey Ashwin…

    even I am getting the same problem of http response status 500.

    can you please see into the matter….

    Thanx in advance…

  85. Narendra Says:

    Hi anand,
    I am getting following error. Will u help me out

    Exception in thread “main” java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.aswinanand.sms.SMS.send(SMS.java:75)
    at Test.main(Test.java:15)

  86. Anil Says:

    dear ,I am getting the below problem

    Exception in thread “main” java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

  87. Anil Says:

    I am using this line in main method… SMS.send(“XXXXXX”, “XXXXX”, “XXXXX”, “HI”);

  88. hardik Says:

    Hi Aswin,

    I used this webservice and I was able to send sms successfully , but since last 10 days i cant able to send sms using this service and it throws, “invalid login” error…but using the account, i am able to login to way2sms.com…
    Please help me how to proceed further.

  89. Sandeep Says:

    Hi, I have been using this excellent service since the last 5 months…and its really doing great job for us.

    Currently I am not able to send messages through both php and java code. Can you please let me know when the issues would be fixed?

    Waiting for your reply.

    With Regards
    Sandeep

  90. kris Says:

    hai aswin please help us
    - we get this error even after putting v3 sms.jar

    HTTP Status 500 –

    ——————————————————————————–

    type Exception report

    message

    description The server encountered an internal error () that prevented it from fulfilling this request.

    exception

    org.apache.jasper.JasperException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:361)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

    root cause

    java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    com.aswinanand.sms.SMS.send(SMS.java:75)
    org.apache.jsp.SMS_jsp._jspService(SMS_jsp.java:46)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.28 logs.

    ——————————————————————————–

    Apache Tomcat/5.5.28

  91. ranjani Says:

    hai aswin how r u? i used ur sms api and it worked very well in the last month but now it was not working could u please see the problem and make it to work and i need it very urgent.But seriously ur work is great.

  92. prasad Says:

    ur send sms 2 mobile program using java not send msgs to any mobile what is the problem

  93. prasad Says:

    program run successfully but messages are not come to mobile what is the proble
    urgent

  94. kris Says:

    Hai friends,
    Have any one found the solution for 500 error.please post the solution i need it urgently.

  95. ranjani Says:

    hi aswin,
    have u solved the problem?please post the solution

  96. Shailesh Says:

    Hi Guys,
    I have created a tool to send messages sometime back and have enhanced it to a great extent, try it out and let me know what you guys think:

    shaileshsoliwal.blogspot.com/2009/10/send-free-sms-using-way2sms.html

  97. Priya Says:

    Is there any possiblity to get list of files in the remote server…
    and also…
    is there any possiblity to get html table informations using Java code…

  98. Priya Says:

    java code to retrive informations in remote database and store it in local database

  99. heena Says:

    i m not able to swnd any msg from way2sms.com

  100. thyagarajan Says:

    i just converted sms.jar file into sms.dll file through
    ikvm tool then i add sms.dll file into web refrence to asp.net application using vb.net code behind page
    i imported that sms.dll file i cannot able use sms.send method in vb.net coding plse help me

  101. Nishant Kumar Says:

    I need urget help. I have to submit my project in class.
    I will be grateful for ur help.

    I am behind a proxy so a liitle modification in code :
    After every uc = (HttpURLConnection) u.openConnection(); line i added following:

    uc.setRequestProperty( “Proxy-Authorization”, “Basic ” + new sun.misc.BASE64Encoder().encode( (proxyUser + “:” + proxyPassword).getBytes() ) );

    I am getting the following error
    java.net.unknownHostException :wwwd.way2sms.com

    On applying try catch i got that this error is from line

    pw = new PrintWriter(new OutputStreamWriter(uc.getOutputStream()), true);

    Please help:
    My source code is :

    //package com.aswinanand.sms;

    import java.io.*;
    import java.net.*;
    import java.util.Vector;

    public class SMS
    {
    static URL u=null;
    static HttpURLConnection uc=null;
    static PrintWriter pw=null;
    static BufferedReader br=null;
    static String cookie=””;
    static String proxyUser = “29****”, proxyPassword = “c*******”;
    static String temp = “”;

    public static void send(String uid, String pwd, String phone, String msg) throws IOException {
    String content = “username=” + uid + “&password=” + pwd;
    if (uid == null || 0 == uid.length())
    throw new IllegalArgumentException(“User ID should be present.”);
    else
    uid = URLEncoder.encode(uid, “UTF-8″);

    if (pwd == null || 0 == pwd.length())
    throw new IllegalArgumentException(“Password should be present.”);
    else
    pwd = URLEncoder.encode(pwd, “UTF-8″);

    if (phone == null || 0 == phone.length())
    throw new IllegalArgumentException(“At least one phone number should be present.”);

    if (msg == null || 0 == msg.length())
    throw new IllegalArgumentException(“SMS message should be present.”);
    else
    msg = URLEncoder.encode(msg, “UTF-8″);

    System.out.println(“Format Cheking over “);

    Vector numbers = new Vector();
    String pharr[];
    if (phone.indexOf(‘;’) >= 0) {
    pharr = phone.split(“;”);
    for (String t : pharr) {
    try
    {
    numbers.add(Long.valueOf(t));
    }
    catch (NumberFormatException ex)
    {
    throw new IllegalArgumentException(“Give proper phone numbers.”);
    }
    }
    } else {
    try
    {
    numbers.add(Long.valueOf(phone));
    }
    catch (NumberFormatException ex)
    {
    throw new IllegalArgumentException(“Give proper phone numbers.”);
    }
    }

    if (0 == numbers.size())
    throw new IllegalArgumentException(“At least one proper phone number should be present to send SMS.”);

    /*==================================================================*/

    // Login

    try{
    /* System.setProperty(“http.proxySet”, “true”);
    System.setProperty(“http.proxyHost”, “10.1.1.19″);
    System.setProperty(“http.proxyPort”, “80″);
    */
    //u = new URL(“http”,”10.1.1.19″,80,”http://wwwd.way2sms.com/auth.cl”);
    u = new URL(“http://wwwd.way2sms.com/auth.cl”);
    uc = (HttpURLConnection) u.openConnection();
    uc.setRequestProperty( “Proxy-Authorization”, “Basic ” + new sun.misc.BASE64Encoder().encode( (proxyUser + “:” + proxyPassword).getBytes() ) );
    System.out.println(“Connected to auth.cl”);
    }
    catch(Exception e)
    {
    System.out.println(“error in Connection to auth.cl ” +e);
    System.exit(0);
    }
    try{
    uc.setDoOutput(true);
    uc.setRequestProperty(“User-Agent”, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″);
    uc.setRequestProperty(“Content-Length”, String.valueOf(content.length()));
    uc.setRequestProperty(“Content-Type”, “application/x-www-form-urlencoded”);
    uc.setRequestProperty(“Accept”, “*/*”);
    uc.setRequestMethod(“POST”);
    uc.setInstanceFollowRedirects(false); // very important line :)
    System.out.println(“Post request sent from here”);
    }
    catch(Exception e)
    {System.out.println(“error in setting property line 98″);
    System.exit(0);}
    try{
    pw = new PrintWriter(new OutputStreamWriter(uc.getOutputStream()), true);
    System.out.println(“Printwriter ceated”);
    pw.print(content);
    pw.flush();
    pw.close();
    System.out.println(“Print writer success ful”);
    }
    catch(Exception e)
    {
    System.out.println(“Erro in printwriter “+e);
    System.exit(0);
    }
    try{
    br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    while ( (temp = br.readLine()) != null ) {}
    cookie = uc.getHeaderField(“Set-Cookie”);
    System.out.println(“Cookie read is “+cookie);
    }
    catch(Exception e)
    {
    System.out.println(“error in cookie reading “+e);
    System.exit(0);
    }
    // Send SMS to each of the phone numbers
    u = null; uc = null;
    for (long num : numbers)
    {
    System.out.println(“Sending message for ever number”);
    System.out.println(“Current numbet is “+num);
    //content = “HiddenAction=instantsms&login=&pass=&custid=undefined&MobNo=” + num + “&textArea=” + msg;
    content = “custid=undefined&HiddenAction=instantsms&Action=custfrom50000&login=&pass=&MobNo=” + num + “&textArea=” + msg + “&qlogin1=Gmail+Id&qpass1=******&gincheck=on&ylogin1=Yahoo+Id&ypass1=******&yincheck=on”;
    try{
    u = new URL(“http://wwwd.way2sms.com/FirstServletsms?custid=”);
    // u = new URL(“http”,”10.1.1.19″,80,”http://wwwd.way2sms.com/FirstServletsms?custid=”);
    uc = (HttpURLConnection) u.openConnection();
    uc.setRequestProperty( “Proxy-Authorization”, “Basic ” + new sun.misc.BASE64Encoder().encode( (proxyUser + “:” + proxyPassword).getBytes() ) );
    System.out.println(“Connected to first servlet for cust id “);
    }

    catch(Exception e)
    {
    System.out.println(“eror in connectioj to firaat servlet”+e);
    System.exit(0);
    }
    try{

    uc.setDoOutput(true);
    uc.setRequestProperty(“User-Agent”, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″);
    uc.setRequestProperty(“Content-Length”, String.valueOf(content.getBytes().length));
    uc.setRequestProperty(“Content-Type”, “application/x-www-form-urlencoded”);
    uc.setRequestProperty(“Accept”, “*/*”);
    uc.setRequestProperty(“Cookie”, cookie);
    uc.setRequestMethod(“POST”);
    uc.setInstanceFollowRedirects(false);
    System.out.println(“Post request to first servlet success”);
    }
    catch(Exception e)
    {
    System.out.println(“error After connection to first servlet”+e);
    System.exit(0);
    }
    try{
    pw = new PrintWriter(new OutputStreamWriter(uc.getOutputStream()), true);
    pw.print(content);
    pw.flush();
    pw.close();
    br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    while ( (temp = br.readLine()) != null ) {}
    br.close();
    u = null;
    uc = null;
    System.out.println(“Printwritet sucess”);
    }
    catch(Exception e)
    {
    System.out.println(“error Here in printwriter firstservlet”);}
    System.exit(0);
    }

    // Logout
    try{
    // u = new URL(“http”,”10.1.1.19″,80,”http://wwwd.way2sms.com/jsp/logout.jsp”);
    u = new URL(“http://wwwd.way2sms.com/jsp/logout.jsp”);
    uc = (HttpURLConnection) u.openConnection();
    uc.setRequestProperty( “Proxy-Authorization”, “Basic ” + new sun.misc.BASE64Encoder().encode( (proxyUser + “:” + proxyPassword).getBytes() ) );
    System.out.println(“Connected to log out”);
    uc.setRequestProperty(“User-Agent”, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″);
    uc.setRequestProperty(“Accept”, “*/*”);
    uc.setRequestProperty(“Cookie”, cookie);
    uc.setRequestMethod(“GET”);
    uc.setInstanceFollowRedirects(false);
    br = new BufferedReader(new InputStreamReader(uc.getInputStream()));
    while ( (temp = br.readLine()) != null ) {}
    br.close();
    u = null;
    uc = null;
    }
    catch(Exception E)
    {System.out.println(“eror in logout”);}
    }

    public static void main(String args[])
    {
    SMS s = new SMS();
    try{
    s.send(“988#####1″,”ra#####i”,”98########1″,”From Java Code”);
    }
    catch(Exception e)
    {System.out.println(“Eror in main “+e);}
    }
    }

  102. Amulya Says:

    Hi,

    I tried the sms api for java, but its showing error as follows:

    java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.aswinanand.sms.SMS.send(SMS.java:75)
    at com.p2s.test.SendSMSviaCode.main(SendSMSviaCode.java:15)

    please help

  103. Nishant Kumar Says:

    Hi amulya!!

    If u r behind a proxy then use the same technique as i have done of proxy authorization.
    If not behind a proxy , then I wonder y an error as I have done it yesterday but getting a different error posted above

  104. Shailesh Says:

    To Setup your proxy in code, use:

    System.getProperties().put( “proxySet”,”true” );
    System.getProperties().put( “proxyHost”, host );
    System.getProperties().put( “proxyPort”, port );

  105. Babun Says:

    Please solve the http error 500 problem. how can i download that auth.cl file from way2sms?

  106. Barnali Rakshit Says:

    Hi,
    some months back i tried ur sms.jar file to send sms, at that time it was working fine, then i added this feature in project and now it is not working.
    The api is giving some exception now.Looks like there has been some changes in way2sms.

    The error is
    Exception in thread “main” java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1187)
    at com.aswinanand.sms.SMS.send(SMS.java:75)
    at com.retailnet.mainsite.SendSMS.main(SendSMS.java:8)

    please help me. its urgent.

  107. Shailesh Says:

    Try the application I have posted, it works with new changes made to way2sms.com…

  108. Barnali Rakshit Says:

    shailesh
    ur application is showing that
    [Login Successful...]
    [Number of messages to be sent = 1]
    [(1 out of 1) Sending message to : 9910155893]
    [Failed to send the message...]
    [Logout successfull ...]

    it is not sending sms……….

  109. Basavaraj Says:

    Hi,

    I am also getting the HTTP 500 error code.

    java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1170)
    at com.basava.test.SMS.send(SMS.java:90)
    at com.basava.test.SMS.main(SMS.java:17)

    could you please help me?

    Thanks & Regards,
    Basavaraj

  110. Madhana Kumar Says:

    Hello Sir,
    Exception e : java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl

    This is the error I got, Sir.
    Why its not working for me?

  111. Madhana Kumar Says:

    Hello Sir,
    Exception e : java.io.IOException: Server returned HTTP response code: 500 for URL: http://wwwd.way2sms.com/auth.cl

    This is the error I get.
    Pls help me out.
    Its part of my project.
    If you know the ans u can mail me @ madhanakumar@hotmail.com
    Pls anyone reply soon

  112. Shailesh Says:

    Hi Madhana and Basavaraj,
    I Have sent you the source, let me know if you have issues with that…

  113. vivek Says:

    hi
    I have got following exception while running the code

    java.net.UnknownHostException: wwwd.way2sms.com
    at java.net.PlainSocketImpl.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.plainConnect(Unknown Sour
    ce)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown S
    ource)
    at SMS.send(SMS.java:75)
    at SMS.main(SMS.java:138)
    Hello World!

    Please help me.

  114. Sandeep Says:

    Hi Sailesh,

    Hope you have solved the issue. Please mail the code to chadasandu@gmail.com

  115. vivek Says:

    hi aswin
    While running the code I have got following Exception…
    java.io.IOException: Server returned HTTP response code: 500 for URL: http://www
    2.way2sms.com/auth.cl
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
    urce)
    at SMS.send(SMS.java:96)
    at SMS.main(SMS.java:160)

    Pls help me.It’s urgent.If possible pls send me reply on my mail.

  116. Arthanari Says:

    Hello sir,
    When i m trying this code in my JSP Web Application i m getting following error..

    Jan 22, 2010 9:56:25 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.Error: Unresolved compilation problems:
    Syntax error, ‘for each’ statements are only available if source level is 5.0
    Syntax error, ‘for each’ statements are only available if source level is 5.0
    Can only iterate over an array or an instance of java.lang.Iterable

    at sms.SMS.send(SMS.java:34)
    at org.apache.jsp.sendsms_jsp._jspService(sendsms_jsp.java:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
    at java.lang.Thread.run(Unknown Source)

    Can u give me the solution..

  117. Gaurav Says:

    Hello,
    I am trying to use this code but its not giving any error nor its sending any message. I am using this as an jar file and in main method writing only the send SMS method..please help me

  118. Varun Shah Says:

    Hi ,
    I have tried SMS.java but it is not sending any message to mobile.

    please check it is working or stopped by way2sms.

  119. Shailesh Says:

    Uploaded new version, with really cool features.. let me know what you guys think..

    http://shaileshsoliwal.blogspot.com/2009/10/send-free-sms-using-way2sms.html

  120. jatin Says:

    thks shailesh this works.

  121. Sandesh Says:

    Hi,
    How to use it in ASP.NET

  122. abhijeet Says:

    hi,
    download jar for way2sms, i have an account also,but i m not able to send sms through my account.can anyone help me with latest source code.

    thanks in advance mail me if possible abhijeetjain14@gmail.com

  123. Novice Developer Says:

    Ashwin, Recently the way2sms site has seen some modification, so your jar file is unable to help.
    We are getting exceptions.

    Can you check it and give us an updated jar file for use.

    Thanks in advance.

  124. Shailesh Says:

    Hi Guys,
    I have updated the user Interface to ensure it works for every user, also have created an api as requested by aswin, since he’s been busy :)

    http://shaileshsoliwal.blogspot.com/2009/10/send-free-sms-using-way2sms.html

    Regards,
    Shailesh.

  125. Selwyn Says:

    Hi Ashwin,
    I have added this webservice in a .net Project but after accessing this service i am not able to access the service i am continuously getting the issue of “invalid login” please help.

  126. Shailesh Says:

    Hi Guys,
    I have updated the user Interface to ensure it works for every user, also have created an api as requested by aswin, since he’s been busy :)

    Regards,
    Shailesh.

  127. pradeep Says:

    Can you please send me the source code for calling way2sms service

  128. Magesh Says:

    hi aswin,

    am getting the following error can u please explain y it was coming

    Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at com.ptpl.shared.dbmanager.Sms.main(Sms.java:12)

  129. nana Says:

    Hi Aswin,

    I compiled code. but no error. am not able to receive messages. is anything changed in URL.? Thanks in Advance.

  130. kmohan Says:

    Hi Ashwin,

    I deployed the code and jar file as per your description. But this code is not sending any messages or not even showing any error messages. Can you please help me out in this. If possible please post the code to my mail id.

    Thanks in advance
    Regards,
    kmohan

  131. Neil Says:

    Hey aswin,
    i used the web-service for the first time today.. it says invalid login.. i chekd the id and password.. and i also tried using the jar.. no sms was sent, so im assuming it may hve a similar prob.. cud u let me knw if there is a prob?

  132. prakash Says:

    please give me steps to to develop this code in my sys

  133. vikas Says:

    Hi, I have send the sms through ur jar but neither giving any exception not sending the msgs when i used the wsdl2java tool and used the wsdl url and made the stubs and then ran the service through my java programm
    it is showing the invalid login error while I am able to login in way2sms.com through those credentials. Please reply its urgnt

  134. Shashank Acharya Says:

    Hi Aswin Anand,
    I tried your code of sending sms through Netbeans.
    It’s build successfully but we can’t sms to specified phone number.

    Can you help me.

    Thanks In advance.

  135. diya Says:

    hi Aswin Anand , i convert jar file into dll to use in asp.net but at runtime it gives the error

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    The type ‘java.lang.Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘IKVM.OpenJDK.Core, Version=0.42.0.3, Culture=neutral, PublicKeyToken=13235d27fcbfff58′.

    PLEASE GIVE THE UPDATED WEB REFERENCE FOR ASP.NET IF POSSIBLE..!!

  136. mekala Says:

    Hi Aswin Anand

    Greetings from mekala!

    i directly use the hyperlink http://www.example.com/sms/sendsms.php??uid=mynumber&pwd=mypassword&phone=receivernumber&msg=mymessage in response.redirect command in my asp.net page. But it returns a invalid login message. Any alternation to post sms. before that i used the web reference of spiritssoft.com. but now it doesn’t work at all.

    can you help me

    Thanks in advance

  137. Apekhsit Says:

    Hi Aswin
    I tried this sms web service.It is not giving me error but it is not also sending sms.Plz suggest me solution

  138. anand Says:

    not working …..
    There is no error but msg is not sending

  139. Vivin Says:

    Hi Guys, i have fixed that issue and planning to release it soon(may this) on my server based on the amount of usage. So, those who are interested can reach me at bhaskar.vivin@gmail.com

  140. tanik Says:

    Anand
    working link:-
    http://haryanaithub.com/sendsms.php?uid=username&pwd=password&phone=mobilenumber&msg=message

    tanik_kukreja@rediffmail.com

  141. Vivin Says:

    Hi Guys, I have fixed the issue and planning to deploy/host on my server based on the usage. you can send your queries and requests to bhaskar(dot)vivin(at)gmail(dot)com

  142. Sandesh Says:

    Hi All,

    Im using webservice in my asp.net application using Responce.Redirect(url…).The problem wen i use like this is my application navigates to the page containing success message.Is there any way we can internally generate an http request without navigating to next page.

  143. vaibhav Says:

    Hi ARCHIE,

    i am getting following error pls send me source code for handling this.my mail id is vaibhav.galne@rsystems.com

    Error-
    Exception in thread “main” java.net.ConnectException: Connection refused: connec
    t
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.Socket.connect(Socket.java:507)
    at java.net.Socket.connect(Socket.java:457)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
    at sun.net.www.http.HttpClient.(HttpClient.java:214)
    at sun.net.www.http.HttpClient.New(HttpClient.java:287)
    at sun.net.www.http.HttpClient.New(HttpClient.java:299)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
    onnection.java:792)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
    ction.java:744)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
    .java:669)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLCo
    nnection.java:836)
    at SMS.send(SMS.java:71)
    at Message.main(Message.java:10)

  144. Vivin Says:

    Hi Guys,
    I have fixed these issues and deployed the working version and you can use it
    through

    http://vivinsms.appspot.com/vivinsms?uid=9949123456&pwd=abcdefgh&phone=9949123456&msg=what ever message you want to send as sms.

    You can reach me through bhaskar(dot)vivin(at)gmail(dot)com

    for further help.

  145. Vivin Says:

    Hi Guys,
    I have fixed these issues and deployed the working version and you can use it
    through

    http://vivinsms.appspot.com/vivinsms?uid=userid&pwd=password&phone=phonenumber&msg=Message

    You can reach me through bhaskar(dot)vivin(at)gmail(dot)com

    for further help.

  146. Vivin Says:

    Hi all,
    The issues in the web service is fixed and you can find the details at http://hubpages.com/hub/Free-SMS-web-service

  147. Girish C P Says:

    Hai , i am using service
    http://www.aswinanand.com/sendsms.php
    but not able to send the msg. getiing fallowing error please help me

    The content type text/xml; charset=ISO-8859-1 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 467 bytes of the response were: ‘invalid login’.

  148. devi Says:

    hi aswin…. i am getting following errors pls help me… its very urgent…do u know how to get new email alerts on mobile via free sms… did u know pls send the procedure….rply immediately…thk u…

  149. devi Says:

    hi aswin…. i am getting following errors pls help me… its very urgent…do u know how to get new email alerts on mobile via free sms… did u know pls send the procedure….rply immediately…thk u…

    java.io.IOException: Server returned HTTP response code: 400 for URL: http://wwwd.way2sms.com/FirstServletsms?custid=
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.aswinanand.sms.SMS.send(SMS.java:99)
    at good.sss.main(sss.java:7)

  150. chhaya Says:

    hiiii…i had try as you mention above…..
    i had added the jar file…and write
    import com.aswinanand.sms;

    public static void main(String… args) {

    SMS.send(“9933445566″, “password”, “9001122334;9887712345″, “message”);

    }

    there isn’t any error…but on mobile i codun’t get message..plz help…

  151. chhaya Says:

    hiii….if possible please send me code on shahchhaya34@yahoo.com

  152. Rishi Says:

    Hi Ashwin, i am using netbeans as IDE, and using your library for sending SMS, its Showing no error but also not sending any SMS… Please reply ASAP.

  153. NPrabhu Says:

    I noticed that to execute the code, we need to make the following changes.

    String content = “username=” + uid + “&password=” + pwd + “&login=Login”;
    URL u = new URL(“http://www1.way2sms.com/auth.cl”);

    content=”custid=undefined&HiddenAction=instantsms&Action=custfrom1000000&login=&pass=&MobNo=” + num + “&textArea=” + msg;
    u = new URL(“http://www1.way2sms.com//FirstServletsms?custid=”);

    u = new URL(“http://www1.way2sms.com//jsp/logout.jsp”);

  154. Ram Says:

    Hi

    I downloaded SMS.java from the link (Version 0.2, 0.3: Download here.) and invoked the method send from main method.

    I am getting an error java.net.ConnectException: Connection timed out: connect

    Please help..

    public static void main(String args[]) {

    try {
    SMS.send(“**********”, “*****”, “***********”, “hello”);
    } catch(Throwable t){
    t.printStackTrace();
    }

    }

  155. Raam Says:

    Hi Ashwin,

    I saw your code. It is excellent but When I tried to use it, it has not send sms and it is not displaying errors also. Please reply me.

    Regards
    Raam…..

  156. pratik Says:

    hi friends this great site.now i introduce a new site for sms fans http://www.freesmsapi.com .this is a grate for the people who generally connect with sms.i am sure once you visit you will visit regularly.just go there and check then tell me i am right or wrong.Thanks.I like to thanks owner of this site for sharing resources and information.Thanks

  157. Raam Says:

    Thank you very much pratik.

  158. arunkumar Says:

    Hi Aswin,I am trying to send sms directly by giving send()method and Main() method in same class and i kept a throws IOException for main() method in the same class SMS.java, but there is no error i found and i didnt get any sms..how it is possible can clearly send the code with explanation in java only..please give me reply thanku..

  159. arunkumar Says:

    my email id is arun.schoolmate@gmail.com.plz give me clear explanation.and java code.

  160. Ksk Says:

    Hi, i can successfully compile and run the program but, message not delived to desired mobile…. no exceptions… can U pls help to solve this problem… thanks in advance..

  161. Saurabh Says:

    Hi
    for using this we need to be registered to way2sms.. is there any webservice thorough which we can directly register to it without going to the site.

  162. shameen Says:

    Hey guyzz, just check out http://www.beat2day.co.in and you will get everything that you want related to it. i found a code on it and it really helped me.. thanx to its makers..

  163. Tathagata Says:

    Hi Anand,

    I just used sms.jar file and run the code. It’s not giving any compilation error. The program is running successfully. But still not getting any SMS. So is there a way to find out the reason?

    When I am using waytosms it’s properly sending SMS. Did I miss something?

    My mail id : tbiddu@yahoo.com

  164. balamurugan Says:

    i have executed the above code. no errors but no result
    that is i didnt receive any sms

  165. Ksk Says:

    Hi,

    uc.setRequestProperty(“User-Agent”, “Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5″);

    what it represents. with out firefox our program can run??

    help me in this confusion

    My mail id:visitmyaccount@gmail.com

  166. ravi Says:

    Hey guyzz, just check out http://www.beat2day.co.in/default.aspx and you will get everything that you want related to it. i found a code on it and it really helped me.. thanx to its makers..

  167. utkarsh ADMIN-BEAT2DAY Says:

    hey checkout this…hope it solvs ur purpose…

    beat2day.co.in now provides an API to send SMS…

    http://www.beat2day.co.in/sms.aspx?user=&pass=&mbno=&mseg=

  168. Niket Talati Says:

    Thanks utkarsh it works…..
    thanks a lot…..

  169. Admin Says:

    now install on your mobile
    http://mixmasala.webfrnd.com/m/MobileApplication3.jad

    or maja lo fullonsms,way2sms,16by2,mycantos,site2sms

  170. Sebin Joseph Says:

    This program works. No runtime error or something..but no output to mobile device..What will be the reason? Can you help me?.