WSDL

From BC$ MobileTV Wiki
Jump to: navigation, search

Web Services Description Language (commonly abbreviated WSDL) is an XML-based language used to define web services and to describe how to access them. WSDL is a suggestion by Ariba, IBM and Microsoft for describing services for the W3C XML Activity on XML Protocols. You can read more about WSDL in our WSDL tutorial.


Specifications


What is WSDL?

   * WSDL stands for Web Services Description Language
   * WSDL is written in XML
   * WSDL is an XML document
   * WSDL is used to describe Web services
   * WSDL is also used to locate Web services
   * WSDL is not yet a W3C standard


Independence from Operating Systems

Operating System and Device Independence is acheived through consistent namespaces and document definitions provided by the W3C.


Format

A WSDL document describes a Web Service and the available methods it exposes. A WSDL binding describes how the service is bound to a messaging protocol, particularly the SOAP messaging protocol. A WSDL SOAP binding can be either a Remote Procedure Call (RPC) style binding or a document style binding. A SOAP binding can also have an encoded use or a literal use. This gives you four style/use models:

  • RPC/encoded
  • RPC/literal
  • Document/encoded
  • Document/literal


WSDL Elements

ElementDescription
typesDefines data types that a web service’s messages can use.
messageDefines the data that a web services operation transfers.
portTypeDefines one or more operations that a web service provides.
operationDefines a combination of input, output, and fault messages.
inputSpecifies a message that a client such as a Flex application sends to a web service.
outputSpecifies a message that a web service sends to a client such as a Flex application.
faultSpecifies an error value returned as a result of a problem processing a message.
bindingSpecifies the protocol used to communicate with a web service. Bindings exist for SOAP, HTTP GET, HTTP POST, and MIME. Flex supports the SOAP binding only.
serviceDefines a collection of ports. Each service maps to one portType and specifies different ways to access the operations in that portType.
portA web services endpoint that specifies an association between a binding and a network address.

[1]


EXAMPLES

WSDL 1.1

  <message name="getRecommendationRequest">
     <part name="recommendation" type="xs:integer"/>
     <part name="title" type="xs:string"/>
     <part name="image" type="xs:string"/>
     <part name="link" type="xs:string"/>
  </message>
  <message name="getRecommendationResponse">
     <part name="recommendationValue" type="xs:integer"/>
     <part name="titleValue" type="xs:string"/>
     <part name="imageValue" type="xs:string"/>
     <part name="linkValue" type="xs:string"/>
  </message>
  <portType name="recommendations">
    <operation name="recommend">
        <input message="getRecommendationRequest"/>
        <output message="getRecommendationResponse"/>
    </operation>
  </portType>
  <binding type="recommendations" name="b1">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <operation>
      <soap:operation soapAction="http://bcmoney-mobiletv.com/services/recommend"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>


WSDL 2.0

<description>
  <message name="getRecommendationRequest">
     <part name="recommendation" type="xs:integer"/>
     <part name="title" type="xs:string"/>
     <part name="image" type="xs:string"/>
     <part name="link" type="xs:string"/>
  </message>
  <message name="getRecommendationResponse">
     <part name="recommendationValue" type="xs:integer"/>
     <part name="titleValue" type="xs:string"/>
     <part name="imageValue" type="xs:string"/>
     <part name="linkValue" type="xs:string"/>
  </message>
  <types name="recommendations">
    <operation name="recommend">
        <input message="getRecommendationRequest"/>
        <output message="getRecommendationResponse"/>
    </operation>
     <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://bcmoney-mobiletv.com/services/recommend">
        <xs:element name="recommend">
           <xs:complexType>
              <xs:sequence/>
           </xs:complexType>
        </xs:element>
     </xs:schema>
  </types>
  <interface name="recommendations">
    <operation name="recommend" pattern="http://www.w3.org/ns/wsdl/in-out">
      <input element="#any"/>
      <output element="#any"/>
    </operation>
  </interface>
  </binding>
  <service name="RecommendationService" interface="video:Recommend">
     <endpoint name="VideoRecommender" binding="video:RecommendSoapBinding" address="http://bcmoney-mobiletv.com/services/recommend/video"/>
  </service>
</description>



Tools

Resources

[4]


Tutorials


External Links

References

  1. IBM DeveloperWorks on Which WSDL format to use in different scenarios: http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/
  2. PHP app for validating/viewing WSDL: http://tomi.vanek.sk/index.php?page=wsdl-viewer
  3. http://tomi.vanek.sk/index.php?page=wsdl-viewer
  4. http://wso2.org/repos/wso2/people/jonathan/flickr.wsdl

See Also

Web Services | SOAP | REST | XML | XSLT | W3C | WS-*