Free SMS Web Service India – Java Library
January 20th, 2009
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:
Improvements:
Some immediate improvements are underway right now:
- Code cleanup.
- Organize the code in methods. Right now everything is in one big method.
- Invalid login notification.
- Support for authenticated proxy servers.
Change Log:
Version 0.2, 0.3:
- Implemented the major changes that happened at way2sms. Download here.
Version 0.1:
- First release with working code base for sending SMS through way2sms.
Please take it for a test drive and give feedback.
January 20th, 2009 at 6:02 pm
I ought to check this out !
January 20th, 2009 at 6:15 pm
Jaskirat, please do check it out and give feedback
January 20th, 2009 at 6:48 pm
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)
January 20th, 2009 at 11:15 pm
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.
January 21st, 2009 at 11:08 am
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
January 21st, 2009 at 11:53 am
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.
January 21st, 2009 at 2:09 pm
oh ok , i will try , is there any method to overcome from these proxy servers.
January 21st, 2009 at 4:13 pm
Archie, support is being added for proxy servers. Please stay tuned to this post for more details.
January 21st, 2009 at 6:04 pm
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
January 21st, 2009 at 7:32 pm
Archie, please use the “Contact Me” link on the sidebar.
January 22nd, 2009 at 12:06 pm
[...] Java JAR Library [...]
January 26th, 2009 at 7:22 pm
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.
January 27th, 2009 at 12:04 pm
Vivin, I prepared the java version myself. A .NET DLL is still in the works.
January 28th, 2009 at 8:18 am
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.
January 28th, 2009 at 11:46 am
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.
January 28th, 2009 at 2:36 pm
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?
January 29th, 2009 at 5:00 pm
[...] did the above mentioned stuff for this Free SMS Java Library [...]
January 29th, 2009 at 5:47 pm
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
January 29th, 2009 at 5:53 pm
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.
January 29th, 2009 at 6:52 pm
Thank you Aswin for your kind reply.Please intimate me as early as possible.Your reply will help me to further proceed my project.
February 5th, 2009 at 5:16 pm
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.
February 6th, 2009 at 4:57 pm
Vivin, can you download the java library again, try it and tell me?
February 11th, 2009 at 2:54 pm
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.
February 11th, 2009 at 2:58 pm
Balaji, giving your user id as your 10 digit phone number and try again.
February 12th, 2009 at 8:17 am
Thank you Aswin. It works fine.
February 12th, 2009 at 11:23 am
[...] Java Library to send SMS - http://www.aswinanand.com/blog/2009/01/free-sms-web-service-java-library/ [...]
February 21st, 2009 at 11:02 am
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.
March 2nd, 2009 at 9:36 pm
Thanks a lot
March 2nd, 2009 at 9:56 pm
Can any one tell me about another API that works in europe?
Thanks
March 2nd, 2009 at 10:04 pm
Anyone know an API to send sms to a mobiles in Europe?
Any suggestion to cifuentesgenoy@yahoo.com
Thanks!
March 3rd, 2009 at 6:00 pm
Hi
Aswin
Thanks for ur webservice. It’s really great..
March 10th, 2009 at 12:55 pm
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.
March 24th, 2009 at 10:29 am
i am trying to use your send sms application,please forward your code,its urgent.
Thanking U
April 4th, 2009 at 12:30 pm
HI Ashwin…. u r simply brilliant, Hats off to you sir.
The service and jar files are really useful for the starters.
April 9th, 2009 at 3:34 pm
Hi this blog is very useful thank you very much my friend
April 13th, 2009 at 12:32 pm
Hi Ashwin, how are you. after a long time to see ur blog.
April 15th, 2009 at 2:28 pm
Hey Vivin
im very good. Hope you are doing good as well.
April 16th, 2009 at 9:39 pm
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.
May 2nd, 2009 at 6:29 pm
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.
May 2nd, 2009 at 7:24 pm
Sure Vivin. Will check this and let you know.
May 4th, 2009 at 11:53 am
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.
May 14th, 2009 at 12:59 pm
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
June 17th, 2009 at 9:53 am
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)
June 25th, 2009 at 2:54 pm
HI ,
YOUR SMS API IS NICE.
THANKS & REGARDS
VINOD KELWANI
July 5th, 2009 at 4:33 pm
Thank you i worked nice for me
great job
July 19th, 2009 at 3:28 am
hey ashwin..
great work buddy !!
it works.. very efficiently
-cheers
July 20th, 2009 at 10:53 am
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
July 26th, 2009 at 12:20 am
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
July 28th, 2009 at 8:01 pm
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?
July 30th, 2009 at 4:04 pm
Hi,Ashwin,u r jar file is not working.
July 30th, 2009 at 4:05 pm
Hi,I am not getting any errors also.
August 4th, 2009 at 12:18 am
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…
August 4th, 2009 at 12:25 am
hi ashwin great work!!!!!! its working after changing it with the other class file (updated 1 i guess)
August 9th, 2009 at 10:23 pm
Send Free SMS Across India with http://www.smswala.co.in. An excellent site for sending reliable SMS, Wallpapers, movie reviews, music reviews, chat.
August 18th, 2009 at 8:10 pm
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
August 28th, 2009 at 9:00 pm
thank a lot dear 4 ur support.i ws waitin 4 it…
September 8th, 2009 at 4:15 pm
Hi..
How get Response to sending msgs..
and any idea send only msg not send (sent via way2sms.com)
September 10th, 2009 at 7:10 pm
Hi..
It send only 100 msg per day..
I Send more msg
any idea for that,
give me Fast..
October 2nd, 2009 at 11:21 pm
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
October 22nd, 2009 at 1:17 am
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
October 22nd, 2009 at 11:54 am
Great job Aswin Anand. How can i change “Send via
WAY2SMS.COM” to my name.
November 3rd, 2009 at 1:46 pm
Hey It is really Amazing…!
November 5th, 2009 at 2:48 pm
Thank you very much and greate efforts by you
November 9th, 2009 at 2:08 pm
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
November 13th, 2009 at 2:01 pm
How to execute that sms jar file to send sms.Pls tell some ideas.
November 18th, 2009 at 7:14 pm
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
()
November 18th, 2009 at 8:18 pm
Srikanth, are you calling the method correctly?
November 21st, 2009 at 12:04 am
Can you please send me the source. My mail id is priyatham.prem@gmail.com
November 21st, 2009 at 11:37 am
Thank you very much…. It worked
November 25th, 2009 at 7:29 pm
Can u help to create my own webservice for way2sms, 160by2.com. Can u send me your source code.Thank u.
December 3rd, 2009 at 4:40 pm
Hey Your url does not seem to work !!!
December 4th, 2009 at 1:35 am
[...] Java [...]
December 4th, 2009 at 1:23 pm
Hi,
Aswin thanks for a great stuff….
Now i can able to send msg without seeing advertisement
December 4th, 2009 at 5:53 pm
@Ganesh: Thanks buddy
Nice to hear that you like it.
December 5th, 2009 at 4:12 pm
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
December 5th, 2009 at 6:07 pm
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..
December 12th, 2009 at 12:30 pm
hi anand
tell me how to use sms.jar file in my asp.net website
December 15th, 2009 at 7:01 pm
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.
December 17th, 2009 at 11:44 am
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.
December 17th, 2009 at 7:37 pm
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……..
December 18th, 2009 at 10:31 am
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)
December 18th, 2009 at 6:45 pm
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
December 18th, 2009 at 7:14 pm
Parag, Ashwini, Srikanta, it will be resolved by Monday.
December 21st, 2009 at 1:17 am
Hey Ashwin…
even I am getting the same problem of http response status 500.
can you please see into the matter….
Thanx in advance…
December 22nd, 2009 at 1:29 pm
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)
December 22nd, 2009 at 3:03 pm
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)
December 22nd, 2009 at 3:05 pm
I am using this line in main method… SMS.send(“XXXXXX”, “XXXXX”, “XXXXX”, “HI”);
December 22nd, 2009 at 5:07 pm
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.
December 23rd, 2009 at 5:39 pm
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
December 25th, 2009 at 6:55 pm
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
December 30th, 2009 at 10:34 pm
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.
December 31st, 2009 at 3:10 pm
ur send sms 2 mobile program using java not send msgs to any mobile what is the problem
December 31st, 2009 at 3:19 pm
program run successfully but messages are not come to mobile what is the proble
urgent
January 3rd, 2010 at 10:50 pm
Hai friends,
Have any one found the solution for 500 error.please post the solution i need it urgently.
January 4th, 2010 at 12:10 am
hi aswin,
have u solved the problem?please post the solution
January 4th, 2010 at 11:34 am
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
January 4th, 2010 at 4:00 pm
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…
January 4th, 2010 at 4:02 pm
java code to retrive informations in remote database and store it in local database
January 6th, 2010 at 12:12 pm
i m not able to swnd any msg from way2sms.com
January 6th, 2010 at 5:38 pm
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
January 8th, 2010 at 12:48 am
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);}
}
}
January 8th, 2010 at 3:06 pm
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
January 8th, 2010 at 4:38 pm
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
January 8th, 2010 at 6:54 pm
To Setup your proxy in code, use:
System.getProperties().put( “proxySet”,”true” );
System.getProperties().put( “proxyHost”, host );
System.getProperties().put( “proxyPort”, port );
January 10th, 2010 at 3:09 pm
Please solve the http error 500 problem. how can i download that auth.cl file from way2sms?
January 15th, 2010 at 9:58 am
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.
January 16th, 2010 at 8:51 am
Try the application I have posted, it works with new changes made to way2sms.com…
January 16th, 2010 at 10:38 am
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……….
January 18th, 2010 at 9:04 pm
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
January 19th, 2010 at 5:01 am
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?
January 19th, 2010 at 5:12 am
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
January 19th, 2010 at 9:35 pm
Hi Madhana and Basavaraj,
I Have sent you the source, let me know if you have issues with that…
January 20th, 2010 at 11:44 am
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.
January 20th, 2010 at 3:35 pm
Hi Sailesh,
Hope you have solved the issue. Please mail the code to chadasandu@gmail.com
January 21st, 2010 at 5:21 pm
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.
January 22nd, 2010 at 10:48 pm
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..
January 25th, 2010 at 7:09 am
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
January 29th, 2010 at 6:32 am
Hi ,
I have tried SMS.java but it is not sending any message to mobile.
please check it is working or stopped by way2sms.
January 29th, 2010 at 11:57 am
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
February 6th, 2010 at 2:11 pm
thks shailesh this works.
February 8th, 2010 at 8:52 am
Hi,
How to use it in ASP.NET
February 11th, 2010 at 12:00 pm
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
February 11th, 2010 at 3:09 pm
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.
February 15th, 2010 at 2:50 pm
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.
February 16th, 2010 at 10:35 am
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.
February 19th, 2010 at 11:34 am
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.
March 6th, 2010 at 4:40 pm
Can you please send me the source code for calling way2sms service
March 6th, 2010 at 7:07 pm
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)
March 10th, 2010 at 11:04 am
Hi Aswin,
I compiled code. but no error. am not able to receive messages. is anything changed in URL.? Thanks in Advance.
March 15th, 2010 at 9:04 am
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
March 15th, 2010 at 1:10 pm
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?
March 16th, 2010 at 6:21 am
please give me steps to to develop this code in my sys
April 1st, 2010 at 8:43 am
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
April 2nd, 2010 at 8:05 am
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.
April 5th, 2010 at 9:21 pm
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..!!
April 8th, 2010 at 5:17 am
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
April 13th, 2010 at 7:20 pm
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
April 27th, 2010 at 7:56 pm
not working …..
There is no error but msg is not sending
May 8th, 2010 at 8:08 pm
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
May 9th, 2010 at 11:36 pm
Anand
working link:-
http://haryanaithub.com/sendsms.php?uid=username&pwd=password&phone=mobilenumber&msg=message
tanik_kukreja@rediffmail.com
May 10th, 2010 at 5:35 pm
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
May 13th, 2010 at 11:05 am
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.
May 18th, 2010 at 3:10 pm
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)
May 21st, 2010 at 1:00 pm
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.
May 21st, 2010 at 1:29 pm
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.
May 24th, 2010 at 10:18 am
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
May 28th, 2010 at 4:10 pm
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’.
May 29th, 2010 at 10:59 am
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…
May 29th, 2010 at 11:00 am
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)
June 3rd, 2010 at 5:49 pm
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…
June 3rd, 2010 at 6:26 pm
hiii….if possible please send me code on shahchhaya34@yahoo.com
June 5th, 2010 at 12:41 pm
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.
June 21st, 2010 at 1:03 pm
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”);
July 27th, 2010 at 4:36 pm
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();
}
}
August 11th, 2010 at 11:29 am
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…..
August 12th, 2010 at 10:29 am
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
August 20th, 2010 at 10:13 am
Thank you very much pratik.
September 8th, 2010 at 12:06 pm
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..
September 8th, 2010 at 12:08 pm
my email id is arun.schoolmate@gmail.com.plz give me clear explanation.and java code.
September 12th, 2010 at 4:48 pm
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..
October 29th, 2010 at 11:23 pm
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.
January 11th, 2011 at 11:05 pm
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..
January 12th, 2011 at 12:46 pm
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
January 27th, 2011 at 8:27 pm
i have executed the above code. no errors but no result
that is i didnt receive any sms
January 28th, 2011 at 5:49 pm
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
January 30th, 2011 at 1:59 pm
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..
February 1st, 2011 at 3:04 pm
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=
February 17th, 2011 at 3:39 pm
Thanks utkarsh it works…..
thanks a lot…..
February 22nd, 2011 at 6:24 pm
now install on your mobile
http://mixmasala.webfrnd.com/m/MobileApplication3.jad
or maja lo fullonsms,way2sms,16by2,mycantos,site2sms
March 30th, 2011 at 1:35 pm
This program works. No runtime error or something..but no output to mobile device..What will be the reason? Can you help me?.