WSDL (Web Service Description Language)
Web Services are xml based independent and self descriptive application components that are used to communicate with open protocols.
The core of Web Services is a combination of XML and HTTP (XML+HTTP), XML is used as a common language for communication in between different
platforms and programming languages and HTTP is commonly used protocol that is used to transfer data between client and server.
Most effective reason behind the evaluation of Web Services is its platform and language independent nature, because of using xml as a
communicative languages web services enables the developer to expose application functionality across the world without being worried about language or platform changes.
Web Services can be exposed in different platforms, most commonly used platform components are listed below.
Assuming the service provides a single publicly available function, called sayHello. This function expects a single string parameter and returns a single string greeting. For example if you pass the parameter world then service function sayHello returns the greeting, "Hello, world!".
Here I have used some tags in WSDL. Let's discuss about these tags.
- Definitions-The targetNamespace in the <wsdl:definitions> element creates a namespace for all the elements that you define in the
WSDL document (messages,
portTypes, bindings, services, and ports). Although the attribute is optional, you should always create a namespace.
The <wsdl:definitions> targetNamespace does not in any way restrict imports of other WSDL files. In fact, if you plan to import other WSDL files, its more important to create a targetNamespace to allow you to distinguish between the imported WSDL elements and those created in the WSDL file. When you import a WSDL file, you also import that file's namespace -- which should be different from the targetNamespace.
- Message- The message describes the data being exchanged between the web services' provider and consumer and each web service has two messages:
1) input: parameters of the web service
2) output: return data from the web service
Each message has zero or more part parameters (one for each parameter of the web service's function) Each part parameter associates with a concrete type defined in the types container element.
- PortType- The WSDL portType element defines a group of operations, also known as an interface in most environments. Each operation element contains a combination of input and output elements, and when you have an output element you can also have a fault element.
- Binding- Binding tag is used for how web-service accept these values in request and return response. Binding element describes the concrete details of using a particular portType with a given protocol. The WSDL binding element describes the concrete details of using a particular portType with a given protocol. The binding element contains several extensibility elements as well as a WSDL operation element for each operation in the portType it's describing.
- Service- The WSDL service element defines a collection of ports, or endpoints, that expose a particular binding. This tag use to just list of port
- PortType- PortType tage is used to define class name in wsdl. portType can combine one request and one response message into a single request/response operation. This is most commonly used in SOAP services. A portType can define multiple operations.
- Input- Input tag is used to define input parameter from WSDL.
- Output- Output tag is used to define output parameter from WSDL.
- Types- Provides information about any complex data types used in the WSDL document. When simple types are used the document does not need to have a types section.