What is WSDL?

πŸ’‘ Concept Name

WSDL (Web Services Description Language) – An XML-based language used for describing the functionality offered by a web service.

πŸ“˜ Quick Intro

WSDL defines what a web service does, how to access it, and where it can be found. It enables tools to generate client/server stubs automatically.

🧠 Analogy / Short Story

Think of WSDL like a restaurant menu. It tells you what’s available (operations), the ingredients (input/output), and how to place an order (bindings).

πŸ”§ Technical Explanation

  • πŸ“„ Written in XML format.
  • πŸ“Œ Describes operations (methods), messages, and endpoints.
  • πŸ”Œ Supports binding protocols like SOAP or HTTP.
  • πŸ” Used for contract-first web service development.
  • 🧰 Tools like wsdl.exe, svcutil in .NET can generate code from WSDL.

🎯 Purpose & Use Case

  • βœ… Enables client code generation for SOAP web services.
  • βœ… Used in service registries for discovery and binding.
  • βœ… Ensures strict service contracts in SOA environments.

πŸ’» Real Code Example

<definitions name="CalculatorService"
             targetNamespace="http://example.com/calculator"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <message name="AddRequest">
        <part name="a" type="xsd:int"/>
        <part name="b" type="xsd:int"/>
    </message>

    <message name="AddResponse">
        <part name="result" type="xsd:int"/>
    </message>

    <portType name="CalculatorPortType">
        <operation name="Add">
            <input message="tns:AddRequest"/>
            <output message="tns:AddResponse"/>
        </operation>
    </portType>
</definitions>

πŸ“ MCQs

Q1. What does WSDL stand for?

  • Web SOAP Deployment List
  • Web Services Definition Language
  • Web Services Description Language
  • Wide Service Deployment Language

Q2. What format is WSDL written in?

  • YAML
  • JSON
  • XML
  • CSV

Q3. Which protocol is commonly associated with WSDL?

  • FTP
  • HTTP
  • SOAP
  • SMTP

Q4. What tool can generate code from WSDL in .NET?

  • dotnet-wsdl
  • xsd.exe
  • svcutil
  • cli-tool

Q5. What is defined inside WSDL's 'portType'?

  • Data types
  • Endpoints
  • Operations
  • Bindings

Q6. What section of WSDL describes the message types?

  • binding
  • port
  • service
  • message

Q7. Is WSDL used in RESTful APIs?

  • Yes
  • No
  • Sometimes
  • Only in ASP.NET Core

Q8. What file extension does WSDL usually have?

  • .xml
  • .soap
  • .wsdl
  • .xsd

Q9. Can a WSDL define multiple operations?

  • No
  • Yes
  • Only in SOAP 1.2
  • Only with .NET

Q10. What is the main role of WSDL?

  • Deploy services
  • Serialize JSON
  • Define service contract
  • Run test scripts

πŸ’‘ Bonus Insight

Though WSDL is mainly used in SOAP-based services, understanding it helps in working with legacy systems and enterprise-level integrations.

πŸ“„ PDF Download

Need a handy summary for your notes? Download this topic as a PDF!

⬅️ Previous:

➑️ Next:

πŸ’¬ Feedback
πŸš€ Start Learning
Share:

Tags: