Click here to Skip to main content
6,635,160 members and growing! (16,964 online)
Email Password   helpLost your password?
Languages » C / C++ Language » General     Intermediate

Sending SMS using .NET through a Web service

By Manoj Kumar C

This article will help you to know how to use web services in .NET
C#, Windows, .NET 1.1VS.NET2003, Dev
Posted:7 Jun 2004
Views:317,671
Bookmarked:114 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
53 votes for this article.
Popularity: 4.50 Rating: 2.61 out of 5
23 votes, 43.4%
1
2 votes, 3.8%
2
8 votes, 15.1%
3
6 votes, 11.3%
4
14 votes, 26.4%
5

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

About the Author

Manoj Kumar C


Member
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
Occupation: Web Developer
Location: United States United States

Other popular C / C++ Language articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 176 (Total in Forum: 176) (Refresh)FirstPrevNext
Generalhelp need for send sms to india mobiles Pinmemberdtzone21:25 8 Nov '09  
Questioncan you help me send msg useing M-BOX Pinmembervo_tinh17:05 20 Oct '09  
Generalhow to send sms for in windows application using web services? Pinmembersudhir behera8:55 13 Oct '09  
GeneralThe Code doesn't work - No SMS received even after 4 + hours Pinmemberhtaquee10:52 16 Sep '09  
GeneralMy vote of 1 PinmemberMember 410414822:45 12 Sep '09  
Questionerror Pinmemberprernapup3:29 28 Aug '09  
AnswerRe: error Pinmembersmurfnz12:02 4 Sep '09  
GeneralMy vote of 1 Pinmembergeorge ivanov2:22 24 Aug '09  
GeneralI did not get any SMS Pinmemberlorvahe5:34 11 Aug '09  
GeneralAbout send sms [modified] Pinmembersanjay303:13 5 Aug '09  
General.Net sms application error PinmemberPiyush90002:54 28 Jul '09  
GeneralMy vote of 1 Pinmemberhalil.guler1:57 23 Jul '09  
GeneralDial number from pc on mobile and answer that call from pc microphone Pinmembersuashpatil30074:10 1 Jul '09  
GeneralHOW TO USE THIS CODE Pinmembermoses12345678922:46 24 May '09  
GeneralTo ALL looking for sample code for Sending SMS using web service. PinmemberSmart_Boy1:45 15 May '09  
GeneralRe: To ALL looking for sample code for Sending SMS using web service. PinmemberMember 383107721:33 17 May '09  
GeneralRe: To ALL looking for sample code for Sending SMS using web service. PinmemberSmart_Boy23:29 17 May '09  
GeneralRe: To ALL looking for sample code for Sending SMS using web service. Pinmembertesting12310:20 29 Jun '09  
QuestionThe application is running fine but SMS is not received. [modified] Pinmembermulanihanif0:48 15 May '09  
AnswerRe: The application is running fine but SMS is not received. PinmemberNath22:27 21 May '09  
Generalabout sending message on mobile Pingroupaarsh thakur23:25 12 May '09  
Generalcould not receive msg to my mobile Pinmembermehala10:05 7 May '09  
GeneralWhile adding these web services its giving some error Pinmemberrahul_goel168523:43 5 May '09  
GeneralSending MMS to PDA Pinmembereamon250d12:53 12 Apr '09  
Generali'm unable to send sms using this article PinmemberMember 45834570:04 2 Apr '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 7 Jun 2004
Editor: Nishant Sivakumar
Copyright 2004 by Manoj Kumar C
Everything else Copyright © CodeProject, 1999-2009
Web18 | Advertise on the Code Project