WSDL                                                                                         
•        The second specification we will look at in length is WSDL or Web Services Description Language.
-        The WSDL specification, like SOAP, is managed by the W3C.
-        WSDL (pronounced Wiz-Dell mostly) provides a template to define how your web services
communicate.
-        WSDL provides the glue between two systems that wish to communicate by describing how to create a
client to a web service.
-        WSDL, like SOAP, is an XML based specification.
-        With the proper tools, and access to a WSDL file, you can create a client to a web service.
•        Although most language and platforms provide the tools to create and consume XML messages, parsing
those messages by hand becomes tedious.
-        Calling a web service should be seamless.  You shouldn’t need to write 10 lines of protocol translation
code to send a message or call a method.
-        Systems will need to be able to create code to make this easier and need to be able to write a proxy
quickly and easily.
-        XML message formats should be easily translated into platform specific objects with ease.

•        WSDL provides a description of a web service.
-         WSDL is Web Service Description Language and is a standard way to describe how to communicate to
a web service.
-        A WSDL document is an XML document that follows the WSDL schema.
-        The WSDL definition is used by most technologies that create web services.
-        WSDL has become the key to getting interoperability between different systems by making clients side
code (and duplicate server implementations) easy to create.
-        WSDL is not only useful for SOAP based services, but does work well with SOAP.  These two specs
are maintained separately.
WSDL use Scenario 1                                                                
•        Scenario 1: We have an existing Web Service and we want clients to use it.
-        For simplicity sake we will refer to a StockQuoteService which is a very common demonstration of
Web Services.
-        The StockQuoteService will allow a user to obtain the last price of a stock by feeding in the stock
symbol.
-        Assume you have successfully created a web object or component that can accept XML and it spits
out another XML document when it runs.  In other words you have a Web Service.
-        Now a client would like to use the web service.  How do we tell them what to send us?
•        The basic problem is that our clients must find a way to generate the XML document and then process
the return XML.
-        We could send them a library of code that allows them to invoke the server, but they would need to run
the same platform as us (Java/.Net/C++ …).
-        We could document the XML messages really well and hand that document to them, but updating that
document might be problematic and that would force the client to do a bunch of XML parsing code.
-        Instead we will feed out a document that follows a standard called WSDL.

•        The WSDL document describes the web service.
-        The WSDL document is an XML document, so it can be sent via HTTP to the client.
-        The description matches the spec and is machine predictable and machine producible.
-        We will see how this is done in a few pages.
•        SOAP toolkits all come with WSDL tools, which we will generically call a WSDL engine.
-        The WSDL engine is fed the WSDL file.
-        The engine produces (writes/generates) a library that allows you to invoke a web service.
-        The library created by the engine will typically result in a simple, easy to use proxy, or stub, that
produces the XML to be sent, and digests the XML returned from the Service.

•        When you provide accurate WSDL documents to your clients, they have an easier time calling the web
services.
•        To demonstrate an example we can look at a client created using a toolkit called Axis for the web service
we described above.
-        The WSDL engine in this case created the classes used by this client snippet: StockPriceService,
StockPriceServiceLocator, StockPrice, among others.
StockPriceService locator = new StockPriceServiceLocator();
StockPrice service = locator.getStockPrice();

String ret = service.getLatestTradePrice("LRT");

System.out.println("LifeRate (LRT) last sold at: " + ret);
•        This example is basically a hello world example and before moving to the second scenario we should
mention a few details.
-        If more complex types were being passed to the service (like Account instead of String), supporting
object types would be created by the engine.
-        The packaging details are left out in this code snippet.
•        The basic steps to creating client become simple.
1.        Obtain a WSDL document from a service provider.
2.        Run the WSDL document through some kind of software we called the WSDL engine.
3.        Figure out how to use the Proxies generated and call the web service.
WSDL Use Scenario 2                                                                
•        In this scenario we assume your client is using another vendor’s services.
-        The services offered by your competitor are more attractive for some reason.
-        Possibly the other vendor created the web service first.
•        You can use a WSDL engine to produce the web service.
-        WSDL tools allow you to create the Web Service using a WSDL file.
-        The service created will have a portion unimplemented.  You will find this section and code the actual
business logic.
-        Typically all supporting types and documents needed to create and deploy your web service will be
created by the WSDL engine.
•        With the new web service created, the perspective client should only have to change about one line of
code to switch from using the original vendor to using a new vendor.
•        To demonstrate the change to client code we will use an Axis example.  The following code:
StockPrice service = locator.getStockPrice();
Would be replaced by this:
StockPrice service = locator.getStockPrice(
  new URL(http://www.mystuff.com/axis/StockQuote));
WSDL
Table of Contents
Courseware
Training Resources
Tutorials
Services