Click here to Skip to main content
12,756,882 members (37,136 online)
Click here to Skip to main content
Add your own
alternative version


29 bookmarked
Posted 7 Jun 2004

Consuming .NET Web Services on Pocket PC - Part 1

, 7 Jun 2004 CPOL
Rate this:
Please Sign up or sign in to vote.
An article on Consuming web Service on PocketPC


If you haven't heard about Web Services or PDAs by now, then it's high time you got out and this is just the article to help you step into the daylight. In this article we'll demonstrate how to design a client application for the PocketPC platform in Visual Studio .NET 2003 and use it to connect to a Web Service.

Web Services

Before we begin our little demonstration, we should briefly review some general concepts. Web Services are one of the most interesting technologies to emerge recently. To keep it simple, we can think of Web Services as modules of code that we can access over the Internet. They are very similar to class libraries, only they physically reside on a remote server rather than in our own application code. We can design client applications that communicate with Web Services, sending them parameters to receive generated results in true black-box fashion. The protocol used in this kind of communication is Simple Object Access Protocol (SOAP), an XML-based mark-up language. When Web Services first came on the scene, developers had to be able to understand, and be able to write, SOAP messages. With Visual Studio .NET (VS.NET 2003), though, most of that is hidden from us and we can concentrate more on application design.

Because SOAP is a form of XML, any platform or application can theoretically read it - of course, a proper parser is needed to be able to do so. We can write a Web Service in Java, for example, and host it on some Linux server on the other side of the globe and then access it, via the Internet, from a Visual Basic application running on a Windows desktop machine. In this way, organizations can expose certain data stores or applications to the public if they so choose - and they don't have to be concerned with providing the data in varying formats in order to appease varying platforms.

Setting Up a Client Application

For the rest of this article we'll be using VS.NET 2003 to target the PocketPC platform. We'll be connecting to a language translation Web Service to give the PDA user a way to translate words and phrases to and from several different languages. Although the concepts presented herein are fairly general, there are some specifics that may not jibe with other versions of VS.NET or other IDEs. In addition, we'll be using the PDA emulator that is installed with VS.NET in order to do our debugging. If you wish, you may debug and test by deploying the application directly to a PDA, but that method is a bit more time-consuming than using the emulator. We usually find it more efficient to test thoroughly using the emulator and then deploy the application to a PDA once it has received our first stamp of approval. Without any further ado, then, let's fire up VS.NET2003. First of all, select File|New|Project from the main menu and then in the "New Project" dialog select the "Smart Device Application" item for the .NET language of your choice (in this article we'll be using C#). Don't forget to give the project a name. We named it "HoytsCinema".

Once we've chosen to create our new project, another dialog appears, asking us to specify what PDA platform to target and what type of PDA project we wish to create. We want to target the PocketPC platform (as opposed to the Windows CE platform) and to create a Windows Application (as opposed to a class library, etc.), so make the selections as shown below:

Using the code

Just follow the above pictures and you will learn how to consume a web service

private void btnLogin_Click(object sender, System.EventArgs e)
{  int intValid;
  //MessageBox.Show("Gopal here");

  if(txtLogin.Text ==string.Empty)
    MessageBox.Show("Enter Student ID ");
    if(txtPassword.Text ==string.Empty)
    MessageBox.Show("Enter Password");
  intValid = HoytsTicket.ValidateUser(txtLogin.Text,txtPassword.Text);
  if (intValid > 0)
    Movie frmMovie = new Movie(txtLogin.Text);
    MessageBox.Show("Enter Correct Student ID and Password");


Points of Interest

If you have created your own web service and trying to run that on your PocketPC , you will face some problems, if you have mentioned the name as http:localhost/myWebservice.asmx. Be careful!!!!!!!! Instead of Localhost, give IP address.


Be in touch I am going to post very soon another article - Creating Advanced Web services using VS.NET 2003.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Gopal Panda
Web Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralThank you!! Pin
gbarizon25-Jun-09 10:47
membergbarizon25-Jun-09 10:47 
QuestionHow to consume external web services in .net smart device application Pin
Sunitha.Tentu20-Dec-06 21:01
memberSunitha.Tentu20-Dec-06 21:01 
GeneralProblem Consuming a Web Service Pin
Sebina10-May-06 7:17
memberSebina10-May-06 7:17 
GeneralRe: Problem Consuming a Web Service Pin
ninoku23-Jun-06 3:02
memberninoku23-Jun-06 3:02 
GeneralVery Nice Pin
Dean Bathke12-Jun-05 7:27
memberDean Bathke12-Jun-05 7:27 
Generalproxy problem plz help Pin
gripusa16-Mar-05 4:33
membergripusa16-Mar-05 4:33 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 8 Jun 2004
Article Copyright 2004 by Gopal Panda
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid