http://msdn2.microsoft.com/zh-cn/webservices/aa740678(en-us).aspx

Welcome to the Getting Started page. This page is designed to introduce people new to Web services to the concepts, tools, and ideas around Web services and provide the resources for getting to the next level.


What Are Web Services?

If you are a developer new to Web services, think of the problem of writing an application that gets information from a traditional Web site.  It is not hard to have your application mimic a browser and send an HTTP request to the site.  The problem is that the data that your application is after is probably embedded somewhere in the middle of an HTML page.  You can write code to parse the HTML and find your data, but this leads to some problems.  Not only is the structure of the HTML questionable, but if someone changes the page layout then the application breaks. 

For situations where a Web site has data to send or receive from non-browser applications, it makes sense to provide structured data in a universally accepted format.  The SOAP specification defines an XML-based, extensible format for doing just that.  And instead of calling these Web locations Web Sites, we instead refer to them as Web Services.  It also turns out that the loosely-coupled, interface-first approach toward designing Web services fits perfectly into the service-oriented design approach toward building connected systems that has such broad industry support today.

More Information


Writing Your First Web Service

Here are 3 simple steps to get you on your way to writing your first Web service:

  1. Install the .NET Framework SDK
    If you do not already have the .NET Framework SDK installed (if you have Visual Studio .NET installed you already have the .NET Framework SDK installed) on your machine, you can download it for free from the Microsoft Download Center. Make sure you see all the details on system requirements and then follow the download instructions provided.  You will need to make sure that you have Internet Information Server installed and you will want to make sure you go to Windows Update after installing new Windows components like Internet Information Server to make sure you have the latest patches installed.
  2. Create a file called MyService.asmx
    Create the following text file, call it MyService.asmx and save to a virtual directory on your Web server, for instance in c:\inetpub\wwwroot\MyService\MyService.asmx.
    <%@ WebService Language="VB" Class="MathService"> 

    Imports System
    Imports System.Web.Services

    Public Class MathService : Inherits WebService

        <WebMethod>_
        Public Function Add(A As Integer, B As Integer) As Integer
           Return A + B
        End Function

    End Class
  3. Test Your Web Service
    Open a Web browser and browse to your service. In our case http://localhost/MyService/MyService.asmx. You should see a screen that provides a bunch of information about your Web service. Click on the link that says "Add" near the top of the page. It will look like this:

    This page provides a mechanism for calling your Web service and shows what the SOAP messages that are received by and sent from your Web service look like. If you type in a couple numbers you will see the XML returned from your Web method that contains the answer.


Microsoft Tools for Building and Using Web Services

Here is a list of some of the tools that Microsoft provides for Web services developers.

  • The .NET Framework SDK and Visual Studio .NET – Microsoft’s premier development platform and developer tool for creating Web services.
  • Visual Web Developer 2005 Express Edition Beta – Get a beta of the next version of Visual Studio .NET trimmed down for doing Web development including Web services.
  • Compact Framework – Web service support is a key part of the Compact Framework which allows you to build managed applications for mobile and embedded devices.
  • Office Toolkit for Web Services – You can consume Web services within your Word and Excel documents with the Office Toolkit for Web Services.
  • Web Services Enhancements (WSE) – Save Web service development time with the support for the latest higher-level Web service standards like Web Service Security (WS-Security).  WSE is an extension to the .NET Framework support for Web services.
  • Windows Communication Foundation – Microsoft’s platform for Web services is Windows Communication Foundation, which has a full complement of support for creating secure, reliable, and transacted Web services.

How to get Web service tools from Microsoft


Next Steps for Coming Up to Speed on Web Services
  • QuickStart Tutorials: If you want to learn how to build your own Web services, you will want to download the .NET Framework SDK and run the Quickstart tutorials. As well as providing information on the basics of building Web services, the QuickStart tutorials also provide assistance in showing how to use data with Web services.
  • Web Services Basics: For more in depth information on the fundamentals of Web services, check out the Web Services Basics page that provides links to a plethora of fundamental material on Web service concepts and protocols.
  • Web Services and Service Oriented Architecture: Architects and developers should understand how Web services are a key part of creating a Service Oriented Architecture (SOA) which provides many benefits for creating loosely-coupled, agile business systems.  For information on service-orientation, see A Guide to Developing and Running Connected Systems with Indigo and Pat Helland’s metaphor for SOA, Metropolis.
  • Advanced Web Services: To get a feel for the work going on industry-wide around higher level Web services, see Advanced Web Services for overviews of advanced Web service concepts and details on the different capabilities and specifications being built into the Web service architecture today.

Advertisements