This chapter is from the book

This chapter is from the book

In this hour, you will learn how WSDL is used to describe XML Web services.
You will see how WSDL is used to define how a service exposes itself to various
types of HTTP request types. You will also see how the WSDL language is used to
inform client applications about argument and return types that are used by the
service's methods.

In this hour, we will discuss the following:

Typing in WSDL

Messages

Ports

Bindings

What Is WSDL?

WSDL, or Web Services Description Language, is an XML-based
language used to define XML Web services. WSDL describes the service and its
methods as well as the manner in which communication between a client and a
service should be carried out.

A WSDL Document Example

In order to get a grasp of how WSDL works, one must first look at a WSDL
document. The following document describes a service, WSDLTester, that contains
one method, TestMethod1. This method accepts as its arguments an
integer named iNum1 and a Boolean named fBool1 and returns a
string.

Analysis of WSDL Document Example

Let's take a moment to analyze the code example above to ensure you
understand the various elements that are taking place here.

Types (lines 10 through 33)Provides data type definitions
that will be used for communication between the XML Web Service and its
clients.

Messages (lines 34 through 53)Provides a message name,
associated with a type, that will be used for communication.

PortTypes (lines 54 through 71)Associates specific
messages with port types, such as HttpPost.

Bindings (lines 72 through 111)Binds specific ports and
XML Web service methods to Internet protocols, such as SOAP.

Services (lines 112 through 125)Supplies the address
information for a service's different ports of communication.

Note

WSDL documents are fairly complex and can be extremely confusing to anyone
who isn't accustomed to them and, for that reason, Visual Studio/ .NET
generates a WSDL document for every XML Web Service that you create. The purpose
of this hour is to help you understand what an XML Web Service does based on its
WSDL document. Do not worry about memorizing all of the rules and syntax that
comprise WSDL as you will probably never be forced to make changes to a WSDL
document.