15.1. Web Services Overview

Web services are fast becoming an essential part of various applications in use, including Windows itself. Now in the later versions of Windows when you click a file using Explorer and the system doesn't recognize the file format, a dialog box such as the one in Figure 15-1 will appear.

Figure 15.1. Figure 15-1

Notice that the first option in the dialog box is to use a Web service to locate the appropriate program for the file. To use the service, or communicate, the consumer (local machine or application) will use XML Messaging and HTTP. The same is true when the Web service is communicating back to the consumer.

One of the great things about using XML Web services is that as long as the consumer can create and consume messages defined for the Web service, it doesn't matter what the consumer is written in, or what even what platform. The term used for this is loosely coupled, or in other words, nonproprietary. Figure 15-2 displays this concept.

Notice that no specific languages or platforms are named in this graphic, except to point out ASP.NET of course. The Web service can be created using ASP.NET or any other language that works with Simple Object Access Protocol (SOAP).

Figure 15.2. Figure 15-2

15.1.1. Web Services Infrastructure

When talking about the infrastructure of Web services, there are four main areas. They are:

  • XML Web Services Directories: The central location to locate XML Web services created by outside organizations. The UDDI registry is an example of one of these directories. Your Web service client may not even need to use these if you know the address of the Web service you are accessing.

  • XML Web Service Discovery: Discovering documents that describe a particular XML Web service using the Web Services Description Language (WSDL ). The DISCO specification defines an algorithm for locating service descriptions. Again, if you know the location of the service description you can avoid this process.

  • XML Web Service Description: Defines what types of methods the XML Web service uses. Tells clients how to interact with an XML Web service so that they know how to use it.

  • XML Web Service Wire Formats: To be able communicate with all platforms and languages, XML Web services use open wire formats. These protocols are understood by any system capable of supporting the most common Web standards. SOAP is the main protocol used.

You can see each of these parts of the infrastructure displayed in Figure 15-3.

Don't panic. These steps are performed for you in most cases after you set up the Web reference, or in the case of InfoPath, after you specify which Web service to use as a data source. You get a chance to practice this in upcoming sections.

Figure 15.3. Figure 15-3

15.1.2. Using Web Services Locally

This section walks you through setting up a Web service locally to practice connecting to and creating Web services. To accomplish this, you should download the final version of the Web service for this chapter, called Chapter15WebService, into the root directory of your local host, using:

drive:inetpubwwwroot

Once the whole folder is copied to the specified folder, you will open up IIS and then make the folder into a virtual directory by creating a default application for the folder using a property sheet.

15.1.2.1. Try It Out: Setting Up a Web Service Locally

You will need to have downloaded the Web service from the Chapter 15 folder on the WROX Web site. When you have done so:

  1. Copy the folder of the Web service into the default folder of your local host. In the case of the authors machine: c:inetpubwwwroot.

  2. Choose Adminstrative Tools Internet Information Services from the Start menu. In IIS you will see the default machine displayed.

  3. Click the machine node to expand the tree view. You will then see the Web Sites nodes displayed. You may see other services listed such as SMTP and FTP if you installed them.

  4. Click the Web Sites node. The Default Web Site node is displayed.

  5. Click the Default Web Site node. You will then see a list of current Web sites and services on your machine, as displayed in Figure 15-4.

    Figure 15.4. Figure 15-4
  6. Right-click the Web service folder Chapter15WebService and choose Properties from the pop-up menu. There are a number of properties listed here for the various types of Web sites.

  7. Click the Create button, located under the application settings. The caption of the button changes to Remove, and the name of the Web service is displayed in the Application Name property, shown in Figure 15-5.

  8. Click OK to close the property sheet. The Web service is now displayed in IIS with the virtual directory icon displayed as displayed in Figure 15-6.

    You can now close IIS, and the Web service will now be available as needed for use locally.

    Figure 15.5. Figure 15-5

    Figure 15.6. Figure 15-6
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.169.14