Web Services: Programming the Web

Started by dhilipkumar, Sep 05, 2008, 11:07 AM

Previous topic - Next topic

dhilipkumar

Web Services: Programming the Web
While ASP+ allows programmers to package dynamic content onto server-side Web pages, Web Services go a step further. They provide the opportunity to expose programming interfaces to the Web for use by clients to package in any way they see fit. This allows businesses to truly componentize their product offerings in ways that end-users can customize to suit their own applications.

The following is an example of a very simple Web Service written in COBOL:

<%@ webservice language="COBOL" %>
CLASS-ID. FOO.
FACTORY.
PROCEDURE DIVISION.
METHOD-ID. ADDME.
DATA DIVISION.
LINKAGE SECTION.
01 OPND-1 PIC S9(9) COMP-5.
01 OPND-2 PIC S9(9) COMP-5.
01 RET PIC S9(9) COMP-5.
PROCEDURE DIVISION USING BY VALUE OPND-1 OPND-2 RETURNING RET.

COMPUTE RET = OPND-1 + OPND-2.

END METHOD ADDME.
END FACTORY.
END CLASS FOO.



The example is just a COBOL class definition with a method called "ADDME" that adds two numbers together. The "webservice" directive at the beginning tells the .NET Framework that we want to expose methods as Web Services and identifies the programming language in which the methods are written. (In future versions, users will probably need to use a compiler directive to specify an attribute for each method that is to be exposed as a Web Service.)

As simple as this seems, a number of technologies all have to work together for Web Services to function. For example, SOAP is a protocol that Microsoft would like to see adopted as a standard; it is used for marshaling data using XML. SOAP is needed for clients and servers to communicate their arguments and results in a format that can ultimately be transmitted over HTTP. Microsoft has also defined a Service Description Language (SDL), which describes the services being exposed and provides clients the mechanism through which they can find those services.

Web Services open up new opportunities for application deployment. Instead of packaging business logic applications with wrappers that predetermine the Web presentation style and content, companies can expose their business logic as a Web Service to be customized for use by their customers.