Google

Friday, August 10, 2007

Writing a simple Web service

Here is a procedure to write a sample web service. Please go through the steps given below.
Step 1:

The screen shot below shows the creation of new web service.




In the Web Services Properties box, give the new Web service a name -- we use TestService for this example -- and close the box.

Now you should have a screen that looks very much like one used for writing a LotusScript agent. Click (Declarations) in the Objects tab of LotusScript events, so you can write a class (classes must always be defined in the (Declarations) section). Enter this code into the IDE:


             
Class Test
Public Function AlertMsg (txt As String) As String
AlertMsg = txt
End Function
End Class
This code does the following:
  • Creates a class called Test.
  • Defines a method in the class called AlertMsg that accepts a string as a parameter and returns a string as a result (functions and subs in classes are referred to as methods).
This method accepts string as a input and returns the same string.

Open the Web Service Properties box and specify which class to use. Because there may be multiple classes defined in the Web service code, you must select only one of them as an interface to the Web service. The interface class is the one with Public methods that Web service clients can call.

In the Properties box, enter Test (the name of the class you just wrote) in the PortType class field on the first tab.


Here you have created a web service.

The further details working with complex functions, testing of web service, we will discuss in next posts.

Sunday, July 15, 2007

What can we do with web services

While Web services allows all these dynamic features to combine multiple services into applications, you still have to build the services first. Programming languages in Computer science is continually evolving. We began decades ago with the idea of a function whereby you provide it some parameters, it executes some operation on those parameters, and it returns a value based on its calculations. Eventually, this first concept evolved into the object where each object had not just a number of functions it can perform but also its own private data variables, rather than relying on external system-wide data variables that previously made it more complex to develop applications. As applications began communicating with each other, the concept of defined universal interfaces for objects became important, allowing objects on other platforms to communicate even if they were written in other programming languages and ran on other operating systems.

At the most recent step, Web services has moved towards the concept of XML-defined interfaces and communications, finally uniting any kind of application with another, as well as providing the freedom to change and evolve over time, as long as they are designed to the appropriate interface. The versatility of XML is what makes Web services different from previous generation component technologies. It allows the separation of grammatical structure (syntax) and the grammatical meaning (semantics), and how that is processed and understood by each service and the environment it exists in. So now, objects can be defined as services, communicating with other services in XML-defined grammar, whereby each service then translates and analyzes the message according to its local implementation and environment. Thus a networked application can truly be composed of multiple entities of various makes and designs as long as they conform to the rules defined by their service oriented architecture.

Thus, with this in mind, Web services allow you to:

  • Interact between services on any platform, written in any language.
  • Conceptualize application functions into task, leading to task-oriented development and workflows. This allows a higher abstraction of software that can be employed by less software-technical users that work on business level analytics.
  • Allow for loose-coupling, which means that interactions between service applications may not break each time there is a change in how one or more services are designed or implemented.
  • Adapt existing applications to changing business conditions and customer needs.
  • Provide existing or legacy software applications with service interfaces without changing the original applications, allowing them to fully operate in the service environment.
  • Introduce other administrative or operations management functions such as reliability, accountability, security, etc., independent of the original function, thus increasing its versatility and usefulness in the business computing environment.

Web Services platform elements

Web Services have three basic platform elements.

These are called SOAP, WSDL and UDDI.


What is SOAP?

The basic Web services platform is XML plus HTTP.

  • SOAP stands for Simple Object Access Protocol
  • SOAP is a communication protocol
  • SOAP is for communication between applications
  • SOAP is a format for sending messages
  • SOAP is designed to communicate via Internet
  • SOAP is platform independent
  • SOAP is language independent
  • SOAP is based on XML
  • SOAP is simple and extensible
  • SOAP allows you to get around firewalls
  • SOAP will be developed as a W3C standard

What is WSDL?

WSDL is an XML-based language for describing Web services and how to access them.

  • WSDL stands for Web Services Description Language
  • WSDL is written in XML
  • WSDL is an XML document
  • WSDL is used to describe Web services
  • WSDL is also used to locate Web services
  • WSDL is not yet a W3C standard

What is UDDI?

UDDI is a directory service where businesses can register and search for Web services.

  • UDDI stands for Universal Description, Discovery and Integration
  • UDDI is a directory for storing information about web services
  • UDDI is a directory of web service interfaces described by WSDL
  • UDDI communicates via SOAP
  • UDDI is built into the Microsoft .NET platform