Welcome to Java4u

A Single Place for all Java Resources

Looking for something?

Subscribe to this blog!

Receive the latest posts by email.

.Just enter your email below if you want to subscribe!


Tuesday, June 24, 2014

WSDL Explaination

WSDL describes Web Services
WSDL stands for Web Services Description Language.
WSDL is a document written in XML. The document describes a Web service. It specifies the location of the service and the operations (or methods) the service exposes.
A WSDL document is just a simple XML document.
It contains set of definitions to describe a web service.
WSDL should have methods, input arguments for methods & return type for methods

Let’s take an example with one method

If we mention @WebMethod(exclude=true), it is not going to publish this method when ever access specified is public also
1) portType: This tag is  an element, contains  name attribute of service class name[ProductCatalog].
Inside Operations the sub element ,contains the name attribute of service class, service method name[getProductCategories()].

In Operation tag, two tags  are defined which takes input and output .

Here Input  is the Request  and sends like getProductCateogriesRequest.

Here Output  is the Response  and sends like getProductCateogriesResponse.

If we have multiples arguments  defined in method, there are bundled together as a message.
Every input is takes a message & output is given as message

Operation takes I/p as one message and o/p as one message

2) types : if we have custom data types ,  we need to define it over here in this types tags & input  and output are referenced for these types.

3)message : Here message has as attribute name which is same as operation name & this message is declared in input tag under message attribute & in output message with suffix at last Response &  message has a sub element tag with name part and name as parameters which are the arguments in the service method

4)binding : WSDL defines  some binding’s information , how web service accepts these request values & gives response

We have element called

[which means this web service accepts SOAP request over http]

5) service  : it’s a list of ports ,

where service  name is  suffixed with the name  service at last

(ProductCatalog{Service}) ==> ProductCatalogService

sub element tag is port where name is  suffixed with the name  Port at last

(ProductCatalog{Port}) ==> ProductCatalogPort

& binding attribute also  and we have another sub element for port


this is the location where web service is available & Service has a Port, which follows the binding

Server : Glassfish

1)When ever the server see a class with @WebService annotation, it’s going to create a Service & a Port with class name  & the ports has bindings how the web service is going get  called  with soap over http.

2) Coming to methods they are annotated with @WebMethod, its gone create operations for that , so port consists of operations And it consist of message of types & types are defined

  • Service consists port
  • port defines bindings
  • bindings  points to portType & which has operations
  • operations has an input & output & I/p & o/p message
  • message refers to types
  • types are defined in own section.