Creating Web Services with ASP
By Ramesh Balaji and Scott Mitchell
In Part 1 we looked at how to create a Web service using VisualBasic 6.0 and the SOAP Toolkit 2.0. In this part we'll examine the files created by the SOAP Toolkit wizard. In the third and final part we'll look at how to create a Web service client - a component that can access the Web service created in Part 1.
Understanding WSDL and WSML
Recall that the SOAP Toolkit wizard creates three files for us: an ASP page, a .WSDL file and a
.wsml file. Take a moment to examine the .WSDL and .wsml files. Note that
they contain a lot of XML. The information contained within this XML is very important and vital for the Web service
to execute properly, so let's take a moment to examine both of these files.
WSDL stands for Web Services Description Language. This file identifies the services provided by the server and the set of operations or functionalities within each service that the server supports. A WSDL file is like a contract between the server (the Web service) and the client (the program that is calling the Web service).
A client who wishes to send a SOAP request to the Web service first obtains a copy of this WSDL file from the server. The client then uses the information in this file to format a SOAP request, which it then sends to the Web service The Web service executes the requested operation and sends the results back to the client as a SOAP response. Here are a few important sections of the WSDL file generated by SOAP Toolkit.
|
The service element identifies the listener, that ASP page (or ISAPI DLL) to call to invoke the Web
service. Note that the service element also contains information for the port to use.
The port Element identifies the operations and functionalities provided by each service. A service
can have one or more ports.
Every port element has an input and output message child element. The
input message identifies the request to be sent from the client to the Web service and output message identifies the
response to be sent from the Web service back to the client.
The message elements identify each message name and data type. The message name is
nothing but the parameter name in your COM class and type identifies the data type of the parameter.
Now that we've examined the WSDL file and its purpose, let's turn our attention to the WSML.
The .wsml file, an XML-formatted file, maps the operation of a service provided by the WSDL file to a
specific method in the COM object.
|
The servicemapping element identifies the service element for which mapping is being
specified. This is the service element that was created in the WSDL file. The PROGID
attribute identifies the COM class, which implements all the various methods.
The execute child element specifies the object that executes the specified operation. This element
has three attributes, uses, method, and dispID, which identify the
object name, the method name, and the dispatch ID of the method, respectively.
The port element specifies the portType element as defined in the WSDL file. For each
operation in a given portType element, there is one operation element in the WSML file
The parameter child element of the execute element describes any method parameters.
The callIndex attribute provides the parameter number, say 1 for parameter1,
2 for parameter2 and so on. A callIndex value of -1 identifies
the parameter as the return parameter.
Now that we've examined the files created by the SOAP Toolkit wizard when creating a Web service, let's turn our attention to the final task at hand - creating a component to consume a Web service. Once we've completed this, we'll be able to consume remote Web services via an ASP page!



