Web Services

Tutorials In This Section

Introduction to Web Services

A Web service is a software component that can be accessed over a network using standard network protocols such as HTTP. Web services are described using the Web services description language (WSDL). Web services help enhance Web developer's own applications. The number and types of services is expanding daily.

Web services provide a way to interact with programming objects located on remote computers. What makes a Web service special is that all communication between Web service servers and their clients occurs via Extensible Markup Language (XML) messages transmitted over the Hypertext Transfer Protocol (HTTP).

By using these standard technologies remote objects can be published and consumed by otherwise noncompatible systems. For example, a remote object written in C# and published as a Web service on a Windows Web server can be processed by Java code running on a Linux machine.

There are two key technologies that make Web services psossible"

  1. Simple Object Access Protocol (SOAP)

  2. Web Services Description Language (WDSL)

Introducing SOAP

SOAP is the protocol for exchanging structured information in a Web service communication between two reomte computers.

SOAP is the protocol that defines how remote computers exchange messages as part of a Web service communication. SOAP relies on XML as its message format and HTTP for message transmission. Using SOAP to communicate has two major benefits. First, because Web service messages are formatted as XML, they are easier for non-compatible systems to understand. Second, because these messages are transmitted over the pervasive HTTP, they can normally reach any machine on the Internet without being blocked by firewalls.

Introducing WSDL

WSDL is an XML-based language for describing Web services. WSDL stands for Web services desciption language, and it provides a standard by which a Web service can tell its client what kind of messages it will accept and what results will be returned. A WSDL file acts as the public interface of a Web service and includes the following information:

  • The data types it can process

  • The methods it exposes

  • The URLs through which the methods can be accessed

Creating Web Services

In this section you will learn how to create and publish a Web service.

Ib this section you will learn how to create a simple Web service called TextWebService that exposes two methods, ToLower and ToUpper. These methods convert a given string to lower-case and uppoer-case letters, respectively. Although this example is simple, it covers all aspects of creating a Web service that may involve more complex logic.

To create a Web service, perform the following actions:

Add a new project based on the ASP.NET Empty Web Application template to a folder on your computer. Name the project TextWebService as shown in the figure below.