WSDL stands for Web Services Description Language. WSDL is used to describe web services and also known as Contract. It is the base building block to create a SOAP webservice in Contract-First Approach.
Creation of WSDL consist of following:
In the below example, we are creating a WSDL which contain a single operation createCustomer. You can follow the similar approach to add more operation in the WSDL.
First of all, we will create a schema file to define the request, response and fault structure.
binding element has two attributes - name and type. The name attribute (you can use any name you want) defines the name of the binding, and the type attribute points to the port for the binding, in this case the “CustomerServicePort” port.
soap:binding element has two attributes - style and transport. The style attribute can be “rpc” or “document”. In this case we use document. The transport attribute defines the SOAP protocol to use. In this case we use HTTP.
operation element defines each operation that the portType exposes. For each operation the corresponding SOAP action has to be defined. You must also specify how the input and output are encoded. In this case we use “literal”.
Defines the port and binding with the address where you want to expose your service.