Click here to Skip to main content
11,645,087 members (64,525 online)
Click here to Skip to main content

Sending SMS using .NET through a Web service

, 7 Jun 2004 712.3K 38K 173
Rate this:
Please Sign up or sign in to vote.
This article will help you to know how to use web services in .NET

Introduction

This article is about sending SMS using .NET through web service. With the help of this article we can easily understand how to use web service in .NET and also you will get some information about SMS, GPRS etc. This web service will help you to give the notification if the service unable to deliver.

How does it work?

Initially when undergoing this study I think sending SMS to different services will be a problem, for sending SMS we have to tie up with all the services it is not possible at all, while studying this most of the services provides GPRS(General Packet Radio Service ) facility. GPRS has more functionality and here we are going to use only one that is Internet email services. So it makes our work little easier. After that I think how to find out the services for that particular mobile number. Now it became very critical, then I found a web service that provides us all the information that we needed. Let we discuss in upcoming paragraph.

What is GPRS?

With GPRS you can enjoy a continuous wireless connection to data networks and access your favorite information and entertainment services. GPRS technology allows mobile phones to be used for sending and receiving data over an Internet Protocol (IP)-based network. GPRS as such is a data bearer that enables wireless access to data networks like the Internet. The applications using GPRS are WAP, MMS, SMS, Java and the PC dial-up (for example, Internet and e-mail).

Internet email services come in the form of a gateway service where the messages are not stored, or mailbox services in which messages are stored. In the case of gateway services, the wireless email platform simply translates the message from SMTP, the Internet email protocol, into SMS and sends to the SMS Center. In the case of mailbox email services, the emails are actually stored and the user gets a notification on their mobile phone and can then retrieve the full email by dialing in to collect it, forward it and so on.

Upon receiving a new email, most Internet email users do not currently get notified of this fact on their mobile phone. When they are out of the office, they have to dial in speculatively and periodically to check their mailbox contents. However, by linking Internet email with an alert mechanism such as SMS or GPRS, users can be notified when a new email is received.

For more information about GPRS click here

Using the code

In this article I am using a web service which already exists. Since this web service is tie up with ICQ instant messaging service make our work easier. With the help of this web service we can able to send SMS to various countries like India, US, UK, Malaysia, Japan etc. In this article I have used the web service from www.webservicex.com they are providing Webs Service Definition Language (WSDL) link for sending SMS.

Here I m attaching the sample code for sending SMS.

private void Send_Click(
 object sender, System.EventArgs e)
    {
      try
      {
        SmsTest.net.webservicex.www.SendSMS smsIndia= 
          new SmsTest.net.webservicex.www.SendSMS();
        SmsTest.com.webservicex.www.SendSMSWorld smsWorld =  
          new SmsTest.com.webservicex.www.SendSMSWorld();
        if(rdoType.SelectedValue == "1")
          smsIndia.SendSMSToIndia(txtMobileNo.Text.Trim(), 
            txtEmailId.Text.Trim(), txtMessage.Text);
        else 
          smsWorld.sendSMS(txtEmailId.Text.Trim(), 
           txtCountryCode.Text.Trim(), txtMobileNo.Text.Trim(), 
           txtMessage.Text);
        lblMessage.Visible = true;
        lblMessage.Text="Message Send Succesfully";
      }
      catch(Exception ex)
      {
        lblMessage.Visible = true;
        lblMessage.Text="Error in Sending message"+ex.ToString();
      }
    }

    private void rdoType_SelectedIndexChanged(
     object sender, System.EventArgs e)
    {
      if(rdoType.SelectedValue =="1")
        txtCountryCode.Enabled = false;
      else
        txtCountryCode.Enabled = false;

    }

Conclusion

The most important feature is it will give mail alerts if the SMS is not send to the user. And it will not support all the services which has GPRS facilities.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Manoj Kumar C
Web Developer
United States United States
I have done Bachelor in Mechanical Engineering. I have strong background in C#, ASP.NET, SQL server 2000. And i also worked in some small application in Mobile.NET and CF.NET

You may also be interested in...

Comments and Discussions

 
QuestionSending SMS using .NET through a Web service Pin
rajeshkool13-Oct-13 23:23
memberrajeshkool13-Oct-13 23:23 
Questionfor creating our own web service for send a text message Pin
Member 100019237-Aug-13 7:05
memberMember 100019237-Aug-13 7:05 
GeneralMy vote of 1 Pin
waris kantroo 128-Jun-13 21:35
memberwaris kantroo 128-Jun-13 21:35 
QuestionProblem with the code Pin
ankurgupa19-Dec-12 0:27
memberankurgupa19-Dec-12 0:27 
GeneralWeb2SMS Pin
civijas21-Nov-12 1:36
membercivijas21-Nov-12 1:36 
Question??? Pin
sarfaraznavaskhan2-Oct-12 23:55
membersarfaraznavaskhan2-Oct-12 23:55 
QuestionNot Working Pin
Member 79212172-Oct-12 22:02
memberMember 79212172-Oct-12 22:02 
AnswerRe: Not Working Pin
Dilipan kumar7-Feb-13 1:04
memberDilipan kumar7-Feb-13 1:04 
QuestionHow to send sma using asp.net? Pin
Member 917112813-Sep-12 21:35
memberMember 917112813-Sep-12 21:35 
AnswerRe: How to send sma using asp.net? Pin
dsvsfdscd4-Feb-13 0:49
memberdsvsfdscd4-Feb-13 0:49 
Questionhi, this is not working, i did not get any sms in mobile Pin
hardikdarji29-Aug-12 21:37
memberhardikdarji29-Aug-12 21:37 
GeneralMy vote of 1 Pin
Member 894945014-Aug-12 0:26
memberMember 894945014-Aug-12 0:26 
Questionhi please Pin
Aziz BUkhari24-Jul-12 10:33
memberAziz BUkhari24-Jul-12 10:33 
Questionhi to all Pin
shalinibharani9-Jul-12 0:55
membershalinibharani9-Jul-12 0:55 
QuestionQuery Pin
bandnakoushal26-Jun-12 0:28
memberbandnakoushal26-Jun-12 0:28 
QuestionQuery Pin
bandnakoushal26-Jun-12 0:26
memberbandnakoushal26-Jun-12 0:26 
Questionsms send issue Pin
Member 872703717-May-12 21:47
memberMember 872703717-May-12 21:47 
QuestionCan i use this serive in Iran Pin
amrollahi14-May-12 10:54
memberamrollahi14-May-12 10:54 
General[My vote of 1] Code not working Pin
santosh22543-May-12 22:49
membersantosh22543-May-12 22:49 
Questionerrer while using this service..... Pin
ravisourot27-Apr-12 21:26
memberravisourot27-Apr-12 21:26 
GeneralMy vote of 1 Pin
Maheswar Tripathy18-Apr-12 1:33
memberMaheswar Tripathy18-Apr-12 1:33 
QuestionThis is not Working Pin
Gopinath Behera31-Mar-12 21:01
memberGopinath Behera31-Mar-12 21:01 
AnswerRe: This is not Working Pin
Avinash Shewale8-Apr-12 1:28
memberAvinash Shewale8-Apr-12 1:28 
Questionno sms sent Pin
markandeypathakniit28-Mar-12 6:45
membermarkandeypathakniit28-Mar-12 6:45 
SuggestionSMS not sending Pin
Mustafaproject21-Mar-12 23:52
memberMustafaproject21-Mar-12 23:52 
GeneralMy vote of 1 Pin
santoshshrest17-Mar-12 0:33
membersantoshshrest17-Mar-12 0:33 
GeneralNot Sending any SMS Pin
ashu shukla8912-Mar-12 16:37
memberashu shukla8912-Mar-12 16:37 
GeneralRe: Not Sending any SMS Pin
amnithkumar14-Mar-12 0:48
memberamnithkumar14-Mar-12 0:48 
Questionproblem to receive Pin
axbritto26-Feb-12 20:47
memberaxbritto26-Feb-12 20:47 
QuestionGetting error with this code Pin
Joharika23-Feb-12 23:39
memberJoharika23-Feb-12 23:39 
QuestionIt is not working Pin
_______________________15-Feb-12 2:58
member_______________________15-Feb-12 2:58 
Questionsms not sending Pin
Member 86333788-Feb-12 23:32
memberMember 86333788-Feb-12 23:32 
AnswerRe: sms not sending Pin
Member 1028126917-Dec-13 23:27
memberMember 1028126917-Dec-13 23:27 
GeneralMy vote of 1 Pin
Raamcy18-Jan-12 20:53
memberRaamcy18-Jan-12 20:53 
Generalwebservice is not envoking Pin
pravin_jk18-Jan-12 1:24
memberpravin_jk18-Jan-12 1:24 
Questionhh Pin
Sohini Dey219-Jan-12 22:42
memberSohini Dey219-Jan-12 22:42 
QuestionCode not working Pin
Razia8615-Dec-11 0:06
memberRazia8615-Dec-11 0:06 
GeneralMy vote of 5 Pin
pedash10-Dec-11 0:52
memberpedash10-Dec-11 0:52 
QuestionNO Pin
Member 837200426-Nov-11 18:42
memberMember 837200426-Nov-11 18:42 
QuestionNot wrking Pin
arun.m.mr14-Nov-11 19:26
memberarun.m.mr14-Nov-11 19:26 
QuestionIt is not working..Plz update anyone.. Pin
abintj13-Oct-11 19:16
memberabintj13-Oct-11 19:16 
QuestionRuns very fine... but sms not sends.... Pin
ganesh mahajan11-Sep-11 23:11
memberganesh mahajan11-Sep-11 23:11 
QuestionIts Not Worked Pin
Mohandas P G24-Aug-11 18:56
memberMohandas P G24-Aug-11 18:56 
Questionhai Pin
r.k.mukil29-Jun-11 4:10
memberr.k.mukil29-Jun-11 4:10 
GeneralMy vote of 1 Pin
PankajSingh223-May-11 23:51
memberPankajSingh223-May-11 23:51 
GeneralPlease remove this Pin
mjeyakumar18-May-11 1:48
membermjeyakumar18-May-11 1:48 
GeneralSending SMS via ICQ open c# code Pin
Ofer Fridman10-May-11 21:37
memberOfer Fridman10-May-11 21:37 
GeneralMy vote of 1 Pin
himanshu_sgrr5-May-11 21:48
memberhimanshu_sgrr5-May-11 21:48 
Generaliuio 7u 7 Pin
NABAMITA SARKAR14-Apr-11 20:46
memberNABAMITA SARKAR14-Apr-11 20:46 
Generalcode not working... Pin
chandrashekhar bisht21-Mar-11 3:03
memberchandrashekhar bisht21-Mar-11 3:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150731.1 | Last Updated 8 Jun 2004
Article Copyright 2004 by Manoj Kumar C
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid