WSDL Elements


What is WSDL ?

WSDL stands for Web Service Descriptor Language. WSDL describes SOAP Web Service, i.e. what are input, output, SOAP service protocol etc. It is XML Document.

WSDL Elements

Definitions: WSDL starts with definitions root tag, it contains type, message, portType, binding and service.
Definitions tag contains various attributes, which contains name (optional) - Web Service Name, targetNamespace is logical namespace information about service, xmlnsxmlns:soap & xmlns:xsd - standard namespace definition for describing SOAP webservice.
  • type: contains data definition of basic to complex elements. This also includes reference external XSD
  • message: This is abstract definition of types which are communicated as a part of web service request / response
  • portType: This contains all operations available in web service with reference to all message
  • binding: This contains protocol on which  web service is operating, i.e. HTTP(s), SMTP etc. with reference to operations. It also describes style, i.e. RPC or document.
    • Transport Protocol: transport="http://schemas.xmlsoap.org/soap/http"
      This says soap/http, it means SOAP over HTTP Protocol
    • Style: There are two types - RPC and document
      • RPC: Remote Procedure Call, This uses webmethod and parameter to generate XML, tightly coupled, cannot be validated against Schema. There is no type section in WSDL file for RPC style.
      • Document:  Can be validated against defined schema (i.e. type section in WSDL file), it is using single document to send/receive messages
  • service: This described binding and URL or relative details on which service is running.

Example: 

Let us explore simple webservice - Area Calculator. This is calculating area of three shapes, Square, Rectangle and Circle. WebService published using Endpoint Publisher.

AreaCalculatorService.java




AreaServicePublisher.java



WSDL File:



Sample Request/Response via Soap-UI:




Stay tuned for more about SOAP Web Services.

Comments

Popular posts from this blog

Create BeanShell Script to Make Database call

JAX-WS - SOAP Handlers

Connection Pooling