Tutorials Point


  WSDL Tutorial
  WDSL References
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     About TP     Advertising  

WSDL Types Element

previous next AddThis Social Bookmark Button


Advertisements

A Web service needs to define its inputs and outputs and how they are mapped into and out of services. WSDL <types> element take care of defining the data types that are used by the web service. Types are XML documents, or document parts.

Here is a piece of code taken from W3C specification. This code depicts how a types element can be used within a WSDL.

  • The types element describes all the data types used between the client and server.

  • WSDL is not tied exclusively to a specific typing system

  • WSDL uses the W3C XML Schema specification as its default choice to define data types.

  • If the service uses only XML Schema built-in simple types, such as strings and integers, then types element is not required.

  • WSDL allows the types to be defined in separate elements so that the types are reusable with multiple Web services.

  <types>
    <schema targetNamespace="http://example.com/stockquote.xsd"
            xmlns="http://www.w3.org/2000/10/XMLSchema">
      <element name="TradePriceRequest">
        <complexType>
          <all>
            <element name="tickerSymbol" type="string"/>
          </all>
        </complexType>
      </element>
      <element name="TradePrice">
         <complexType>
           <all>
             <element name="price" type="float"/>
           </all>
         </complexType>
      </element>
    </schema>
  </types>

Data types address the problem of how to identify the data types and formats you intend to use with your Web services. Type information is shared between sender and receiver. The recipients of messages therefore need access to the information you used to encode your data and must understand how to decode the data.



previous next Printer Friendly

Advertisements


  

Advertisements