<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification V2.2+WSDL//EN" "xmlspec.dtd">
<!--
/*
 * Copyright © 2007 World Wide Web Consortium,
 *
 * (Massachusetts Institute of Technology, European Research Consortium for
 * Informatics and Mathematics, Keio University). All Rights Reserved. This
 * work is distributed under the W3C® Document License [1] in the hope that
 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231
 */
    -->
<?xml-stylesheet type='text/xsl' href='xmlspec-wsdl.xsl'?><spec xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:z="http://www.w3.org/2004/zml" shortname="wsdl20-primer" w3c-doctype="rec" role="public" xml:space="default">
	<header xml:space="default">
		<title xml:space="default">Web Services Description Language (WSDL) Version 2.0 Part 0: Primer</title>
		<w3c-designation xml:space="default">http://www.w3.org/TR/2007/REC-wsdl20-primer-20070626</w3c-designation>
		<w3c-doctype xml:space="default">W3C Recommendation</w3c-doctype>
		<pubdate xml:space="default">
			<day xml:space="default">26</day>
			<month xml:space="default">June</month>
			<year xml:space="default">2007</year>
		</pubdate>
		<publoc xml:space="default">
			<loc href="http://www.w3.org/TR/2007/REC-wsdl20-primer-20070626" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/2007/REC-wsdl20-primer-20070626</loc>
		</publoc>
		<altlocs xml:space="default">
	<loc role="pdf" href="wsdl20-primer.pdf" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">PDF</loc>
	<loc role="postscript" href="wsdl20-primer.ps" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">PostScript</loc>
	<loc role="xml" href="wsdl20-primer.xml" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">XML</loc>
	<loc role="plain" href="wsdl20-primer.txt" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">plain text</loc>
    </altlocs>
    <prevlocs xml:space="default">
    <loc href="http://www.w3.org/TR/2007/PR-wsdl20-primer-20070523" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/2007/PR-wsdl20-primer-20070523</loc>
  </prevlocs>
		<latestloc xml:space="default">
			<loc href="http://www.w3.org/TR/wsdl20-primer" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">http://www.w3.org/TR/wsdl20-primer</loc>
		</latestloc>
		<authlist xml:space="default">
			<author xml:space="default">
				<name xml:space="default">David Booth</name>
				<affiliation xml:space="default">W3C Fellow / Hewlett-Packard</affiliation>
			</author>
			<author xml:space="default">
				<name xml:space="default">Canyang Kevin Liu</name>
				<affiliation xml:space="default">SAP Labs</affiliation>
			</author>
		</authlist>
		<errataloc href="http://www.w3.org/2007/06/wsdl20-errata.html" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest"/>
		<abstract id="Abstract" xml:space="default">
			<p xml:space="default">
				This document is a companion to the WSDL 2.0
				specification (<emph xml:space="default">Web Services Description Language (WSDL) Version 2.0 Part 1: Core Language</emph>
				<bibref ref="WSDL-PART1" xml:space="default"/>,
				<emph xml:space="default">Web Services Description Language (WSDL) Version 2.0 Part 2: Adjuncts</emph>
				<bibref ref="WSDL-PART2" xml:space="default"/>). It is intended for readers who wish to have an
				easier, less technical introduction to the main features
				of the language.
			</p>
			<p xml:space="default">
				This primer is only intended to be a starting point
				toward use of WSDL 2.0, and hence does not describe
				every feature of the language. Users are expected to
				consult the WSDL 2.0 specification if they wish to make
				use of more sophisticated features or techniques.
			</p>
			<p xml:space="default">
				Finally, this primer is
				<emph xml:space="default">non-normative</emph>.
				Any specific questions of what WSDL 2.0 requires or
				forbids should be referred to the WSDL 2.0
				specification.
			</p>
		</abstract>
		
<status id="Status" xml:space="default">

  <p xml:space="default">
    <emph xml:space="default">This section describes the status of this document at the time
    of its publication. Other documents may supersede this document. A
    list of current W3C publications and the latest revision of this
    technical report can be found in the <loc href="http://www.w3.org/TR/" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">W3C technical reports index</loc> at
    http://www.w3.org/TR/.</emph>
  </p>

   <p xml:space="default">This is the <loc href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsW3C" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">W3C
    Recommendation</loc> of Web Services Description Language
   (WSDL) Version 2.0 Part 0: Primer for review by W3C Members and
   other interested parties. It has been produced by the <loc href="http://www.w3.org/2002/ws/desc/" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">Web Services Description
   Working Group</loc>, which is part of the <loc href="http://www.w3.org/2002/ws/Activity" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">W3C Web Services
   Activity</loc>.</p>

      <p xml:space="default">Please send comments about this document to the public <loc href="mailto:public-ws-desc-comments@w3.org" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">public-ws-desc-comments@w3.org</loc>
    mailing list (<loc href="http://lists.w3.org/Archives/Public/public-ws-desc-comments/" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">public
    archive</loc>).
  </p>

   <p xml:space="default">
     The Working Group released a test suite along with an <loc href="http://www.w3.org/2002/ws/desc/5/impl-report/" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">implementation
     report</loc>. A <loc href="wsdl20-primer-diff.html" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">diff-marked
     version against the previous version of this document</loc> is
     available.
    </p>
    
    <!-- Boilerplate -->

    <p xml:space="default">
      This document has been reviewed by W3C Members, by software
      developers, and by other W3C groups and interested parties, and
      is endorsed by the Director as a W3C Recommendation. It is a
      stable document and may be used as reference material or cited
      from another document. W3C's role in making the Recommendation
      is to draw attention to the specification and to promote its
      widespread deployment. This enhances the functionality and
      interoperability of the Web.
    </p>

    <p xml:space="default">
      This document is governed by the <loc href="http://www.w3.org/TR/2002/NOTE-patent-practice-20020124" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">24
      January 2002 CPP</loc> as amended by the <loc href="http://www.w3.org/2004/02/05-pp-transition" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">W3C Patent
      Policy Transition Procedure</loc>. W3C maintains a <loc href="http://www.w3.org/2002/ws/desc/2/04/24-IPR-statements.html" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">public
      list of any patent disclosures</loc> made in connection with the
      deliverables of the group; that page also includes instructions
      for disclosing a patent. An individual who has actual knowledge
      of a patent which the individual believes contains <loc href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">Essential
      Claim(s)</loc> must disclose the information in accordance with
      <loc href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure" xml:space="default" xlink:type="simple" xlink:show="replace" xlink:actuate="onRequest">section
      6 of the W3C Patent Policy</loc>.
    </p>


</status>

    <langusage xml:space="default">
			<language id="en" xml:space="default">English</language>
		</langusage>
		<revisiondesc xml:space="default">
		  <p xml:space="default">"Editor"Editors' copy $Date: 2007/06/19 15:23:13 $</p>
		</revisiondesc>
	</header>
	<body xml:space="preserve">
		<!-- ****************Introduction********************************* -->
		<div1 id="Introduction" xml:space="default">
			<head xml:space="default">Introduction</head>			
                    <div2 id="Prerequisites" xml:space="default"><head xml:space="default">Prerequisites</head>
			<p xml:space="default">This primer assumes that the reader has the following prerequisite knowledge:
			<ulist xml:space="default"><item xml:space="default"><p xml:space="default"> familiarity with XML (<emph xml:space="default">Extensible Markup Language (XML) 1.0</emph> <bibref ref="XML10" xml:space="default"/>, <emph xml:space="default">XML Information Set</emph> <bibref ref="XMLInfoSet" xml:space="default"/>) and  XML Namespaces (<emph xml:space="default">Namespaces in XML</emph> <bibref ref="XMLNS" xml:space="default"/>);</p></item><item xml:space="default"><p xml:space="default">some familiarity with XML Schema (<emph xml:space="default">XML Schema Part 1: Structures</emph>  <bibref ref="XMLSchemaP1" xml:space="default"/>  <emph xml:space="default">XML Schema Part 2: Datatypes</emph> <bibref ref="XMLSchemaP2" xml:space="default"/>);</p></item>
			<item xml:space="default"><p xml:space="default"> familiarity with basic Web services concepts such as Web service, client, and the purpose and function of a  Web service description.  (For an explanation of basic Web services concepts, see   <emph xml:space="default">Web Services Architecture</emph> <bibref ref="wsarch" xml:space="default"/>  <xspecref href="http://www.w3.org/TR/2004/NOTE-ws-arch-20040211/#whatis" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Section 1.4</xspecref> and <emph xml:space="default">Web Services Glossary</emph> <bibref ref="WSAGLOSS" xml:space="default"/> <xspecref href="http://www.w3.org/TR/2004/NOTE-ws-gloss-20040211/" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">glossary</xspecref>.   However, note the <emph xml:space="default">Web Services Architecture</emph>  document uses the slightly more precise terms "<xspecref href="http://www.w3.org/TR/2004/NOTE-ws-gloss-20040211/#requesteragent" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">requester agent</xspecref>" and "<xspecref href="http://www.w3.org/TR/2004/NOTE-ws-gloss-20040211/#provideragent" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">provider agent</xspecref>" instead of the terms "client" and "Web service" used in this primer.)</p>
			</item>
			</ulist>
			No previous experience with WSDL is assumed.</p></div2>
			<div2 id="PrimerStructure" xml:space="default">
				<head xml:space="default">Structure of this Primer</head>
				
				
				
				<p xml:space="default">Section 2 starts with a hypothetical use case involving a hotel reservation service.  It proceeds step-by-step through the development of a simple example WSDL 2.0 document that describes this service:<ulist xml:space="default"><item xml:space="default"><p xml:space="default">The   <code xml:space="default">types</code>  element describes the kinds of messages that the service will send and receive.  </p></item><item xml:space="default"><p xml:space="default">The <code xml:space="default">interface</code> element describes <emph xml:space="default">what</emph>  abstract functionality the Web service provides.   </p></item><item xml:space="default"><p xml:space="default">The <code xml:space="default">binding</code> element describes <emph xml:space="default">how</emph> to access the service. </p></item><item xml:space="default"><p xml:space="default">The <code xml:space="default">service</code> element describes <emph xml:space="default">where</emph> to access the service.</p></item></ulist></p>
				<p xml:space="default">After presenting the example, it moves on to introduce the WSDL 2.0 infoset, schema, and component model. Then it provides more detailed coverage on defining message types, interfaces, bindings, and services.</p>
				
				<p xml:space="default">Section 3 explains the WSDL 2.0 importing mechanisms in great details.</p>
				
				<p xml:space="default">Section 4 talks about WSDL 2.0 extensibility and various predefined extensions. </p>
				
				<p xml:space="default">Section 5 covers various topics that may fall outside the scope of WSDL 2.0, but shall provide useful background and best practice guidances that may be useful when authoring a WSDL 2.0 document or implementing the WSDL 2.0 specification.
</p>
				

			</div2>
			
						<div2 id="UseIRI" xml:space="default">
				<head xml:space="default">Use of URIs and IRIs</head>
				
				<p xml:space="default">The core specification of WSDL 2.0 supports Internationalized Resource Identifiers or IRIs <bibref ref="RFC3987" xml:space="default"/>.  IRIs are a superset of URIs with added support for internationalization. The URI syntax <bibref ref="RFC3986" xml:space="default"/> only allows the use of  a small set of characters, including upper and lower case letters of the English alphabet, European numerals and a few symbols. IRIs  allow the use of characters from a wider range of language scripts. </p>
 
<p xml:space="default">For simplicity, examples throughout this primer only use URIs.  If you are interested in learning more about the use of IRIs, you might care to read the <xspecref href="http://www.w3.org/International/articles/idn-and-iri/" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">paper</xspecref> prepared by the <xspecref href="http://www.w3.org/International/" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">W3C Internationalization Activity</xspecref>. 					
</p>
				

			</div2>
			
			
			<div2 id="notation" xml:space="default">
				<head xml:space="default">Notational Conventions</head>
				<p xml:space="default">This document uses several XML namespaces, some of which are defined by standards, and some are application-specific.  Namespace names of the general form
   <attval xml:space="default">http://greath.example.com/...</attval> represent application or
   context-dependent URIs <bibref ref="RFC3986" xml:space="default"/>.Note also that the choice of
   any namespace prefix is arbitrary and not semantically significant
   (see <bibref ref="XMLInfoSet" xml:space="default"/>). </p>
   
   <p xml:space="default">Following the convention for XML syntax summary in <bibref ref="WSDL-PART1" xml:space="default"/>, this primer uses an informal syntax to describe the XML grammar of a WSDL 2.0 document: 
   <ulist xml:space="default">
   <item xml:space="default"><p xml:space="default">The syntax appears as an XML instance, but the values indicate the data types instead of values.</p></item> 
   <item xml:space="default"><p xml:space="default">Characters are appended to elements and attributes as follows: "?" (0 or 1), "*" (0 or more), "+" (1 or more).</p></item> 
<item xml:space="default"><p xml:space="default">Elements names ending in "…"  indicate that elements/attributes irrelevant to the context are being omitted.</p> </item>
   </ulist>
   
   </p>
			</div2>
			
			
		</div1>

		<!-- ****************WSDL2.0 BASICS********************************* -->
		<div1 id="basics" xml:space="default">
			<head xml:space="default">WSDL 2.0 Basics</head>
			
			<div2 id="basic-example" xml:space="default"><head xml:space="default">Getting Started: The GreatH Hotel Example</head>
			<p xml:space="default">This section introduces the basic concepts used in WSDL 2.0 through the description of a hypothetical hotel reservation service. We start with a simple scenario, and later add more requirements to illustrate how more advanced WSDL 2.0 features may be used. </p>

			<!-- ************************ GreatH *************************** -->
			<div3 id="basics-greath-scenario" xml:space="default"><head xml:space="default">Example Scenario: The GreatH Hotel Reservation Service</head><p xml:space="default">Hotel GreatH (a fictional hotel) is located in a remote island. It has been relying on fax and phone to provide room reservations. Even though the facilities and prices at GreatH are better than what its competitor offers, GreatH notices that its competitor is getting more customers than GreatH.   After research, GreatH realizes that this is because the  competitor offers a Web service that permits travel agent reservation systems to reserve rooms directly over the Internet.  GreatH then hires us to build a reservation Web service with the following functionality:  <ulist xml:space="default"><item xml:space="default"><p xml:space="default"><emph xml:space="default">CheckAvailability</emph>. To check availability, the client must specify a check-in date, a check-out date, and room type.  The Web service will return a room rate (a floating point number in USD) if such a room is available, or a zero room rate if not. If any input data is invalid, the service should return an error.  Thus, the service will accept a <code xml:space="default">checkAvailability</code> message and return a <code xml:space="default">checkAvailabilityResponse</code> or <code xml:space="default">invalidDataFault</code> message.</p>  </item><item xml:space="default"><p xml:space="default"><emph xml:space="default">MakeReservation</emph>.  To make a reservation, a client must provide a name, address, and credit card information, and the service will return a confirmation number if the reservation is successful.  The service will return an error message if the credit card number or any other data field is invalid.  Thus, the service will accept a <code xml:space="default">makeReservation</code> message and return a <code xml:space="default">makeReservationResponse</code> or <code xml:space="default">invalidCreditCardFault</code> message.</p></item></ulist> We know that we will later need to build a complete system that supports transactions and secured transmission, but initially we will implement only minimal functionality.  In fact, to simplify our first example, we will implement only the <emph xml:space="default">CheckAvailability</emph> operation.  </p><p xml:space="default">The next several sections proceed step-by-step through the process of developing a WSDL 2.0 document that describes the desired Web service.  However, for those who can't wait to see a complete example, here is the WSDL 2.0 document that we'll be creating.</p><example id="example-initial" xml:space="default">
					<head xml:space="default">WSDL 2.0 Document for the GreatH Web Service (Initial Example)</head>
					<eg xml:space="default">
&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    xmlns="http://www.w3.org/ns/wsdl"
    targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
    xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
    xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
    xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap"
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
    xmlns:wsdlx= "http://www.w3.org/ns/wsdl-extensions"&gt;

  &lt;documentation&gt;
    This document describes the GreatH Web service.  Additional 
    application-level requirements for use of this service -- 
    beyond what WSDL 2.0 is able to describe -- are available 
    at http://greath.example.com/2004/reservation-documentation.html
  &lt;/documentation&gt;

  &lt;types&gt;
    &lt;xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://greath.example.com/2004/schemas/resSvc"
        xmlns="http://greath.example.com/2004/schemas/resSvc"&gt;

      &lt;xs:element name="checkAvailability" type="tCheckAvailability"/&gt;    
      &lt;xs:complexType name="tCheckAvailability"&gt;     
        &lt;xs:sequence&gt;      
          &lt;xs:element  name="checkInDate" type="xs:date"/&gt;      
          &lt;xs:element  name="checkOutDate" type="xs:date"/&gt;      
          &lt;xs:element  name="roomType" type="xs:string"/&gt;      
        &lt;/xs:sequence&gt;     
      &lt;/xs:complexType&gt;   
            
      &lt;xs:element name="checkAvailabilityResponse" type="xs:double"/&gt;    
    
      &lt;xs:element name="invalidDataError" type="xs:string"/&gt;    

    &lt;/xs:schema&gt;    
  &lt;/types&gt;
  
  &lt;interface  name = "reservationInterface" &gt;

    &lt;fault name = "invalidDataFault"
            element = "ghns:invalidDataError"/&gt; 
   
    &lt;operation name="opCheckAvailability" 
            pattern="http://www.w3.org/ns/wsdl/in-out" 
            style="http://www.w3.org/ns/wsdl/style/iri"
            wsdlx:safe = "true"&gt;
        &lt;input messageLabel="In" 
              element="ghns:checkAvailability" /&gt;
        &lt;output messageLabel="Out" 
              element="ghns:checkAvailabilityResponse" /&gt;
        &lt;outfault ref="tns:invalidDataFault" messageLabel="Out"/&gt;
    &lt;/operation&gt;

  &lt;/interface&gt;

  &lt;binding name="reservationSOAPBinding" 
	  interface="tns:reservationInterface"
	  type="http://www.w3.org/ns/wsdl/soap"
	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"&gt;
 
    &lt;fault ref="tns:invalidDataFault" 
      wsoap:code="soap:Sender"/&gt;

    &lt;operation ref="tns:opCheckAvailability" 
      wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/&gt;

  &lt;/binding&gt;

  &lt;service name="reservationService" 
       interface="tns:reservationInterface"&gt;

     &lt;endpoint name="reservationEndpoint" 
               binding="tns:reservationSOAPBinding"
               address ="http://greath.example.com/2004/reservation"/&gt;
        
  &lt;/service&gt;

&lt;/description&gt;</eg>
				</example>
				

</div3>

<div3 id="basics-getting-started" xml:space="default"><head xml:space="default">Defining a WSDL 2.0 Target Namespace</head><p xml:space="default">Before writing our WSDL 2.0 document, we need to decide on a <emph xml:space="default">WSDL 2.0 target namespace</emph> URI for it.  The WSDL 2.0 target namespace is analogous to an XML Schema target namespace. Interface, binding and service names that we define in our WSDL 2.0 document will be associated with the WSDL 2.0 target namespace, and thus will be distinguishable from similar names in a different WSDL 2.0 target namespace.  (This will become important if using WSDL 2.0's import or interface inheritance mechanisms.)  </p><p xml:space="default">The value of the  WSDL 2.0  target namespace must be an absolute URI.  Furthermore, it should be dereferenceable to a WSDL 2.0 document that describes the Web service that the WSDL 2.0 target namespace is used to describe.  For example, the GreatH owners should make the WSDL 2.0 document available from this URI.  (And if a WSDL 2.0 description is split into multiple documents, then the WSDL 2.0 target namespace should resolve to a master document that includes all the WSDL 2.0 documents needed for that service description.)  However, there is no absolute requirement for this URI to be dereferenceable, so a WSDL 2.0 processor must not depend on it being dereferenceable.  </p><p xml:space="default">This recommendation may sound circular, but bear in mind that the client might have obtained the WSDL 2.0 document from anywhere -- not necessarily an authoritative source.  But by dereferencing the WSDL 2.0 target namespace URI, a user  should be able to obtain an authoritative version.  Since GreatH will be the owner of the service, the WSDL 2.0 target namespace URI should refer to a location on  the GreatH Web site or otherwise within its control.</p><p xml:space="default">Once we have decided on a WSDL 2.0 target namespace URI, we can begin our WSDL 2.0 document as the following empty shell.</p><example id="example-empty-shell" xml:space="default">
					<head xml:space="default">An Initial Empty WSDL 2.0 Document</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    xmlns="http://www.w3.org/ns/wsdl"
    targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
    xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
    . . . &gt;

  . . .
&lt;/description&gt;</eg>
				</example><div4 id="example-empty-shell-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><p xml:space="default"><glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;description</code></label><def xml:space="default"><p xml:space="default">Every WSDL 2.0 document has a <code xml:space="default">description</code> element as its top-most element.  This merely acts as a container for the rest of the WSDL 2.0 document, and is used to declare namespaces that will be used throughout the document.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">xmlns="http://www.w3.org/ns/wsdl"</code></label>
				<def xml:space="default">
					<p xml:space="default">
						This is the XML namespace for WSDL 2.0 itself. We assign it as the default namespace for this example by not defining a prefix for it. In other words, any unprefixed elements in this example are expected to be WSDL 2.0 elements (such as the <code xml:space="default">description</code> element).
					</p>
				</def>
</gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">targetNamespace= "http://greath.example.com/2004/wsdl/resSvc"</code></label><def xml:space="default"><p xml:space="default">This defines the WSDL 2.0 target namespace that we have chosen for the GreatH reservation service, as described above.  Note that this is not an actual XML namespace declaration.  Rather, it is a WSDL 2.0 attribute whose purpose is <emph xml:space="default">analogous</emph> to an XML Schema target namespace.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"</code></label><def xml:space="default"><p xml:space="default">This is an actual XML namespace declaration for use in our GreatH service description.  Note that this is the same URI that was specified above as the value of  the <att xml:space="default">targetNamespace</att> attribute.   This will allow us later to use the  <code xml:space="default">tns:</code>   prefix in QNames, to refer to the WSDL 2.0 target namespace of the GreatH service.  (For more on QNames see <bibref ref="XMLNS" xml:space="default"/>   section 3 <xspecref href="http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-qualnames" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Qualified Names</xspecref>.)</p></def></gitem></glist></p><p xml:space="default">  Now  we can start describing the GreatH service. </p></div4></div3>

<div3 id="basics-types" xml:space="default"><head xml:space="default">Defining Message Types</head><p xml:space="default">We know that the GreatH service will be sending and receiving messages, so a good starting point in describing the service is to define the message types that the service will use.  We'll use XML Schema to do so, because WSDL 2.0 processors are likely to support XML Schema at a minimum.  However, WSDL 2.0 does not prohibit the use of some other schema definition language.</p><p xml:space="default">WSDL 2.0 allows message types to be defined directly within the WSDL 2.0 document, inside the <code xml:space="default">types</code> element, which is a child of the <code xml:space="default">description</code> element.   (Later we'll see how we can provide the type definitions in a separate document, using XML Schema's <code xml:space="default">import</code> mechanism.)    The following schema defines <code xml:space="default">checkAvailability</code>, <code xml:space="default">checkAvailabilityResponse</code> and <code xml:space="default">invalidDataError</code> message types that we'll need.  </p><p xml:space="default">In WSDL 2.0, all normal and fault message types must be defined as single <emph xml:space="default">elements</emph> at the topmost level (though of course each element may have any amount of substructure inside it).  Thus, a message type must not directly consist of a sequence of elements or other complex type.  </p><example id="example-initial-types" xml:space="default">
					<head xml:space="default">GreatH Message Types</head>
					<eg xml:space="default">
&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    xmlns="http://www.w3.org/ns/wsdl"
    targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
    xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
    xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
    . . . &gt;

  ...

  &lt;types&gt;
    &lt;xs:schema 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        targetNamespace="http://greath.example.com/2004/schemas/resSvc"
        xmlns="http://greath.example.com/2004/schemas/resSvc"&gt;

      &lt;xs:element name="checkAvailability" type="tCheckAvailability"/&gt;    
      &lt;xs:complexType name="tCheckAvailability"&gt;     
        &lt;xs:sequence&gt;      
          &lt;xs:element  name="checkInDate" type="xs:date"/&gt;      
          &lt;xs:element  name="checkOutDate" type="xs:date"/&gt;      
          &lt;xs:element  name="roomType" type="xs:string"/&gt;      
        &lt;/xs:sequence&gt;     
      &lt;/xs:complexType&gt;   
            
      &lt;xs:element name="checkAvailabilityResponse" type="xs:double"/&gt;    
    
      &lt;xs:element name="invalidDataError" type="xs:string"/&gt;    

    &lt;/xs:schema&gt;    
  &lt;/types&gt;
  . . .
&lt;/description&gt;</eg>
				</example><div4 id="example-initial-types-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"</code></label><def xml:space="default"><p xml:space="default">We've added another namespace declaration.  The <code xml:space="default">ghns</code> namespace prefix will allow us (later, when defining an interface) to reference the XML Schema target namespace that we define for our message types.  Thus, the URI we specify must be the same as the URI  that we define as the target namespace of our XML Schema types (below) -- <emph xml:space="default">not</emph> the target namespace of the WSDL 2.0 document itself.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">targetNamespace="http://greath.example.com/2004/schemas/resSvc"</code></label><def xml:space="default"><p xml:space="default">This is the XML Schema target namespace that we've created for  use by the GreatH reservation service.  The <code xml:space="default">checkAvailability</code>, <code xml:space="default">checkAvailabilityResponse</code> and <code xml:space="default">invalidDataError</code> element names will be associated with this XML Schema target namespace.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">checkAvailability</code>, <code xml:space="default">checkAvailabilityResponse</code> and <code xml:space="default">invalidDataError</code></label><def xml:space="default"><p xml:space="default">These are the message types that we'll use.  Note that these are defined to be XML <emph xml:space="default">elements</emph>, as explained above.</p></def></gitem></glist><p xml:space="default">Although we have defined several types, we have not yet indicated which ones are to be used as message types for a Web service.  We'll do that in the next section.  </p></div4></div3>
				
				<div3 id="basics-interface" xml:space="default"><head xml:space="default">Defining an Interface</head><p xml:space="default">WSDL 2.0 enables one to separate the description of a Web service's abstract functionality from the concrete details of how and where that functionality is offered.    This separation facilitates different levels of reusability and distribution of work in the lifecycle of a Web service and the WSDL 2.0 document that describes it. </p><p xml:space="default">A WSDL 2.0 <code xml:space="default">interface</code> defines the abstract interface of a Web service as a set of abstract <emph xml:space="default">operations</emph>, each operation representing a simple interaction between the client and the service.  Each operation specifies the types of messages that the service can send or receive as part of that operation.  Each operation also specifies a message exchange <emph xml:space="default">pattern</emph> that indicates the sequence in which the associated messages are to be transmitted between the parties.   For example, the <emph xml:space="default">in-out</emph> pattern (see <emph xml:space="default">WSDL 2.0 Predefined Extensions</emph> <bibref ref="WSDL-PART2" xml:space="default"/> section  2.2.3 <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">In-Out</xspecref>) indicates that if the client sends a message <emph xml:space="default">in</emph> to the service, the service will either send a reply message back <emph xml:space="default">out</emph> to the client (in the normal case) or it will send a fault message back to the client (in the case of an error). We will explain more about message exchange <emph xml:space="default">pattern</emph>s in <specref ref="more-interfaces-meps" xml:space="default"/></p>
				
				<p xml:space="default">For the GreatH service, we will (initially) define an interface containing a single operation, <code xml:space="default">opCheckAvailability</code>, using  the <code xml:space="default">checkAvailability</code> and <code xml:space="default">checkAvailabilityResponse</code> message types that we defined in the <code xml:space="default">types</code> section.   We'll use the <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">in-out</xspecref> pattern for this operation, because this is the most natural way to represent a simple request-response interaction.  We could have instead (for example) defined two separate operations using the <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">in-only</xspecref> and <xspecref href="http://www.w3.org/TR/2007/NOTE-wsdl20-additional-meps-20070626#out-only" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">out-only</xspecref> patterns (see <emph xml:space="default">WSDL 2.0 Predefined Extensions</emph> <bibref ref="WSDL-PART2" xml:space="default"/> section  2.2.1 <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-only" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">In-Only</xspecref> and section  2.2.5 <xspecref href="http://www.w3.org/TR/2007/NOTE-wsdl20-additional-meps-20070626#out-only" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Out-Only</xspecref>), but that would just complicate matters for the client, because we would then have to separately indicate to the client developer that the two operations should be used together as a request-response pair.</p><p xml:space="default">In addition to the normal input and output messages, we also need to specify the fault message that we wish to use in the event of an error.  WSDL 2.0 permits fault messages to be declared within the <code xml:space="default">interface</code> element in order to facilitate reuse of faults across operations.   If a fault occurs, it terminates whatever message sequence was indicated by the message exchange pattern of the operation.  </p><p xml:space="default">Let's add these to our WSDL 2.0 document.</p><example id="example-initial-interface" xml:space="default">
					<head xml:space="default">GreatH Interface Definition</head>
					
				<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    xmlns="http://www.w3.org/ns/wsdl"
    targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
    xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
    xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
    . . . 
    xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions"&gt;

  . . .
  &lt;types&gt;
	...
  &lt;/types&gt;
  
  &lt;interface  name = "reservationInterface" &gt;

    &lt;fault name = "invalidDataFault"
            element = "ghns:invalidDataError"/&gt; 
   
    &lt;operation name="opCheckAvailability" 
            pattern="http://www.w3.org/ns/wsdl/in-out"
            style="http://www.w3.org/ns/wsdl/style/iri"
            wsdlx:safe = "true"&gt;
        &lt;input messageLabel="In" 
              element="ghns:checkAvailability" /&gt;
        &lt;output messageLabel="Out" 
              element="ghns:checkAvailabilityResponse" /&gt;
        &lt;outfault ref="tns:invalidDataFault" messageLabel="Out"/&gt;
    &lt;/operation&gt;

  &lt;/interface&gt;

  . . .
&lt;/description&gt;</eg></example><div4 id="example-initial-interface-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;interface  name = "reservationInterface" &gt;</code></label><def xml:space="default"><p xml:space="default">Interfaces are declared directly inside the <code xml:space="default">description</code> element.  In this example, we are declaring only one interface, but in general a WSDL 2.0 document may declare more than one interface.  Thus, each interface must be given a name that is unique within the set of interfaces defined in this WSDL 2.0 target namespace.   Interface names are tokens that must not contain a space or colon (":").</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;fault name = "invalidDataFault"
            </code></label><def xml:space="default"><p xml:space="default">The <code xml:space="default">name</code> attribute defines a name for this fault.  The name is required so that when an operation is defined, it can reference the desired fault by name.  Fault names must be unique within an interface.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">element = "ghns:invalidDataError"/&gt;</code></label><def xml:space="default"><p xml:space="default">The <code xml:space="default">element</code> attribute specifies the schema type of the fault message, as previously defined in the <code xml:space="default">types</code> section.   </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;operation name="opCheckAvailability"</code></label><def xml:space="default"><p xml:space="default">The <code xml:space="default">name</code> attribute defines a name for this operation, so that it can be referenced later when bindings are defined.  Operation names must also be unique within an interface.  (WSDL 2.0 uses separate symbol spaces for operation and fault names, so operation name "foo" is distinct from fault name "foo".)</p></def></gitem>
            
            <gitem xml:space="default"><label xml:space="default"><code xml:space="default">pattern="http://www.w3.org/ns/wsdl/in-out" </code></label><def xml:space="default"><p xml:space="default">This line specifies that this operation will use the <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">in-out</xspecref> pattern as described above.  WSDL 2.0 uses URIs to identify message exchange patterns in order to ensure that the identifiers are globally unambiguous, while also permitting future new patterns to be defined by anyone.  (However, just because someone defines a new pattern and creates a URI to identify it, that does <emph xml:space="default">not</emph> mean that other WSDL 2.0 processors will automatically recognize or understand that pattern.  As with any other extension, it can only be used among processors that <emph xml:space="default">do</emph> recognize and understand it.)</p></def></gitem>
	
	<gitem xml:space="default"><label xml:space="default"><code xml:space="default">style="http://www.w3.org/ns/wsdl/style/iri" </code></label><def xml:space="default"><p xml:space="default">
	This line indicates that the XML schema defining the input message of this operation follows a set of rules as specified in <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#_operation_iri_style" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">IRI Style</xspecref> that ensures the message can be serialized as an IRI. 
	</p></def></gitem>
            
            <gitem xml:space="default"><label xml:space="default"><code xml:space="default">wsdlx:safe="true" &gt;</code></label><def xml:space="default"><p xml:space="default">This line indicates that this operation will not obligate the client in any way, i.e., the client can safely invoke this operation without fear that it may be incurring an obligation (such as agreeing to buy something).  This is further explained in  <specref ref="more-interfaces-operations" xml:space="default"/>.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;input messageLabel="In"</code></label><def xml:space="default"><p xml:space="default">The <code xml:space="default">input</code> element specifies an input message.  Even though we have already specified which message exchange pattern the operation will use, a message exchange pattern represents a template for a message sequence, and in theory could  consist of multiple input and/or output messages.  Thus we must also indicate which potential input message in the pattern this particular input message represents.  This is the purpose of the <code xml:space="default">messageLabel</code> attribute.  Since the  <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">in-out</xspecref> pattern that we've chosen to use only has one input message, it is trivial in this case: we simply fill in the message label "In" that was defined in <emph xml:space="default">WSDL 2.0 Predefined Extensions</emph> <bibref ref="WSDL-PART2" xml:space="default"/> section 2.2.3 <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">In-Out</xspecref> for the <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">in-out</xspecref> pattern.  However, if a new pattern is defined that involve multiple input messages, then the different input messages in the pattern  could then be distinguished by using different labels.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">element="ghns:checkAvailability" /&gt;</code></label><def xml:space="default"><p xml:space="default">This specifies the message type for this input message, as defined previously in the <code xml:space="default">types</code> section.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;output messageLabel="Out" . . .</code></label><def xml:space="default"><p xml:space="default">This is similar to defining an input message.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;outfault ref="tns:invalidDataFault" messageLabel="Out"/&gt;</code></label><def xml:space="default"><p xml:space="default">This associates an output fault with this operation.  Faults are declared a little differently than normal messages.  The <code xml:space="default">ref</code> attribute refers to the name of a previously defined fault in this interface -- not a message schema type directly.  Since message exchange patterns could in general involve a sequence of several messages, a fault could potentially occur at various points within the message sequence.  Because one may wish to associate a different fault with each permitted point in the sequence, the <code xml:space="default">messageLabel</code> is used to indicate the desired point for this particular fault. It does so indirectly by specifying the message that will either trigger this fault or that this fault will replace, depending on the pattern.   (Some patterns use a <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#fault-trigger" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">message-triggers-fault rule</xspecref>; others use a <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#fault-replacement" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">fault-replaces-message</xspecref> rule.  See <emph xml:space="default">WSDL 2.0 Predefined Extensions</emph> <bibref ref="WSDL-PART2" xml:space="default"/> section 2.1.2 <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#fault-trigger" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Message Triggers Fault</xspecref> and section 2.1.1 <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#fault-replacement" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Fault Replaces Message</xspecref>.) </p></def></gitem></glist><p xml:space="default">Now that we've defined the abstract interface for the GreatH service, we're ready to define a binding for it.</p></div4></div3>

			
		<div3 id="basics-binding" xml:space="default"><head xml:space="default">Defining a Binding</head>
			<p xml:space="default">
				Although we have specified
				<emph xml:space="default">what</emph>
				abstract messages can be exchanged with the GreatH Web
				service, we have not yet specified
				<emph xml:space="default">how</emph>
				those messages can be exchanged. This is the purpose of
				a
				<emph xml:space="default">binding</emph>. A binding specifies concrete message format and
				transmission protocol details for an interface, and must
				supply such details for every operation and fault in the
				interface.
			</p>
			<p xml:space="default">
				In the general case, binding details for each operation
				and fault are specified using
				<code xml:space="default">operation</code>
				and
				<code xml:space="default">fault</code>
				elements inside a
				<code xml:space="default">binding</code>
				element, as shown in the example below. However, in some
				cases it is possible to use defaulting rules to supply
				the information. The WSDL 2.0 SOAP binding extension, for example,
				defines some defaulting rules for operations. (See
				<emph xml:space="default">
					Web Services Description Language (WSDL) Version 2.0
					Part 2: Adjuncts
				</emph>
				<bibref ref="WSDL-PART2" xml:space="default"/>, <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#soap-defaults" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Default Binding Rules</xspecref>.)
			</p>
			<p xml:space="default">
				In order to accommodate new kinds of message formats and
				transmission protocols, bindings are defined using
				extensions to the WSDL 2.0 language, via WSDL 2.0's open
				content model. (See
				<specref ref="adv-extensibility" xml:space="default"/>
				for more on extensibility.) WSDL 2.0 Part 2
				<bibref ref="WSDL-PART2" xml:space="default"/>
				defines binding extensions for SOAP 1.2
				<bibref ref="SOAP12-PART1" xml:space="default"/>
				and HTTP 1.1
				<bibref ref="RFC2616" xml:space="default"/>
				as predefined extensions, so that SOAP 1.2 or HTTP 1.1
				bindings can be easily defined in WSDL 2.0 documents.
				However, other specifications could define new binding
				extensions that could also be used to define bindings.
				(As with any extension, other WSDL 2.0 processors would have
				to know about the new constructs in order to make use of
				them.)
			</p>
			<p xml:space="default">For the GreatH service, we will use SOAP 1.2 as our concrete message format and HTTP as our  underlying transmission protocol, as shown below. </p><example id="example-initial-binding" xml:space="default">
					<head xml:space="default">GreatH Binding Definition</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    xmlns="http://www.w3.org/ns/wsdl"
    targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
    xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
    xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
    xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap"
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope"&gt;
  . . .

  &lt;types&gt;
    . . .
  &lt;/types&gt;
  
  &lt;interface  name = "reservationInterface" &gt;
	...
  &lt;/interface&gt;

  &lt;binding name="reservationSOAPBinding" 
	  interface="tns:reservationInterface"
	  type="http://www.w3.org/ns/wsdl/soap"
	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"&gt;

    &lt;operation ref="tns:opCheckAvailability" 
      wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/&gt;
  
    &lt;fault ref="tns:invalidDataFault" 
      wsoap:code="soap:Sender"/&gt;

  &lt;/binding&gt;

  . . .
&lt;/description&gt;</eg>
				</example><div4 id="example-initial-binding-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap"</code></label><def xml:space="default"><p xml:space="default">We've added two more namespace declarations.  This one is the namespace for the SOAP 1.2 binding extension that is defined in WSDL 2.0 Part 3 <bibref ref="SOAP12-PART1" xml:space="default"/>.   Elements and attributes prefixed with  <code xml:space="default">wsoap:</code>  are constructs defined there.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">xmlns:soap="http://www.w3.org/2003/05/soap-envelope"</code></label><def xml:space="default"><p xml:space="default">This namespace is defined by the SOAP 1.2 specification itself.  The SOAP 1.2 specification defines certain terms within this namespace to unambiguously identify particular concepts.  Thus, we will use the <code xml:space="default">soap:</code> prefix when we need to refer to one of those terms.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;binding name="reservationSOAPBinding"</code></label><def xml:space="default"><p xml:space="default">Bindings are declared directly inside the <code xml:space="default">description</code> element.  The <att xml:space="default">name</att> attribute defines a name for this binding.  Each name must be unique among all  bindings in this WSDL 2.0 target namespace, and will be used later when we define a service endpoint that references this binding.  WSDL 2.0 uses separate symbol spaces for interfaces, bindings and services, so interface "foo", binding "foo" and service "foo" are all distinct. </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">interface="tns:reservationInterface"</code></label><def xml:space="default"><p xml:space="default">This is the name of the interface whose message format and transmission protocols we are specifying.  As discussed in <specref ref="more-bindings" xml:space="default"/>, a reusable binding can be defined by omitting the <att xml:space="default">interface</att> attribute.  Note also the use of the <code xml:space="default">tns:</code> prefix, which refers to the previously defined WSDL 2.0 target namespace for this WSDL 2.0 document.  In this case it may seem silly to have to specify the <code xml:space="default">tns:</code> prefix, but in <specref ref="adv-import-and-authoring" xml:space="default"/>  we will see how WSDL 2.0's import mechanism can be used to combine components that are defined in different WSDL 2.0 target namespaces.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">type="http://www.w3.org/ns/wsdl/soap"</code></label><def xml:space="default"><p xml:space="default">This specifies what kind of concrete message format to use, in this case SOAP 1.2.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"</code></label><def xml:space="default"><p xml:space="default">This attribute is specific to WSDL 2.0's SOAP binding extension (thus it uses the <code xml:space="default">wsoap:</code> prefix). It specifies the underlying transmission protocol that should be used, in this case HTTP.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;operation ref="tns:opCheckAvailability"</code></label><def xml:space="default">
	<p xml:space="default">
		This is not defining a new operation; rather, it is referencing the
		previously defined
		<code xml:space="default">opCheckAvailability</code>
		operation in order to specify binding details for it. This
		element can be omitted if defaulting rules are instead used to
		supply the necessary information. (See the SOAP binding extension in
		WSDL 2.0 Part 2 
		<bibref ref="WSDL-PART2" xml:space="default"/>
		section 4.3
		<xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#soap-defaults" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">
			Default Binding Rules
		</xspecref>.)
	</p>
</def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"&gt;</code></label><def xml:space="default"><p xml:space="default">This attribute is also specific to WSDL 2.0's SOAP binding extension.    It specifies the SOAP message exchange pattern (MEP) that will be used to implement the abstract WSDL 2.0  message exchange pattern (<xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#in-out" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">in-out</xspecref>) that was specified when the <code xml:space="default">opCheckAvailability</code> operation was defined. </p>
<p xml:space="default">When HTTP is used as the underlying transport protocol (as in this example) the <code xml:space="default">wsoap:mep</code> attribute also controls whether GET or POST will be used as the underlying HTTP method. In this case, the use of <code xml:space="default">wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"</code> causes GET to be used by default. See  also  <specref ref="adv-get-vs-post" xml:space="default"/>.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;fault ref="tns:invalidDataFault"</code></label><def xml:space="default"><p xml:space="default">As with a binding operation, this is not declaring a new fault; rather, it is referencing a fault (<code xml:space="default">invalidDataFault</code>) that was previously defined in the <code xml:space="default">opCheckAvailability</code> interface, in order to specify binding details for it.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">wsoap:code="soap:Sender"/&gt;</code></label><def xml:space="default"><p xml:space="default">This attribute is also specific to WSDL 2.0's SOAP binding extension.       This specifies the SOAP 1.2 fault code that will cause this fault message to be sent.   If desired, a list of subcodes can also be specified using the optional  <att xml:space="default">wsoap:subcodes</att> attribute.</p></def></gitem></glist></div4></div3>

<div3 id="basics-service" xml:space="default"><head xml:space="default">Defining a Service</head><p xml:space="default">Now that our binding has specified <emph xml:space="default">how</emph> messages will be transmitted, we are ready to specify <emph xml:space="default">where</emph> the service can be accessed, by use of the <code xml:space="default">service</code> element.  </p><p xml:space="default">A WSDL 2.0 <emph xml:space="default">service</emph> specifies a single interface that the service will support, and  a list of <emph xml:space="default">endpoint</emph> locations where that service can be accessed.  Each endpoint must also reference a previously defined binding to indicate what protocols and transmission formats are to be used at that endpoint.  A service is only permitted to have one interface.   (See  <specref ref="adv-multiple-docs-describing-same-service" xml:space="default"/> for further discussion of this limitation.) </p><p xml:space="default">Here is a definition for our GreatH service.</p><example id="example-initial-service" xml:space="default">
					<head xml:space="default">GreatH Service Definition</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    xmlns="http://www.w3.org/ns/wsdl"
    targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
    xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
    xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
    xmlns:wsoap= "http://www.w3.org/ns/wsdl/soap"
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope"&gt;
  . . .

  &lt;types&gt;
    . . .
  &lt;/types&gt;
  
  &lt;interface  name = "reservationInterface" &gt;
    . . .
  &lt;/interface&gt;

  &lt;binding name="reservationSOAPBinding" 
	  interface="tns:reservationInterface"
        . . . &gt;
    . . .
  &lt;/binding&gt;

  &lt;service name="reservationService" 
       interface="tns:reservationInterface"&gt;

     &lt;endpoint name="reservationEndpoint" 
               binding="tns:reservationSOAPBinding"
               address ="http://greath.example.com/2004/reservation"/&gt;
        
  &lt;/service&gt;
  
&lt;/description&gt;</eg>
				</example><div4 id="example-initial-service-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;service name="reservationService"</code></label><def xml:space="default"><p xml:space="default">This defines a name for this service, which must be unique among service names in the WSDL 2.0 target namespace.   The name attribute is required.  It allows URIs to be created that identify components in WSDL 2.0 description.  (See <emph xml:space="default">WSDL 2.0 Core Language</emph> <bibref ref="WSDL-PART1" xml:space="default"/> appendix C <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-20070626/#wsdl-iri-references" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">IRI References for WSDL 2.0 constructs</xspecref>.)</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">interface="tns:reservationInterface"&gt;</code></label><def xml:space="default"><p xml:space="default">This specifies the name of the previously defined interface that these service endpoints will support.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;endpoint name="reservationEndpoint"</code></label><def xml:space="default"><p xml:space="default">This defines an endpoint for the service, and a name for this endpoint, which must be unique within this service.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">binding="tns:reservationSOAPBinding"</code></label><def xml:space="default"><p xml:space="default">This specifies the name of the previously defined binding to be used by this endpoint.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">address ="http://greath.example.com/2004/reservation"/&gt;</code></label><def xml:space="default"><p xml:space="default">This specifies the physical address at which this service can be accessed using the binding specified by the <att xml:space="default">binding</att> attribute.</p></def></gitem></glist><p xml:space="default">That's it!  Well, almost.  </p></div4></div3>
				
				<div3 id="basics-documentation" xml:space="default"><head xml:space="default">Documenting the Service</head><p xml:space="default">As we have seen, a WSDL 2.0 document is inherently only a <emph xml:space="default">partial</emph> description of a service.  Although it captures the basic mechanics of interacting with the service -- the message types, transmission protocols, service location, etc. -- in general, additional documentation will need to explain other application-level requirements for its use.  For example, such documentation should explain the purpose and use of the service, the meanings of all messages, constraints on their use, and the sequence in which operations should be invoked.</p><p xml:space="default">The <code xml:space="default">documentation</code> element allows the WSDL 2.0 author to include some human-readable documentation inside a WSDL 2.0 document.   It is also a convenient place to reference any additional external documentation that a client developer may need in order to use the service.   It can appear in a number of places in a WSDL 2.0 document (see <specref ref="wsdl-infoset-diagram" xml:space="default"/>), though in this example we have only demonstrated its use at the beginning.</p><example id="example-initial-documentation" xml:space="default">
					<head xml:space="default">Documenting the GreatH Service</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
    . . . &gt;

  &lt;documentation&gt;
    This document describes the GreatH Web service.  Additional 
    application-level requirements for use of this service -- 
    beyond what WSDL 2.0 is able to describe -- are available 
    at http://greath.example.com/2004/reservation-documentation.html
  &lt;/documentation&gt;
  . . .  
&lt;/description&gt;</eg>
				</example>
				
			<div4 id="example-initial-documentation-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;documentation&gt;</code></label><def xml:space="default"><p xml:space="default">  This element is optional, but a good idea to include.    It can contain arbitrary mixed content.  </p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">at http://greath.example.com/2004/reservation-documentation.html</code></label><def xml:space="default"><p xml:space="default">The most important thing to  include is  a pointer to any additional documentation that a client developer would need in order to use the service. </p></def></gitem></glist>
<p xml:space="default">This completes our presentation of the GreatH example.  In the following sections, we will move on to look into more details of various aspects of WSDL 2.0 specification. </p></div4></div3>
</div2>


<!-- ****************WSL2.0 Infoset, Schema and Component Model********************************* -->
<!-- ****************WSL2.0 Infoset, Schema and Component Model********************************* -->
				
<div2 id="wsdl-xml-representation" xml:space="default"><head xml:space="default">WSDL 2.0 Infoset, Schema and Component Model</head>

<p xml:space="default">In computer science theory, a  language consists of a (possibly infinite) set of sentences, and each sentence is a finite string of literal symbols or characters.  A language specification must therefore define the set of sentences in that language,  and, to be useful,  it should also indicate the meaning of each sentence.   Indeed, this is the purpose of the WSDL 2.0 specification.</p><p xml:space="default">However, instead of defining WSDL 2.0 in terms of literal symbols or characters,  to avoid dependency on any particular character encoding, WSDL 2.0  is defined in terms of the <emph xml:space="default">XML Infoset</emph> <bibref ref="XMLInfoSet" xml:space="default"/>.    Specifically, a <emph xml:space="default">WSDL 2.0 document</emph> consists of a <code xml:space="default">description</code> element information item (in the XML Infoset) that conforms to the WSDL 2.0 specification.  In other words, a sentence in the WSDL 2.0 language is a <code xml:space="default">description</code> element information item that obeys the additional constraints spelled out in  the WSDL 2.0 specification.</p><p xml:space="default">Since an XML Infoset can be created from more than one physical document, a WSDL 2.0 document does not necessarily correspond to a single <emph xml:space="default">physical</emph> document: the word "document" is used figuratively, for convenience.  Furthermore, since WSDL 2.0 provides <code xml:space="default">import</code> and <code xml:space="default">include</code> mechanisms, a WSDL 2.0 document may reference other WSDL 2.0 documents to facilitate convenient organization or reuse.   In such cases, the meaning of the including or importing document as a whole will depend (in part) on the meaning of the included or imported document.</p><p xml:space="default">The XML Infoset uses terms like "element information item" and "attribute information item".  Unfortunately, those terms are rather lengthy to repeat often.  Thus, for convenience, this primer often uses the terms "element" and "attribute" instead, as a shorthand.  It should be understood, however, that since WSDL 2.0 is based on the XML Infoset, we really mean "element information item" and "attribute information item", respectively.</p>

<div3 id="wsdl-infoset-diagram" xml:space="default"><head xml:space="default">WSDL 2.0 Infoset</head>

<p xml:space="default">The following diagram gives an overview of  the XML Infoset for a WSDL 2.0 document.

<graphic source="images/WSDL20InfosetModel.png" alt="WSDL 2.0 Infoset Diagram" xml:space="default" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

</p>
</div3>

<div3 id="wsdl-schema" xml:space="default">
<head xml:space="default">WSDL 2.0 Schema</head>

<p xml:space="default">The WSDL 2.0 specification supplies a <xspecref href="http://www.w3.org/ns/wsdl" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">normative WSDL 2.0 schema</xspecref>, defined in <bibref ref="XMLSchemaP1" xml:space="default"/>, which can be used as an aid in validating WSDL 2.0 documents. We say "as an aid" here because WSDL 2.0 specification <bibref ref="WSDL-PART1" xml:space="default"/> often provides further constraints to the WSDL 2.0 schema. In addition to being valid with the normative schema, a WSDL 2.0 document must also follow all the constraints defined by the WSDL 2.0 specification.   
</p>
<div4 id="element-order" xml:space="default"><head xml:space="default">WSDL 2.0 Element Ordering</head>
<p xml:space="default">This section gives an example of how WSDL 2.0 specification constrains the WSDL 2.0 schema about the ordering of top WSDL 2.0 elements.</p>  

<p xml:space="default">Although the WSDL 2.0 schema does not indicate the required ordering of elements, the WSDL 2.0 specification (WSDL 2.0 Part 1 <bibref ref="WSDL-PART1" xml:space="default"/> section "<xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-20070626#Description_XMLRep" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">XML Representation of Description Component</xspecref>") clearly states a set of constraints about how the child elements of the <code xml:space="default">description</code> element should be ordered. Thus, the order of the WSDL 2.0 elements matters, even though the WSDL 2.0 schema does not capture this constraint. </p><p xml:space="default">The following is a pseudo-content model of <code xml:space="default">description</code>.</p>

<eg xml:space="preserve">
&lt;<b>description</b>&gt;
  &lt;documentation /&gt;?
  [ &lt;import /&gt; | &lt;include /&gt; ]*
  &lt;types /&gt;?
  [ &lt;interface /&gt; | &lt;binding /&gt; | &lt;service /&gt; ]*
&lt;/<b>description</b>&gt;
</eg>
          
	<p xml:space="default">
		In other words, the children elements of the
		<code xml:space="default">description</code>
		element should be ordered as follows:
	</p>
	<ulist xml:space="default">
		    <item xml:space="default">
			  <p xml:space="default">
			  An optional <el xml:space="default">documentation</el> comes first, if present.
			  </p>
			</item>

		    <item xml:space="default">
		    	<p xml:space="default">
		    		then comes zero or more elements from among the
		    		following, in any order:
		    	</p>
		    	<ulist xml:space="default">
		    		<item xml:space="default">
		    			<p xml:space="default">
		    				<el xml:space="default">include</el>
		    			</p>
		    		</item>
		    		<item xml:space="default">
		    			<p xml:space="default">
		    				<el xml:space="default">import</el>
		    			</p>
		    		</item>
		    		<item xml:space="default">
		    			<p xml:space="default">extensions</p>
		    		</item>
		    	</ulist>
		    </item>

		    <item xml:space="default">
			  <p xml:space="default">
			  An optional <el xml:space="default">types</el> follows
			  </p>
			</item>

		    <item xml:space="default">
		    	<p xml:space="default">
		    		Zero or more elements from among the following, in
		    		any order:
		    	</p>
		    	<ulist xml:space="default">
		    		<item xml:space="default">
		    			<p xml:space="default">
		    				<el xml:space="default">interface</el>
		    			</p>
		    		</item>
		    		<item xml:space="default">
		    			<p xml:space="default">
		    				<el xml:space="default">binding</el>
		    			</p>
		    		</item>
		    		<item xml:space="default">
		    			<p xml:space="default">
		    				<el xml:space="default">service</el>
		    			</p>
		    		</item>
		    		<item xml:space="default">
		    			<p xml:space="default">extensions.</p>
		    		</item>
		    	</ulist>

		    </item>

	  </ulist>

<p xml:space="default">Note the term "extension" is used above as a convenient way to refer to namespace-qualified extension elements. The namespace name of such extension elements must not be<attval xml:space="default">http://www.w3.org/ns/wsdl</attval>.
</p>
</div4>
</div3>

<div3 id="component-model" xml:space="default"><head xml:space="default">WSDL 2.0 Component Model</head>
<p xml:space="default">The WSDL 2.0 Infoset model above illustrates the required structure of a WSDL 2.0 document, using the XML Infoset.  However, the WSDL 2.0 language also imposes many semantic constraints over and above structural conformance to this XML Infoset. In order to precisely describe these constraints, and as  an aid in precisely defining the meaning of each WSDL 2.0 document, the WSDL 2.0 specification defines a <emph xml:space="default">component model</emph>  as an additional layer of abstraction above the XML Infoset.  Constraints and meaning are defined in terms of this component model, and the definition of each component includes a mapping that specifies how values in the component model are derived from corresponding items in the XML Infoset.   The following diagram gives an overview of  the WSDL 2.0 components and their containment hierarchy.

 <graphic source="images/WSDL20Components.png" alt="WSDL 2.0 Components Containment hierarchy" xml:space="default" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></p>


<p xml:space="default">In general, the WSDL 2.0 component model parallels the structure of the required XML Infoset illustrated above.  For example, the <emph xml:space="default">Description</emph>, <emph xml:space="default">Interface</emph>, <emph xml:space="default">Binding</emph>, <emph xml:space="default">Service</emph> and <emph xml:space="default">Endpoint</emph>  <emph xml:space="default">components</emph> correspond to the <code xml:space="default">description</code>, <code xml:space="default">interface</code>, <code xml:space="default">binding</code>,  <code xml:space="default">service</code>, and <code xml:space="default">endpoint</code> element information items, respectively.   Since WSDL 2.0 relies heavily on the component model to convey the meaning of the constructs in the WSDL 2.0 language, you can think of the Description component as representing the meaning of the <code xml:space="default">description</code> element information item, and hence, it represents the meaning of the WSDL 2.0 document as a whole.  </p>

<p xml:space="default">Furthermore, each of these components has <emph xml:space="default">properties</emph>  whose values are (usually) derived from the element and attribute information item children of those element information items.  For example, the Service component corresponds to the <code xml:space="default">service</code> element information item, so the Service component has an {endpoints} property whose value is a set of Endpoint components corresponding to the <code xml:space="default">endpoint</code> element information item children of that <code xml:space="default">service</code> element information item. (Whew!)</p>
<div4 id="import-component" xml:space="default"><head xml:space="default">WSDL 2.0 Import and Include</head>
	<p xml:space="default">
		The WSDL 2.0 component model is particularly helpful in defining
		the meaning of 	<el xml:space="default">import</el> and <el xml:space="default">include</el> elements.   The
		<el xml:space="default">include</el>
		element allows you to assemble the contents of a given WSDL 2.0
		namespace from several WSDL 2.0 documents that define components
		for that namespace. The components defined by a given WSDL 2.0
		document consist of those whose definitions are contained in the
		document and those that are defined by any WSDL 2.0 documents
		that are included in it via the
		<el xml:space="default">include</el>
		element. The effect of the
		<el xml:space="default">include</el>
		element is cumulative so that if document A includes document B
		and document B includes document C, then the components defined
		by document A consist of those whose definitions are contained
		in documents A, B, and C.
	</p>
	<p xml:space="default">
		In contrast, the
		<el xml:space="default">import</el>
		element does not define any components. Instead, the
		<el xml:space="default">import</el>
		element declares that the components whose definitions are
		contained in a WSDL 2.0 document for a given WSDL 2.0 namespace
		refer to components that belong to a different WSDL 2.0
		namespace. If a WSDL 2.0 document contains definitions of
		components that refer to other namespaces, then those namespaces
		must be declared via an
		<el xml:space="default">import</el>
		element. The
		<el xml:space="default">import</el>
		element also has an optional
		<att xml:space="default">location</att>
		attribute that is a hint to the processor where the definitions
		of the imported namespace can be found. However, the processor
		may find the definitions by other means, for example, by using a
		catalog.
	</p>
	
	<p xml:space="default">
		After processing any
		<el xml:space="default">include</el>
		elements and locating the components that belong to any imported
		namespaces, the WSDL 2.0 component model for a WSDL 2.0 document
		will contain a set of components that belong to the document's
		WSDL 2.0 namespace and any imported namespaces. These components
		will refer to each other, usually via QName references. A WSDL
		2.0 document is invalid if any component reference cannot be
		resolved, whether or not the referenced component belongs to the
		same or a different namespace.
	</p>
	<p xml:space="default">We will cover a lot more about how to use WSDL 2.0 import and include in <specref ref="adv-import-and-authoring" xml:space="default"/></p>
	</div4>
</div3></div2>



<!-- ******************MessageTypes********************************** -->
<!-- ******************MessageTypes********************************** -->


<div2 id="more-types" xml:space="default"><head xml:space="default">More on Message Types</head>

		<p xml:space="default">Message types may be defined in various schema languages. In this primer, we will only focus on the use of XML Schema <bibref ref="XMLSchemaP1" xml:space="default"/> since it's natively supported by WSDL 2.0. Message types defined in other languages may be introduced into a WSDL 2.0 <code xml:space="default">description</code> via extensions, see the W3C notes <bibref ref="altschemalangs" xml:space="default"/> for more details. </p>

			<p xml:space="default">The following is the XML syntax for the <code xml:space="default">wsdl:types</code> element:</p>
			
<eg xml:space="preserve">&lt;description&gt;
  &lt;<b>types</b>&gt;
    &lt;documentation /&gt;*
    [ &lt;xs:import namespace="<emph xml:space="default">xs:anyURI</emph>" schemaLocation="<emph xml:space="default">xs:anyURI</emph>"? /&gt; |
      &lt;xs:schema targetNamespace="<emph xml:space="default">xs:anyURI</emph>" /&gt; |
      <emph xml:space="default">other extension elements</emph> ]*
  &lt;/<b>types</b>&gt;
&lt;/description&gt;
</eg>
					
<p xml:space="default">There are two ways to make XML Schema message definitions visible, or in other words, available for reference by QName (see WSDL 2.0 Part 1 <bibref ref="WSDL-PART1" xml:space="default"/> "<xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-20070626#qnameres" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">QName Resolution</xspecref>") in a WSDL 2.0 document: inlining or importing.  Inlining is to put the schema definitions directly within an <code xml:space="default">xs:schema</code> element under <code xml:space="default">types</code>.  Importing is to have the schema defined in a separate document and then bring it into the WSDL definition by using <code xml:space="default">xs:import</code> directly under <code xml:space="default">types</code>. </p> 

<p xml:space="default">In the following sections, we will provide examples for the different mechanisms.</p>			 

			<div3 id="more-types-schema-inline" xml:space="default">
				<head xml:space="default">Inlining XML Schema</head>
				<p xml:space="default">We have already seen an example of using inlined schema definitions in section <specref ref="basics-types" xml:space="default"/>. When XML Schema is inlined directly in a WSDL 2.0 document, it uses the existing top-level <code xml:space="default">xs:schema</code> element defined by XML Schema to do so, as though a schema file had been copied and pasted into the <code xml:space="default">types</code> element. The schema components defined in the inlined schema are then available to the containing WSDL 2.0 <code xml:space="default">description</code> for reference by QName. For instance, in <specref ref="example-initial" xml:space="default"/>, the input message of the interface operation "opCheckAvailability" is defined by the "ghns:checkAvailability" element in the inlined schema. </p>
				
									
			</div3>
			
			<div3 id="more-types-schema-import" xml:space="default">
				<head xml:space="default">Importing XML Schema</head>
				
<p xml:space="default">XML Schema components can be defined in separate schema files and be made available to a WSDL2.0 <code xml:space="default">description</code> by using <code xml:space="default">xs:import</code> directly under <code xml:space="default">types</code>. </p>

				<p xml:space="default">	There are many cases where one would prefer having schema definitions in separate schema files. One reason is the reusability of the schema definitions. Inlined schema definitions are only available to the containing WSDL 2.0 <code xml:space="default">description</code>. Although WSDL 2.0 provides a <code xml:space="default">wsdl:import</code> mechanism for importing other WSDL files, schema definitions inlined in an imported WSDL document are NOT automatically made available to the importing WSDL 2.0 document, even though other WSDL 2.0 components (such as Interfaces, Bindings, etc.) do become available.   Therefore, if one wishes to share schema definitions across several WSDL 2.0 <code xml:space="default">description</code>s, these schema definitions should instead be placed in separate XML Schema documents and imported into each WSDL 2.0 <code xml:space="default">description</code> using <code xml:space="default">xs:import</code> directly under <code xml:space="default">types</code>.</p>

				<p xml:space="default">Let's see an example. Assuming the message types in <specref ref="example-initial-types" xml:space="default"/> are defined in a separate schema file named "http://greath.example.com/2004/schemas/resSvc.xsd" with a target namespace "http://greath.example.com/2004/schemas/resSvc",  the schema definition can then be brought into the WSDL 2.0 <code xml:space="default">description</code> using <code xml:space="default">xs:import</code>. Note that only components in the imported namespace "http://greath.example.com/2004/schemas/resSvc" are available for reference in the WSDL 2.0 document.   </p>
				
				<example id="example-schema-import" xml:space="default">
					<head xml:space="default"> <code xml:space="default">xs:import</code>ed Message Definitions that Are Visible to the Containing WSDL 2.0 Description</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description xmlns="http://www.w3.org/ns/wsdl"
targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
. . . &gt;
. . .

&lt;types&gt;
	&lt;xs:import namespace="http://greath.example.com/2004/schemas/resSvc" 
		schemaLocation= "http://greath.example.com/2004/schemas/resSvc.xsd"/&gt;  
&lt;/types&gt;

. . .
&lt;/description&gt;</eg>
				</example>


<p xml:space="default">It's important to note that <code xml:space="default">xs:import</code> used directly under <code xml:space="default">wsdl:types</code> has been given a different visibility than <code xml:space="default">xs:import</code> used inside an inlined schema. An inlined schema may use native XML schema <code xml:space="default">xs:import</code> to bring in external schema definitions that are in different namespaces; However, though this is the schema importing mechanism recommended for WSDL 1.1 in <xspecref href="http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#WSDL_and_Schema_Import" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">WS-I Basic Profile</xspecref>, according to XML Schema specification, such enclosed message definitions are only visible to the importing schema (in this case, the inlined schema). They are not visible to the containing WSDL 2.0 <code xml:space="default">description</code>. </p> 

				<p xml:space="default">If we change <specref ref="example-schema-import" xml:space="default"/> to use XML Schema's native <code xml:space="default">xs:import</code> element in an inlined schema, the schema components defined in the namespace http://greath.example.com/2004/schemas/resSvc are not available to our example WSDL 2.0 definition any more. </p>
				
				<example id="example-schema-import1" xml:space="default">
					<head xml:space="default"><code xml:space="default">xs:import</code>ed Message Definitions in Inlined Schema Are Not Visible to the Containing WSDL 2.0 Description</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description xmlns="http://www.w3.org/ns/wsdl"
targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
. . . &gt;
. . .

&lt;types&gt;
	&lt;xs:schema targetNamespace="http://greath.example.com/2004/schemas/resSvcWrapper"&gt;
		&lt;xs:import namespace="http://greath.example.com/2004/schemas/resSvc" 
		schemaLocation= "http://greath.example.com/2004/schemas/resSvc.xsd"/&gt;  
	&lt;/xs:schema&gt;
&lt;/types&gt;

. . .
&lt;/description&gt;</eg>
				</example>


<p xml:space="default">Of course, an inlined XML schema may also use XML Schema's native <code xml:space="default">xs:include</code> element to refer to schemas defined in separate files when the included schema has no namespace or has the same namespace as the including schema. In this case, according to XML Schema, the included schema components become a part of the including schema as though they had been copied and pasted into the including schema. Hence, the included schema components are also available to the containing WSDL 2.0 <code xml:space="default">description</code> for reference by QName. </p>	

<p xml:space="default">The following example has the same effect as <specref ref="example-initial-types" xml:space="default"/>:</p>
			
				<example id="example-schema-import2" xml:space="default">
					<head xml:space="default"><code xml:space="default">xs:included</code> Message Definitions in Inlined Schema Are Visible to the Containing WSDL 2.0 Description</head>
					<eg xml:space="default">&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description xmlns="http://www.w3.org/ns/wsdl"
targetNamespace= "http://greath.example.com/2004/wsdl/resSvc" 
xmlns:tns= "http://greath.example.com/2004/wsdl/resSvc"
xmlns:ghns = "http://greath.example.com/2004/schemas/resSvc"
. . . &gt;
. . .

&lt;types&gt;
	&lt;xs:schema targetNamespace="http://greath.example.com/2004/schemas/resSvc"&gt;
		&lt;xs:include schemaLocation= "http://greath.example.com/2004/schemas/resSvc.xsd"/&gt;  
	&lt;/xs:schema&gt;
&lt;/types&gt;

. . .
&lt;/description&gt;</eg>
				</example>
				
			</div3>
			
			
			
		<div3 id="more-types-import-include-summary" xml:space="default"><head xml:space="default">Summary of Import and Include Mechanisms</head>

				
<p xml:space="default">So far we have briefly covered both WSDL import and include and schema import and include.  The following table summarizes the similarities and differences
between the WSDL 2.0 and XML Schema
<el xml:space="default">include</el> and <el xml:space="default">import</el> mechanisms. We will talk a lot more about importing mechanisms in <specref ref="adv-import-and-authoring" xml:space="default"/> and <specref ref="adv-multiple-inline-schemas" xml:space="default"/></p>
			<table border="1" id="imin" xml:space="default">
				<caption xml:space="default">
					Summary of Import and Include Mechanisms
				</caption>
				<thead xml:space="default">
					<tr xml:space="default">
						<th xml:space="default" rowspan="1" colspan="1">Mechanism</th>
						<th xml:space="default" rowspan="1" colspan="1">Object</th>
						<th xml:space="default" rowspan="1" colspan="1">Meaning</th>
						<th xml:space="default" rowspan="1" colspan="1">Visibility of Schema Components</th>
					</tr>
				</thead>
				<tbody xml:space="default">
					<tr xml:space="default">
						<td xml:space="default" rowspan="1" colspan="1">wsdl:import</td>
						<td xml:space="default" rowspan="1" colspan="1">WSDL 2.0 Namespace</td>
						<td xml:space="default" rowspan="1" colspan="1">
							Declare that WSDL 2.0 components
							refer to WSDL 2.0 components 
							from a DIFFERENT targetNamespace.
						</td>
			<td xml:space="default" rowspan="1" colspan="1">
			XML Schema Components in the imported <comp>Description</comp>
			component are NOT visible to the containing <code xml:space="default">description</code>.
			</td>
						
					</tr>
					<tr xml:space="default">
						<td xml:space="default" rowspan="1" colspan="1">wsdl:include</td>
						<td xml:space="default" rowspan="1" colspan="1">WSDL 2.0 Document</td>
						<td xml:space="default" rowspan="1" colspan="1">
							Merge Interface, Binding and Service
							components from another WSDL 2.0 document
							that has the SAME targetNamespace. 
						</td>
			<td xml:space="default" rowspan="1" colspan="1">
			XML Schema components in the included <comp>Description</comp> component's
			<prop comp="Description">element declarations</prop> and 
			<prop comp="Description">type definitions</prop> properties are visible to the containing <code xml:space="default">description</code>.
			</td>
					</tr>
					<tr xml:space="default">
						<td xml:space="default" rowspan="1" colspan="1">wsdl:types/ xs:import</td>
						<td xml:space="default" rowspan="1" colspan="1">XML Schema Namespace</td>
						<td xml:space="default" rowspan="1" colspan="1">
							Declare that XML Schema components
							refer to XML Schema components
							from a DIFFERENT targetNamespace.
						</td>

			<td xml:space="default" rowspan="1" colspan="1">
			XML Schema components in the imported namespace are visible to the containing <code xml:space="default">description</code>.
			</td>
					</tr>
					<tr xml:space="default">
						<td xml:space="default" rowspan="1" colspan="1">wsdl:types/ xs:schema/xs:import</td>
						<td xml:space="default" rowspan="1" colspan="1">XML Schema Namespace</td>
						<td xml:space="default" rowspan="1" colspan="1">
							Declare that XML Schema components
							refer to XML Schema components
							from a DIFFERENT targetNamespace.
						</td>

			<td xml:space="default" rowspan="1" colspan="1">
			XML Schema components in the imported namespace are NOT visible to the containing <code xml:space="default">description</code>.
			</td>
					</tr>
					<tr xml:space="default">
						<td xml:space="default" rowspan="1" colspan="1">wsdl:types/ xs:schema/xs:include</td>
						<td xml:space="default" rowspan="1" colspan="1">XML Schema Document</td>
						<td xml:space="default" rowspan="1" colspan="1">
							Merge XML Schema components from
							another XML Schema document that has the
							SAME or NO targetNamespace.
						</td>
			<td xml:space="default" rowspan="1" colspan="1">
			XML Schema components in the
			included document are visible to the containing <code xml:space="default">description</code>.
			</td>
					</tr>
				</tbody>
			</table>
		
		</div3>

		
</div2>


			
<!-- ******************Interface********************************** -->
<!-- ******************Interface********************************** -->
<div2 id="more-interfaces" xml:space="default">
			<head xml:space="default">More on Interfaces</head>
			
			<!-- ************************interface*************************** -->
			<p xml:space="default">We previously mentioned that a WSDL 2.0 interface is basically a set of operations. However, there are some additional capabilities that we have not yet covered.  First, let's review the syntax for the <code xml:space="default">interface</code> element. </p>
			<div3 id="more-interfaces-interfaces" xml:space="default">
				<head xml:space="default">Interface Syntax </head>
				
				
				<p xml:space="default">Below is the XML syntax summary of the <code xml:space="default">interface</code> element, simplified by omitting optional  <code xml:space="default">&lt;documentation&gt;</code> elements:</p>
				<eg xml:space="preserve">
&lt;description targetNamespace="<emph xml:space="default">xs:anyURI</emph>" &gt;

  . . .
  &lt;interface name="<emph xml:space="default">xs:NCName</emph>" 
          extends="<emph xml:space="default">list of xs:QName</emph>"? 
          styleDefault="<emph xml:space="default">list of xs:anyURI</emph>"? &gt;

    &lt;fault name="<emph xml:space="default">xs:NCName</emph>" 
            element="<emph xml:space="default">xs:QName</emph>"? &gt;
    &lt;/fault&gt;*

    &lt;operation name="<emph xml:space="default">xs:NCName</emph>" 
            pattern="<emph xml:space="default">xs:anyURI</emph>" 
            style="<emph xml:space="default">list of xs:anyURI</emph>"? 
            wsdlx:safe="<emph xml:space="default">xs:boolean</emph>"? &gt;

      &lt;input messageLabel="<emph xml:space="default">xs:NCName</emph>"? 
            element="<emph xml:space="default">union of xs:QName, xs:Token</emph>"? &gt;
      &lt;/input&gt;*

      &lt;output messageLabel="<emph xml:space="default">xs:NCName</emph>"? 
            element="<emph xml:space="default">union of xs:QName, xs:Token</emph>"? &gt;
      &lt;/output&gt;*

      &lt;infault ref="<emph xml:space="default">xs:QName</emph>" messageLabel="<emph xml:space="default">xs:NCName</emph>"? &gt; &lt;/infault&gt;*

      &lt;outfault ref="<emph xml:space="default">xs:QName</emph>" messageLabel="<emph xml:space="default">xs:NCName</emph>"? &gt; &lt;/outfault&gt;*

    &lt;/operation&gt;*

  &lt;/interface&gt;*
  . . .

&lt;/description&gt;
  
</eg>
				
				<p xml:space="default">The <code xml:space="default">interface</code> element has two optional attributes:  <att xml:space="default">styleDefault</att> and  <att xml:space="default">extends</att>.  The <att xml:space="default">styleDefault</att>  attribute can be used to define a default value for the <att xml:space="default">style</att> attributes of all operations under this interface (see WSDL 2.0 Part 1 "<xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-20070626#Interface_styleDefault_attribute" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">styleDefault attribute information item</xspecref>").  The <att xml:space="default">extends</att>  attribute is for inheritance, and is explained next.   </p>
				
			</div3>
	<div3 id="more-interfaces-inheritance" xml:space="default">
				<head xml:space="default">Interface Inheritance</head>
				<p xml:space="default">
					The optional
					<att xml:space="default">extends</att>
					attribute allows an interface to extend or inherit
					from one or more other interfaces. In such cases the
					interface contains the operations of the interfaces
					it extends, along with any operations it defines
					directly. Two things about extending interfaces
					deserve some attention.
				</p>
				<p xml:space="default">
					First, an inheritance loop (or infinite recursion)
					is prohibited: the interfaces that a given interface
					extends must NOT themselves extend that interface
					either directly or indirectly.
				</p>
				<p xml:space="default">
					Second, we must explain what happens when operations
					from two different interfaces have the same target
					namespace and operation name. There are two cases:
					either the component models of the operations are
					the same, or they are different. If the component
					models are the same (per the component comparison
					algorithm defined in WSDL 2.0 Part 1
					<bibref ref="WSDL-PART1" xml:space="default"/>
					"
					<xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-20070626#compequiv" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">
						Equivalence of Components
					</xspecref>
					") then they are considered to be the same
					operation, i.e., they are collapsed into a single
					operation, and the fact that they were included more
					than once is not considered an error. (For
					operations, component equivalence basically means
					that the two operations have the same set of
					attributes and descendants.) In the second case, if
					two operations have the same name in the same WSDL
					2.0 target namespace but are not equivalent, then it
					is an error. For the above reason, it is considered
					good practice to ensure that all operations within
					the same target namespace are named uniquely.
				</p>
				<p xml:space="default">
					Finally, since faults can
					also be defined as children of the
					<code xml:space="default">interface</code>
					element (as described in the following sections),
					the same name-collision rules apply to those
					constructs.
				</p>

				<p xml:space="default">Let's say the GreatH hotel wants to maintain a standard message log operation for all received messages. It wants this operation to be reusable across the whole reservation system, so each service will send out,  for potential use of a logging service, 
the content of each message it receives together with a timestamp and the originator of the message. One way to meet such requirement is to define the log operation in an interface which can be inherited by other interfaces. Assuming a <code xml:space="default">messageLog</code> element is already defined in the ghns namespace with the required content, the inheritance use case is illustrated in the following example. As a result of the inheritance, the <code xml:space="default">reservationInterface</code> now contains two operations: <code xml:space="default">opCheckAvailability</code> and <code xml:space="default">opLogMessage</code></p>

<example id="example-faults" xml:space="default">
					<head xml:space="default">Interface Inheritance</head>
				<eg xml:space="preserve">
					
&lt;description ...&gt;
	...
	&lt;interface  name = "messageLogInterface" &gt;
				
		&lt;operation name="opLogMessage" 
				pattern="http://www.w3.org/ns/wsdl/out-only"&gt;
			&lt;output messageLabel="out" 
				element="ghns:messageLog" /&gt;
		&lt;/operation&gt;

	&lt;/interface&gt;

	&lt;interface  name="reservationInterface" <b>extends</b>="tns:messageLogInterface" &gt;
   
		&lt;operation name="opCheckAvailability" 
				pattern="http://www.w3.org/ns/wsdl/in-out"
				style="http://www.w3.org/ns/wsdl/style/iri"
				wsdlx:safe = "true"&gt;
			&lt;input messageLabel="In" 
				element="ghns:checkAvailability" /&gt;
			&lt;output messageLabel="Out" 
				element="ghns:checkAvailabilityResponse" /&gt;
			&lt;outfault ref="tns:invalidDataFault" messageLabel="Out"/&gt;

		&lt;/operation&gt;
	&lt;/interface&gt;
	...
&lt;/description&gt;</eg>
				</example>	
							
				<p xml:space="default">Now let's have a look at the element children of <code xml:space="default">interface</code>, beginning with <code xml:space="default">fault</code>. </p>		

			</div3>
			<div3 id="more-interfaces-faults" xml:space="default">
				<head xml:space="default">Interface Faults</head>
				<p xml:space="default">The <code xml:space="default">fault</code> element is used to declare faults that may occur during execution of operations of an interface.  They are declared directly under <code xml:space="default">interface</code>, and referenced from operations where they apply, in order to permit reuse across  multiple operations. </p>
				<p xml:space="default">Faults are very similar to messages and can be viewed as a special kind of 
message. Both faults and messages may carry a payload that is normally described 
by an element declaration. However, WSDL 2.0 treats faults and messages slightly 
differently. The messages of an operation directly refer to their element 
declaration, however the faults of an operation indirectly refer to their 
element declaration via a fault element that is defined on the interface. </p>

<p xml:space="default">The reason for defining faults at 
the interface level is to allow their reuse across multiple operations. This 
design is especially beneficial when bindings are defined, since in binding extensions like 
SOAP there is additional information that is associated with faults. In the case 
of SOAP, faults have codes and subcodes in addition to a payload. By defining 
faults at the interface level, common codes and subcodes can be associated with 
them, thereby ensuring consistency across all operations that use the faults </p>

				<p xml:space="default">
					The
					<el xml:space="default">fault</el>
					element has a required
					<att xml:space="default">name</att>
					attribute that must be unique within the parent <el xml:space="default">interface</el> element, and permits it to be
					referenced from operation declarations. The optional
					<att xml:space="default">element</att>
					attribute can be used to indicate a schema for the
					content or payload of the fault message. Its value
					should be the QName of a global element defined in
					the
					<code xml:space="default">types</code>
					section. Please note that when other type systems
					are used to define the schema for a fault message,
					additional attributes may need to be defined via
					WSDL 2.0's attribute extension mechanism to allow
					the schema to be associated with the fault.
				</p>


			</div3>
			<div3 id="more-interfaces-operations" xml:space="default">
				<head xml:space="default">Interface Operations</head>
				<p xml:space="default">As shown earlier, the <code xml:space="default">operation</code> element is used to indicate an operation supported by the containing interface.  It associates message schemas with a message exchange pattern (MEP), in order to abstractly describe a simple interaction with a Web service.   </p>
				
				
				
			<div4 id="more-interfaces-op-attr" xml:space="default"><head xml:space="default">Operation Attributes</head><p xml:space="default">An <code xml:space="default">operation</code> has two required attributes and one optional attribute:</p>
				<ulist xml:space="default">
					<item xml:space="default">
						<p xml:space="default">A required <att xml:space="default">name</att> attribute, as seen already, which must be unique within the interface.</p>
						
					</item>
					<item xml:space="default">
						<p xml:space="default">A required <att xml:space="default">pattern</att> attribute whose value must be an absolute URI that identifies the desired MEP for the  <code xml:space="default">operation</code>.  MEPs are further explained  in  <specref ref="more-interfaces-meps" xml:space="default"/>.</p>
						
					</item>
					<item xml:space="default">
						<p xml:space="default">An optional <att xml:space="default">style</att> attribute whose value is a list of absolute URIs.  Each URI identifies a certain set of rules that were followed in defining this  <code xml:space="default">operation</code>.   It is an error if a particular style is indicated, but the associated rules are not followed.  <bibref ref="WSDL-PART2" xml:space="default"/>  defines a set of styles, including</p>  
				<ulist xml:space="default">
					<item xml:space="default"><p xml:space="default">RPC Style. The RPC style is selected when the <att xml:space="default">style</att> is assigned the value http://www.w3.org/ns/wsdl/rpc. It places restrictions for Remote Procedure Call-types of interactions. </p></item>
					<item xml:space="default"><p xml:space="default">IRI Style. The IRI style is selected when the <att xml:space="default">style</att> is assigned the value http://www.w3.org/ns/wsdl/style/iri. It places restrictions on message definitions so they may be serialized into something like HTTP URL encoded.</p></item>
					<item xml:space="default"><p xml:space="default">The Multipart style. The Multipart style is selected when the <att xml:space="default">style</att> is assigned the value http://www.w3.org/ns/wsdl/style/multipart. In the HTTP binding, for XForms clients, a message must be defined following the Multipart style and serialized as "Multipart/form-data". </p> </item>
				</ulist>	
						
						 <p xml:space="default">You can find more details of these WSDL 2.0 predefined styles. Section <specref ref="adv-RPCstyle" xml:space="default"/> provides an example of using the RPC <code xml:space="default">style</code>. <bibref ref="WSDL-PART2" xml:space="default"/> provides examples for the IRI style and Multipart style. </p>
											
						
					</item>					
					
				</ulist>
						<p xml:space="default">Note that <bibref ref="WSDL-PART2" xml:space="default"/> provides a predefined extension for indicating operation safety.  The <att xml:space="default">wsdlx:safe</att> global attribute whose value is a boolean can be used with an operation to indicate whether the operation is asserted to be "safe" (as defined in Section 3.5 of the Web Architecture <bibref ref="webarch" xml:space="default"/>)  for clients to invoke. In essence, a safe operation is any operation that does not give the client any new obligations.  For example, an operation that permits the client to check prices on products typically would not obligate the client to buy those products, and thus would be safe, whereas an operation for purchasing products would obligate the client to pay for the products that were ordered, and thus would not be safe.   </p><p xml:space="default">An operation should be marked safe (by using the <att xml:space="default">wsdlx:safe</att> and by setting its value to "true") if it meets the criteria for a safe interaction defined in Section 3.5 of  the Web Architecture <bibref ref="webarch" xml:space="default"/>, because this permits the infrastructure to perform efficiency optimizations, such as pre-fetch, re-fetch and caching. </p><p xml:space="default">The default value of this attribute is false. If it is false or is not set, then no assertion is made about the safety of the operation; thus the operation may or may not be safe.</p>
				
				</div4><div4 xml:space="default"><head xml:space="default">Operation Message References</head><p xml:space="default">An <code xml:space="default">operation</code> will also have <code xml:space="default">input</code>, <code xml:space="default">output</code>,<code xml:space="default">infault</code>, and/or <code xml:space="default">outfault</code> element children that specify the ordinary and fault message types to be used by that operation.  The MEP specified by the <code xml:space="default">pattern</code> attribute determines which of these  elements should be included, since each MEP has placeholders for the message types involved in its pattern.     </p><p xml:space="default">Since operations were already discussed in <specref ref="basics-interface" xml:space="default"/>, this section will merely comment on additional capabilities that were not previously explained.</p>
				<div5 xml:space="default">
					<head xml:space="default">The messageLabel Attribute</head>
					<p xml:space="default">
						The
						<att xml:space="default">messageLabel</att>
						attribute of the
						<code xml:space="default">input</code>
						and
						<code xml:space="default">output</code>
						elements is optional. It is not necessary to
						explicitly set the
						<code xml:space="default">messageLabel</code>
						when the MEP in use is one of the eight MEPs
						predefined in WSDL 2.0 Part 2
						<bibref ref="WSDL-PART2" xml:space="default"/>
						and it has only one message with a given
						direction.
					</p>
				</div5>
				<div5 xml:space="default">
					<head xml:space="default">The element Attribute</head>
					<p xml:space="default">
						The
						<att xml:space="default">element</att>
						attribute of the
						<code xml:space="default">input</code>
						and
						<code xml:space="default">output</code>
						elements is used to specify the message content
						schema (aka payload schema) when the content
						model is defined using XML Schema. As we have
						seen already, it can specify the QName of an
						element schema that was defined in the
						<code xml:space="default">types</code>
						section. However, alternatively it can specify
						one of the following tokens:
						<glist xml:space="default">
							<gitem xml:space="default">
								<label xml:space="default">
									<code xml:space="default">#any</code>
								</label>
								<def xml:space="default">
									<p xml:space="default">
										The message content is any
										single element.
									</p>
								</def>
							</gitem>
							<gitem xml:space="default">
								<label xml:space="default">
									<code xml:space="default">#none</code>
								</label>
								<def xml:space="default">
									<p xml:space="default">
										There is no message content,
										i.e., the message payload is
										empty.
									</p>
								</def>
							</gitem>
							<gitem xml:space="default">
								<label xml:space="default">
									<code xml:space="default">#other</code>
								</label>
								<def xml:space="default">
									<p xml:space="default">
										The message content is described by a non-XML type system.
										Extension attributes specify the type.
									</p>
								</def>
							</gitem>
						</glist>
						The
						<code xml:space="default">element</code>
						attribute is also optional. If it is not specified, then the message content is described by a non-XML type system.
					</p>
					<p xml:space="default">Note that there are situations that the information conveyed in the <code xml:space="default">element</code> attribute is not sufficient for a service implementation to uniquely identify an incoming message and  dispatch it to an appropriate operation. In such situations, additional means may be required to aid identifying an incoming message. See <specref ref="adv-message-dispatch" xml:space="default"/> for more detail.   
					
</p>
				</div5>
				<div5 xml:space="default"><head xml:space="default">Multiple infault or outfault Elements</head><p xml:space="default">When <code xml:space="default">infault</code> and/or <code xml:space="default">outfault</code> occur multiple times within an <code xml:space="default">operation</code>, they define alternative fault messages. </p></div5></div4>
			
			<!-- ************************MEPs*************************** -->
			<div4 id="more-interfaces-meps" xml:space="default">
				<head xml:space="default">Understanding Message Exchange Patterns (MEPs)</head>
				<p xml:space="default">WSDL 2.0 message exchange patterns (MEPs) are used to define the sequence and cardinality of the abstract messages in  an operation. By design, WSDL 2.0 MEPs are abstract. First of all, they abstract out specific message types. MEPs identify placeholders for messages, and placeholders are associated with specific message types when an operation is defined, which includes specifying which MEP to use for that operation. Secondly, unless explicitly stated otherwise, MEPs also abstract out binding-specific information like timing between messages, whether the pattern is synchronous or asynchronous, and whether the messages are sent over a single or multiple channels.</p>
				<p xml:space="default">It's worth pointing out that WSDL 2.0 MEPs do not exhaustively describe the set of messages that may be exchanged between a service and other nodes.  By some prior agreement, another node and/or the service may send other messages (to each other or to other nodes) that are not described by the 
MEP. For instance, even though an MEP may define a single message sent 
from a service to one other node, a service defined by that MEP may multicast that message to 
other nodes. To maximize reuse, WSDL 2.0 message exchange patterns identify a minimal contract between other parties and Web Services, and contain only information that is relevant to both the Web service and the client that engages that service.</p>
				<p xml:space="default">A total of eight MEPs are defined in <bibref ref="WSDL-PART2" xml:space="default"/>. These MEPs should cover the most common use cases, but they are not meant to be an exhaustive list of MEPs that can ever be used by operations. More MEPs can be defined for particular application needs by interested parties.  (See <specref ref="more-interfaces-meps" xml:space="default"/> )</p>
				<p xml:space="default">For the eight MEPs defined by WSDL 2.0, some of them are variations of others based on how faults may be generated. For example, the In-Only pattern ("http://www.w3.org/ns/wsdl/in-only") consists of exactly one message received by a service from some other node. No fault can be generated. As a variation of In-Only, Robust In-Only pattern ("http://www.w3.org/ns/wsdl/robust-in-only") also consists of exactly one message received by a service, but in this case faults can be triggered by the message and must be delivered to the originator of the message. If there is no path to this node, the fault must be discarded. For details about the common fault generation models used by the eight WSDL 2.0 MEPs, see <bibref ref="WSDL-PART2" xml:space="default"/>. </p>
				
				<p xml:space="default">Depending on how the first message in the MEP is initiated, the eight WSDL 2.0 MEPs may be grouped into two groups: in-bound MEPs, for which the service receives the first message in the exchange, and out-bound MEPs, for which the service sends out the first message in the exchange. (Such grouping is not provided in the WSDL 2.0 specification and is presented here only for the purpose of easy reference in this primer).</p> 
				
				<p xml:space="default"> A frequently asked question about out-bound MEPs is how a service knows where to send the message. Services using out-bound MEPs are typically part of large scale integration systems that rely on mapping and routing facilities. In such systems, out-bound MEPs are useful for specifying the functionality of a service abstractly, including its requirements for potential customers, while endpoint address information can be provided at deployment or runtime by the underlying integration infrastructure. For example, the GreatH hotel reservation system may require that every time a customer interacts with the system to check availability, data about the customer must be logged by a CRM system. At design time, it's unknown which particular CRM system would be used together with the reservation system.  To address this requirement, we may change the "reservationInterface" in <specref ref="example-initial" xml:space="default"/> to include an out-bound logInquiry operation. This <code xml:space="default">logInquiry</code> operation advertises to potential service clients that customer data will be made available by the reservation service at run time. When the reservation service is deployed to GreatH's IT landscape, appropriate configuration time and run time infrastructure will help determine which CRM system will get the customer data and log it appropriately. It's worth noting that in addition to being used by a CRM system for customer management purpose, the same data may also be used by a system performance analysis tool for different purpose. Providing an out-bound operation in the reservation service enables loose coupling and so improves the overall GreatH IT landscape's flexibility and scalability. </p>
		
<example id="example-outbound-operation" xml:space="default">
					<head xml:space="default">Use of outbound MEPs</head>
				<eg xml:space="preserve">
					
&lt;description ...&gt;
	...
	&lt;interface  name="reservationInterface"&gt;
		...
		&lt;operation name="opCheckAvailability" ... &gt;
		
		&lt;operation name="opLogInquiry" 
				<b>pattern="http://www.w3.org/ns/wsdl/out-only"</b>&gt;
			&lt;<b>output messageLabel="Out" element="ghns:customerData"</b> /&gt;
		&lt;/operation&gt;

	&lt;/interface&gt;
	...
&lt;/description&gt;</eg>
				</example>				
				
<p xml:space="default">Although the eight MEPs defined in WSDL 2.0 Part 2 <bibref ref="WSDL-PART2" xml:space="default"/> are intended to cover most use cases, WSDL 2.0 has designed this set to be extensible.  This is why MEPs are identified by URIs rather than a fixed set of  tokens.</p>
 <p xml:space="default">For more about defining new MEPs, see <specref ref="adv-MEP" xml:space="default"/>.  </p></div4></div3>
</div2>



<!-- **********************************Binding************************** -->
<!-- **********************************Binding************************** -->
		<div2 id="more-bindings" xml:space="default">
			<head xml:space="default">More on Bindings</head>
			
			<p xml:space="default">Bindings are used to supply protocol and encoding details that specify <emph xml:space="default">how</emph> messages are to be sent or received.   Each <code xml:space="default">binding</code> element uses a particular <emph xml:space="default">binding extension</emph> to specify such information.  WSDL 2.0 Part 2 <bibref ref="WSDL-PART2" xml:space="default"/> defines several binding extensions that are typically used.  However, binding extensions that are not defined in WSDL 2.0 Part 2 can also be used, provided that client and service toolkits support them.</p><p xml:space="default">Binding information must be supplied for every operation in the interface that is used in an endpoint.  However, if the desired binding extension provides suitable defaulting rules, then the information will only need to be explicitly supplied at the interface level, and the defaulting rules will implicitly propagate the information to the operations of the interface.   For example, see the <xspecref href="http://www.w3.org/TR/2007/REC-wsdl20-adjuncts-20070626#soap-defaults" xml:space="default" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest">Default Binding Rules</xspecref> of SOAP binding extension in  WSDL 2.0 Part 2 
  <bibref ref="WSDL-PART2" xml:space="default"/>.</p>
			
			<div3 id="more-bindings-wsdl" xml:space="default">
				<head xml:space="default">Syntax Summary for Bindings</head>
				<p xml:space="default">Since bindings are specified using extensions to the WSDL 2.0 language (i.e., binding extensions are not in the WSDL 2.0 namespace), the XML for expressing a binding will consist of a mixture of elements and attributes from WSDL 2.0 namespace and from the binding extension's namespace, using WSDL 2.0's open content model.    </p><p xml:space="default">Here is a syntax summary for  <code xml:space="default">binding</code>, simplified by omitting optional <code xml:space="default">documentation</code> elements. Bear in mind that this syntax summary only shows the  elements and attributes defined within the WSDL 2.0 namespace.   When an actual binding is defined, elements and attributes from the namespace of the desired binding extension will also be intermingled as required by that particular binding extension.</p>
				<eg xml:space="preserve">
&lt;description targetNamespace="<emph xml:space="default">xs:anyURI</emph>" &gt;
  . . .
  &lt;<b>binding</b> name="<emph xml:space="default">xs:NCName</emph>" interface="<emph xml:space="default">xs:QName</emph>"? &gt;

    &lt;fault ref="<emph xml:space="default">xs:QName</emph>" &gt;  &lt;/fault&gt;*

    &lt;operation ref="<emph xml:space="default">xs:QName</emph>" &gt;
      &lt;input messageLabel="<emph xml:space="default">xs:NCName</emph>"? &gt; &lt;/input&gt;*
      &lt;output messageLabel="<emph xml:space="default">xs:NCName</emph>"? &gt; &lt;/output&gt;*
      &lt;infault ref="<emph xml:space="default">xs:QName</emph>" messageLabel="<emph xml:space="default">xs:NCName</emph>"? &gt; &lt;/infault&gt;*
      &lt;outfault ref="<emph xml:space="default">xs:QName</emph>" messageLabel="<emph xml:space="default">xs:NCName</emph>"? &gt; &lt;/outfault&gt;*
    &lt;/operation&gt;*

  &lt;/<b>binding</b>&gt;*
  . . .
&lt;/description&gt;
</eg>
				
				
				
				<p xml:space="default">The <code xml:space="default">binding</code> syntax parallels the syntax of <code xml:space="default">interface</code>: each interface construct has  a binding counterpart. Despite this syntactic similarity, they are indeed different constructs, since they are in different symbol spaces and are designed for different purposes. </p>
			</div3>
			<div3 id="more-bindings-reusable" xml:space="default"><head xml:space="default">Reusable Bindings</head><p xml:space="default">A binding can either be reusable (applicable to any
      interface) or non-reusable (specified for a particular interface).    Non-reusable bindings may be specified at the granularity of the interface (assuming the binding extension provides suitable defaulting rules), or on a per-operation basis if needed.  A non-reusable binding was demonstrated in <specref ref="basics-binding" xml:space="default"/>.</p><p xml:space="default">To define a reusable binding, the <code xml:space="default">binding</code>   element simply omits the <code xml:space="default">interface</code> attribute and  omits specifying any
      operation-specific and fault-specific binding details.   Endpoints can later refer to a reusable binding in the same manner as for a non-reusable binding.   Thus, a reusable binding becomes associated with a particular interface when it is referenced from an endpoint, because an endpoint is part of a service, and the service specifies a particular interface that it implements.  Since a reusable binding does not specify an interface, reusable bindings cannot specify operation-specific details.  Therefore, reusable bindings can only be defined using binding extensions that have suitable defaulting rules, such that the binding information only needs to be explicitly supplied at the interface level.</p></div3>
      
      <div3 id="more-bindings-faults" xml:space="default">
				<head xml:space="default">Binding Faults</head>
				<p xml:space="default">A binding <code xml:space="default">fault</code> associates a concrete message format with an abstract fault 
of an interface. It describes how faults that occur within a message exchange of an operation will be formatted, since the fault does not occur by itself.  Rather, a fault occurs as part of a message 
exchange specified by an interface <code xml:space="default">operation</code> and its binding 
counterpart, the binding <code xml:space="default">operation</code>. </p>
				<p xml:space="default">A binding <code xml:space="default">fault</code> has one required <att xml:space="default">ref</att> attribute which is a reference, by QName, to an <code xml:space="default">interface</code>
					<att xml:space="default">fault</att>.  It identifies the abstract interface <code xml:space="default">fault</code> for which binding information is being specified. Be aware that the value of <att xml:space="default">ref</att> attribute of all the <code xml:space="default">faults</code> under a <code xml:space="default">binding</code>
must be unique. That is, one cannot define multiple bindings for the same interface fault within a given <code xml:space="default">binding</code>.</p>
			</div3>
			<div3 id="bindingOperations" xml:space="default">
				<head id="more-bindings-operations" xml:space="default">Binding Operations</head>
				<p xml:space="default">A binding <code xml:space="default">operation</code> describes a concrete binding of an interface
operation to a concrete message format.  An interface
operation is uniquely identified by the WSDL 2.0 target namespace of the 
interface and the name of the operation within that interface, via the required <att xml:space="default">ref</att> attribute of binding <code xml:space="default">operation</code>. As with faults, for each <code xml:space="default">operation</code> within a <code xml:space="default">binding</code>, the value of the  <att xml:space="default">ref</att> attribute must be unique.</p>
			</div3>

			<div3 id="more-bindings-soap" xml:space="default">
				<head xml:space="default">The SOAP Binding Extension</head>
				
				
					
					
				<p xml:space="default">The WSDL 2.0 SOAP Binding Extension (see WSDL 2.0 Part 2 <bibref ref="WSDL-PART2" xml:space="default"/>)   was primarily designed to support the features of SOAP 1.2 <bibref ref="SOAP12-PART1" xml:space="default"/>.  However, for backwards compatibility, it also provides some support for SOAP 1.1 <bibref ref="SOAP11" xml:space="default"/>.     </p><p xml:space="default">An example using the WSDL 2.0 SOAP binding extension was already presented in <specref ref="basics-binding" xml:space="default"/>, but some additional points are worth mentioning:<ulist xml:space="default"><item xml:space="default"><p xml:space="default">Because the same binding extension is used for both SOAP 1.2 and SOAP 1.1, a <code xml:space="default">wsoap:version</code> attribute is provided to allow you to indicate which version of SOAP you want.  If this attribute is not specified, it defaults to SOAP 1.2.</p></item><item xml:space="default"><p xml:space="default">The WSDL 2.0 SOAP binding extension defines a set of default rules, so that bindings can be specified at the interface level or at the operation level (or both), with the operation level taking precedence.   However, it does not define default binding rules for faults. Thus, if a given interface defines any faults, then corresponding binding information must be explicitly provided for each such fault.</p></item><item xml:space="default"><p xml:space="default">If HTTP is used as the underlying protocol, then the binding can (and should) control whether each operation will  use HTTP GET or POST.  (See    <specref ref="adv-get-vs-post" xml:space="default"/>.)</p></item></ulist></p><p xml:space="default">Here is an example that illustrates both a SOAP 1.2 binding (as seen before) and a SOAP 1.1 binding.</p><example id="example-binding-soap" xml:space="default">
					<head xml:space="default">SOAP 1.2 and SOAP 1.1 Bindings</head>

<eg xml:space="default">
&lt;?xml version="1.0" encoding="utf-8" ?&gt; 
&lt;description 
  xmlns="http://www.w3.org/ns/wsdl"
  targetNamespace="http://greath.example.com/2004/wsdl/resSvc" 
  xmlns:tns="http://greath.example.com/2004/wsdl/resSvc"
  xmlns:ghns="http://greath.example.com/2004/schemas/resSvc"
  xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"
  xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"&gt;

 ....

  &lt;!-- SOAP 1.2 Binding --&gt;
  &lt;binding name="reservationSOAPBinding" 
    interface="tns:reservationInterface"
    type="http://www.w3.org/ns/wsdl/soap"
    wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"&gt;

    &lt;operation ref="tns:opCheckAvailability" 
      wsoap:mep="http://www.w3.org/2003/05/soap/mep/request-response"/&gt;
  
    &lt;fault ref="tns:invalidDataFault" 
      wsoap:code="soap:Sender"/&gt;

  &lt;/binding&gt;
  
  &lt;!-- SOAP 1.1 Binding --&gt;
  &lt;binding name="reservationSOAP11Binding" 
    interface="tns:reservationInterface"
    type="http://www.w3.org/ns/wsdl/soap"
    wsoap:version="1.1"
    wsoap:protocol="http://www.w3.org/2006/01/soap11/bindings/HTTP/"&gt;
  
    &lt;operation ref="tns:opCheckAvailability"/&gt;
  
    &lt;fault ref="tns:invalidDataFault" 
      wsoap:code="soap11:Client"/&gt;

  &lt;/binding&gt;


  &lt;service name="reservationService" 
    interface="tns:reservationInterface"&gt;

    &lt;!-- SOAP 1.2 End Point --&gt;
    &lt;endpoint name="reservationEndpoint" 
      binding="tns:reservationSOAPBinding"
      address="http://greath.example.com/2004/reservation"/&gt;

    &lt;!-- SOAP 1.1 End Point --&gt;
    &lt;endpoint name="reservationEndpoint2"
      binding="tns:reservationSOAP11Binding"
      address="http://greath.example.com/2004/reservation"/&gt;
  
  &lt;/service&gt;  
&lt;/description&gt;

</eg>
				</example>



			<div4 id="more-bindings-soap-example-explanation" xml:space="default"><head xml:space="default">Explanation of Example</head><p xml:space="default">Most lines in this example is the same as previously explained in <specref ref="basics-binding" xml:space="default"/>, so we'll only point out lines that are demonstrating something new for SOAP 1.1 binding.<glist xml:space="default"><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;description ... xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"&gt;</code></label><def xml:space="default"><p xml:space="default">This is the namespace for terms defined within the SOAP 1.1 specification <bibref ref="SOAP11" xml:space="default"/>.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;binding...wsoap:version="1.1"</code></label><def xml:space="default"><p xml:space="default">This line indicates that this binding uses SOAP 1.1 <bibref ref="WSDL-SOAP11" xml:space="default"/>, rather than SOAP 1.2.</p></def></gitem><gitem xml:space="default"><label xml:space="default"><code xml:space="default">wsoap:protocol="http://www.w3.org/2006/01/soap11/bindings/HTTP/"&gt;</code></label><def xml:space="default"><p xml:space="default">This line specifies that HTTP should be used as the underlying transmission protocol. See  also  <specref ref="adv-get-vs-post" xml:space="default"/>.</p></def></gitem>
			
<gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;operation ref="tns:opCheckAvailability"/&gt;</code></label><def xml:space="default"><p xml:space="default">Note that <code xml:space="default">wsoap:mep</code> is not applicable to SOAP 1.1 binding. </p></def></gitem>
			<gitem xml:space="default"><label xml:space="default"><code xml:space="default">&lt;fault...wsoap:code="soap11:Client"/&gt;</code></label><def xml:space="default"><p xml:space="default">This line specifies the SOAP 1.1 fault code that will be used in  transmitting in