Here are Web Services Description Language (WSDL) interview questions and answers for freshers as well as experienced candidates to get their dream job.
1) Explain what is WSDL?
WSDL stands for Web Services Description Language. It is a simple XML document that contains a set of definitions to describe or locate a web service.
2) Explain what is the WSDL document structure?
The WSDL document structure consists of these major elements
- <types>: A container for data type definitions used by the web services
- <message>: A typed definition of the data being communicated
- <portType>: A set of operations supported by one or more endpoints
- <binding>: A protocol and data format for a specific port type
3) What is the prefix used for the target namespace for the WSDL document?
“xmlns:tns=target name” is used for target namespace for the WSDL document.
4) Explain what is message element in WSDL?
- A message is protocol independent, and it describes the data being exchanged between the consumers and web service providers
- Each web service has two messages input and output. The input determines the parameters for the web service and the output determines the return data from the web service
- Each <message> element contains zero or more <part> parameters, one for each parameter of the web service function
- <Part> element relates to the parameter or return value in the RPC call
- The <part> name order reflects the order of the parameters in the RPC signature
5) Mention the operation types response used in WSDL?
WSDL defines four types response. Request response is the most common operation type.
- One way: It can receive a message but will not return response
- Request response: It receives a request and will return a response
- Solicit response: It sends a request and will wait for response
- Notification: It sends a message but will not wait for a response
6) What does <definition> element define in WSDL?
In WSDL, definition element is the main or root element of all WSDL documents, it defines the name of the web service.
7) Explain what does the “types” define in WSDL?
- The type element defines all the data types used between the server and the client
- To define data types WSDL uses the W3C XML Schema Specification as its default choice
- Type element is not required if the service uses only simple XML schema types like integers and strings
- To reuse the type with multiple web services, WSDL allows to define types in a separate elements
8) Explain what is “soap:body”?
“soap:body” is a SOAP extension element used as a sub element of the “wsdl:input/output” inside the wsdl binding and operation. It is used to provide information on how the content of the SOAP body element is constructed.
9) Explain how WSDL can bind to SOAP?
The binding is possible by two attributes- name and type attributes. The name attribute defines the name of the binding and type attribute defines the port for the binding. While, for SOAP binding you need to declare two attributes- transport and style. The transport attributes defines the SOAP protocol (HTTP) while style attribute defines the “rpc” or “document”.
10) Explain what is UDDI and it communicates via which protocol?
UDDI stands for Universal Description, Discovery, and Integration. It is a directory used for storing information about web services. It communicates via SOAP.
11) Mention what things need to be taken care for ports while binding?
- A port must not determine more than one address
- A port must not determine any binding information other than address information
12) Explain what is the difference between SOAP message and WSDL?
A SOAP message is an XML document which is used to transmit your data while WSDL is an XML document which tells how to connect and make requests to your web service.
13) Explain what is end points in WSDL?
In WSDL, end point is referred to an address and a binding
14) Explain how endpoints are defined in WSDL?
Endpoints represent an instantiated service; they are determined by combining a binding and the networking details used to expose the endpoint. Endpoints are defined in a contract using a combination of the WSDL port elemennt and WSDL service element. The port elements define the actual endpoints
15) Explain what is the difference between Message type and Element in WSDL?
- Message type: It creates variable based on a message type that you defined in WSDL
- Element type: It creates variable based on an element that you defined in Schema
16) How to validate WSDL file?
WSDL file is a contract between consumer and web service clients. A WSDL validator verifies whether the file can be consumed by other applications before you give the url to your end-users. To validate your file you need to set your criteria like
- Does it require to be validate according to WSDL XML schema
- Does it require to fulfill with known best practices
- Does it require to be parsed correctly by common soap stacks
You can use a commercial tool like XMLSpy to validate WSDL file.
17) Explain what is the difference between binding and port type in WSDL?
- WSDL Port: The WSDL port type element defines a group of operations known as an interface in most environments. Each operation consist of a combination of input and output elements. The order of these elements determine the message exchange pattern (MEP)
- WSDL Binding: The WSDL binding element describes the details of using specific portType with a given protocol
18) List out the characteristics of port and service in WSDL?
- A service may have more than one endpoint with each one defined by its own port element
- The port element relates to a specific binding, and contains information on how to access it (URI)
- Different ports signify different binding for the same port type- enabling the same functionality to be accessible via multiple transport protocols and interaction styles
These interview questions will also help in your viva(orals)