Mobile Web Services are already having a tremendous impact on Pocket PC development. Web sevices are to applications what the Internet is to human beings. An XML Web service exposes data in XML format to consumers using an Internet protocol such as HTTP. Web services facilitate and integrate platform independent access to structured (XML) information. Sure, they are not a universal panacea for all architectures, but their flexibility and ease of development make for a compelling infrastructure--and if this article doesn't make you a believer then nothing will. Brave words, you say? Well, get comfy and follow along--you won't believe how easy it is to add and consume an XML Web service in the Compact Framework. One of the very coolest things about .NET Web services is that you can literally build a platform-agnostic API to whatever application you want. In fact, there is nothing to stop you from building an API to your Web site! But let's learn to walk before we run headlong into that dark night, by starting with something simple. Suppose that I want to provide a means for other webmasters to link to the developer articles on my Web site devbuzz.com. There are many great technical authors who have contributed to DEVBUZZ and perhaps they would like to generate links to their articles automatically.
The DevBuzz author-article Web service
What information could authors want? Well, they certainly want the title, description, and URL; but perhaps they would also like the read-counter information. With that in mind, I built a stored procedure that accepts an e-mail address and returns the appropriate XML from my article database. You can find the Web service here: www.devbuzz.com/class/WebAPI.asmx
This Web service exposes a method called GetAuthorArticles, which requires you to enter an e-mail address and then returns all the article information for the specified author. To give it a whirl with my e-mail address (Derek@devbuzz.com), enter this URL into your browser:
www.devbuzz.com/class/WebAPI.asmx/GetAuthorArticles?thisEmailAddress=derek@devbuzz.com
The XML output has the following structure:
<root>
<Article Title=".NET Compact Framework - Making the Switch!" Date="2002-09-16T09:45:00"
ReadCounter="10881" DeskTopURL="http://www.devbuzz.com/content/ zinc_dotnet_compact_framework_switch_Pg1.asp"
PieURL="http://www.devbuzz.com/pie/article_text.asp?articleid=129" />
The beauty of the XML Web service is that it returns XML and anyone can access the information and transform it using XSL, displaying it in their own proprietary format. So regardless of your Web server platform software (Apache, IIS, WebSphere, etc.), you can call the Web service since it's just an HTTP request, and as such it can pass through firewalls, proxies, and so on. Now, you probably wouldn't have much use for this particular Web service on your Pocket PC, but it will serve as a good example to show how to consume a Web service from a Pocket PC application.
Adding the Web service reference to the application
Step 1

VS.NET makes it so easy to add a Web service to your application. Right-click the References folder in your project and click on Add Web Reference.
Step 2
Next you will see the Add Web Reference dialog. Type in:
http://www.devbuzz.com/class/webapi.asmx
...and click the Add Reference button.

Now you should see com.devbuzz.www in your project list:

Consuming the Web service reference to the application