What is the difference between XSD and WSDL?

252,546

Solution 1

XSD defines a schema which is a definition of how an XML document can be structured. You can use it to check that a given XML document is valid and follows the rules you've laid out in the schema.

WSDL is a XML document that describes a web service. It shows which operations are available and how data should be structured to send to those operations.

WSDL documents have an associated XSD that show what is valid to put in a WSDL document.

Solution 2

WSDL (Web Services Description Language) describes your service and its operations - what is the service called, which methods does it offer, what kind of in parameters and return values do these methods have?

It's a description of the behavior of the service - it's functionality.

XSD (Xml Schema Definition) describes the static structure of the complex data types being exchanged by those service methods. It describes the types, their fields, any restriction on those fields (like max length or a regex pattern) and so forth.

It's a description of datatypes and thus static properties of the service - it's about data.

Solution 3

XSD : XML Schema Definition.

XML : eXtensible Markup Language.

WSDL : Web Service Definition Language.

I am not going to answer in technical terms. I am aiming this explanation at beginners.

It is not easy to communicate between two different applications that are developed using two different technologies. For example, a company in Chicago might develop a web application using Java and another company in New York might develop an application in C# and when these two companies decided to share information then XML comes into picture. It helps to store and transport data between two different applications that are developed using different technologies. Note: It is not limited to a programming language, please do research on the information transportation between two different apps.

XSD is a schema definition. By that what I mean is, it is telling users to develop their XML in such a schema. Please see below images, and please watch closely with "load-on-startup" element and its type which is integer. In the XSD image you can see it is meant to be integer value for the "load-on-startup" and hence when user created his/her XML they passed an int value to that particular element. As a reminder, XSD is a schema and style whereas XML is a form to communicate with another application or system. One has to see XSD and create XML in such a way or else it won't communicate with another application or system which has been developed with a different technology. A company in Chicago provides a XSD template for a company in Texas to write or generate their XML in the given XSD format. If the company in Texas failed to adhere with those rules or schema mentioned in XSD then it is impossible to expect correct information from the company in Chicago. There is so much to do after the above said story, which an amateur or newbie have to know while coding for some thing like I said above. If you really want to know what happens later then it is better to sit with senior software engineers who actually developed web services. Next comes WSDL, please follow the images and try to figure out where the WSDL will fit in.

***************========Below is partial XML image ==========*************** XML image partial

***************========Below is partial XSD image ==========***************

XSD image partial

***************========Below is the partial WSDL image =======*************

WSDL image partial

I had to create a sample WSDL for a web service called Book. Note, it is an XSD but you have to call it WSDL (Web Service Definition Language) because it is very specific for Web Services. The above WSDL (or in other words XSD) is created for a class called Book.java and it has created a SOAP service. How the SOAP web service created it is a different topic. One has to write a Java class and before executing it create as a web service the user has to make sure Axis2 API is installed and Tomcat to host web service is in place.

As a servicer (the one who allows others (clients) to access information or data from their systems ) actually gives the client (the one who needs to use servicer information or data) complete access to data through a Web Service, because no company on the earth willing to expose their Database for outsiders. Like my company, decided to give some information about products via Web Services, hence we had to create XSD template and pass-on to few of our clients who wants to work with us. They have to write some code to make complete use of the given XSD and make Web Service calls to fetch data from servicer and convert data returned into their suitable requirement and then display or publish data or information about the product on their website. A simple example would be FLIGHT Ticket booking. An airline will let third parties to use flight data on their site for ticket sales. But again there is much more to it, it is just not letting third party flight ticket agent to sell tickets, there will be synchronize and security in place. If there is no sync then there is 100 % chances more than 1 customer might buy same flight ticket from various sources.

I am hoping experts will contribute to my answer. It is really hard for newbie or novice to understand XML, XSD and then to work on Web Services.

Solution 4

XSD is to validate the document, and contains metadata about the XML whereas WSDL is to describe the webservice location and operations.

Solution 5

XSD (XML schema definition) defines the element in an XML document. It can be used to verify if the elements in the xml document adheres to the description in which the content is to be placed. While wsdl is specific type of XML document which describes the web service. WSDL itself adheres to a XSD.

Share:
252,546

Related videos on Youtube

make
Author by

make

Thanks to everyone who shared and share his/her idears with me ...

Updated on March 24, 2021

Comments

  • make
    make about 3 years

    What is the difference between an XML Schema and WSDL?

    The difference I noticed is that WSDL contains XSD and in WSDL we can declare operations, but not in XSD. Is that correct?

  • airboss
    airboss almost 11 years
    This is a much better answer explaining XSD in context of a WSDL and not just difference between the two. To add, XSD definitions are part of WSDL in the <wsdl:types> tag.
  • supernova
    supernova over 10 years
    Paolo answer is correct. Just enhancing it. As WSDL is actually XML and may or may not have XSD to validate it's structure. Associated XSD may be a separate file and imported in WSDL or full XSD can be embedded inline in WSDL file itself using <WSDL:types> tag .For more details ibm.com/developerworks/webservices/library/ws-tip-imports
  • CodyBugstein
    CodyBugstein over 8 years
    If they are pretty much two separate things, why is it that when I create a web service for example, in Netbeans, I get a ?xsd=1 in the URL automatically?
  • MbaiMburu
    MbaiMburu over 5 years
    at least it gave me a hint of how these technologies work
  • Mangs
    Mangs about 5 years
    Isn't DESC in mysql used for the sort order? DESCRIBE however is more like it.
  • esseara
    esseara over 4 years
    So I could have a WSDL without an XSD if I don't need complex data definition?
  • Ram
    Ram about 3 years
    Looks informative! WSDL is "Web Service Description Language"