W3C home > Mailing lists > Public > public-ws-desc-eds@w3.org > October 2004

2002/ws/desc/wsdl20 wsdl20-primer.xml,1.13,1.14

From: Kevin Liu <kliu@dev.w3.org>
Date: Sat, 23 Oct 2004 05:11:36 +0000
To: public-ws-desc-eds@w3.org
Message-ID: <E1CLEBk-00026u-TU@lionel-hutz.w3.org>

Update of /sources/public/2002/ws/desc/wsdl20
In directory hutz:/tmp/cvs-serv8063/ws/desc/wsdl20

Modified Files:
	wsdl20-primer.xml 
Log Message:
added set of examples for later use

Index: wsdl20-primer.xml
===================================================================
RCS file: /sources/public/2002/ws/desc/wsdl20/wsdl20-primer.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** wsdl20-primer.xml	14 Sep 2004 12:35:04 -0000	1.13
--- wsdl20-primer.xml	23 Oct 2004 05:11:34 -0000	1.14
***************
*** 1381,1384 ****
--- 1381,2071 ----
  			</div2>
  		</div1>
+ 		
+ 		<div1 id="examples">
+ 		<head>Examples </head>
+ 					<ednote>
+ 						<name>KevinL</name>
+ 						<date>20041022</date>
+ 						<edtext> Examples here are intended for use in various sections of the primer.  This section will be removed after the examples here are incorporated into the appropriate sections.  
+ 						</edtext>		
+ 					</ednote>
+ 					
+ <eg xml:space="preserve">
+ 
+ Index of examples
+ =================
+ 
+ Introduction
+ 	Example 1 - the hotel reservation service
+ Interface
+ 	Example 2.1 - use xs:import as child of wsdl:types
+ 	Example 2.2 - using xs:import and xs:include under xs:schema
+ 	Example 3 - intra-types schema reference using fragmental id
+ 	Example 4 - defining reusable faults using interface inheritance 
+ 	Example 5 - using RPC style
+ Binding
+ 	Example 6 - Defining soap headers in soap1.2 binding 
+ 	Example 7 - soap1.1 binding (To be done, pending the work of soap1.1 binding)
+ 	Example 8 - http binding
+ Advanced Topics
+ 	Example 9 -  Alternative authoring styl for the reservation service in Example 1 Using wsdl import and include
+ 	Example 10 - using media type and MTOM for attachment support
+ 
+ 
+ 
+ 
+ Introduction 
+ --------------------
+ Example 1 - the hotel reservation service
+ 
+ &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+ &lt;definitions xmlns="http://www.w3.org/2004/08/wsdl"
+     targetNamespace= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl" 
+     xmlns:ghns = "http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:wsoap= "http://www.w3.org/2004/08/wsdl/soap12"
+     xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
+     xmlns:tns= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl"&gt;
+     
+   &lt;types&gt;
+    &lt;xs:schema targetNamespace="http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+     xmlns="http://www.greath.com/2004/05/schemas/reservationService.xsd"&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="tRoomType"/&gt;      
+         &lt;/xs:sequence&gt;     
+     &lt;/xs:complexType&gt;   
+         
+     &lt;xs:simpleType name="tRoomType"&gt;     
+         &lt;xs:restriction base="xs:string"&gt;      
+             &lt;xs:enumeration value="Single"/&gt;      
+             &lt;xs:enumeration value="Double"/&gt;      
+             &lt;xs:enumeration value="Queen"/&gt;      
+             &lt;xs:enumeration value="King"/&gt;     
+         &lt;/xs:restriction&gt;    
+     &lt;/xs:simpleType&gt;  
+     
+     &lt;xs:element name="checkAvailabilityResponse" type="xs:double"/&gt;    
+     
+     &lt;xs:element name="MakeReservation" type="tMakeReservation"/&gt;    
+     &lt;xs:complexType name="tMakeReservation"&gt;     
+         &lt;xs:sequence&gt;      
+             &lt;xs:element  name="customerName" type="xs:string"/&gt;      
+             &lt;xs:element  name="billingAddress" type="xs:string"/&gt;      
+             &lt;xs:element  name="creditCardNumber" type="xs:string"/&gt;      
+         &lt;/xs:sequence&gt;     
+     &lt;/xs:complexType&gt;   
+ 
+     &lt;xs:element name="makeReservationResponse" type="xs:string"/&gt;    
+     
+     &lt;xs:element name="invalidCreditCardError" type="xs:string"/&gt;    
+ 
+     &lt;xs:element name="inValidDataError" type="tInvalidDataError"/&gt;    
+         &lt;xs:complexType name="tInvalidDataError"&gt;     
+             &lt;xs:sequence&gt;      
+                 &lt;xs:element  name="DataField" type="xs:string"/&gt;      
+                 &lt;xs:element  name="Description" type="xs:string"/&gt;      
+             &lt;/xs:sequence&gt;     
+         &lt;/xs:complexType&gt;
+    &lt;/xs:schema&gt;    
+   &lt;/types&gt;
+   
+   &lt;interface  name = "reservation" &gt;
+         
+     &lt;fault name = "inValidCreditCardFault"
+             element = "ghns:invalidCreditCardError"/&gt;  
+ 
+     &lt;fault name = "inValidDataFault"
+             element = "ghns:invalidDataError"/&gt;    
+ 
+     &lt;operation name="checkAvailability" pattern="http://www.w3.org/2004/03/wsdl/in-out" &gt;
+         
+         &lt;input messageLabel="In" element="ghns:checkAvailability" /&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:checkAvailabilityResponse" /&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+     &lt;/operation&gt;
+ 
+     &lt;operation name="makeReservation" pattern="http://www.w3.org/2004/03/wsdl/in-out" &gt;
+         
+         &lt;input messageLabel="In" element="ghns:makeReservation"/&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:makeReservationResponse"/&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+         &lt;outfault ref="inValidCreditCardFault" messageLabel="Out"/&gt;
+ 
+     &lt;/operation&gt;
+ 
+   &lt;/interface&gt;
+ 
+   &lt;binding name="reservationSOAPBinding" 
+ 	  interface="tns:reservation"
+ 	  type="http://www.w3.org/2004/08/wsdl/soap12"
+ 	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"
+           wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response"&gt;
+ 
+     &lt;fault ref="tns:invalidCreditCardFault" wsoap:code="soap:Sender"/&gt;
+   
+     &lt;fault ref="tns:invalidDataFault" wsoap:code="soap:Sender"/&gt;
+ 
+   &lt;/binding&gt;
+ 
+   &lt;service name="reservationService" interface="tns:reservation"&gt;
+ 
+         &lt;endpoint name="reservationEndpoint" 
+                  binding="tns:reservationSOAPBinding"
+                  address ="http://www.greath.com/reservation"/&gt;
+         
+   &lt;/service&gt;
+ 
+ &lt;/definitions&gt;
+ 
+ 
+  
+ Interface
+ -----------------------------
+ 
+ examples of using xsd import and include 
+ 
+ When the schema is defined in separate files, they can be imported or included into wsdl
+ 
+ Option 1, when the whole schema is defined in a single file, one may use xs:import as a child of wsdl:type to import that schema
+ 
+ Example 2.1   - use xs:import as child of wsdl:types
+ 
+   &lt;types&gt;
+ 
+     &lt;xs:import namespace="http://www.greath.com/2004/05/schemas/reservationService.xsd" 
+         schemaLocation= "http://www.greath.com/2004/05/schemas/reservationService.xsd"/&gt;
+         
+   &lt;/types&gt;
+ 
+ Option 2, when some elements are embedded under wsdl:type, some other elements defined in different files, one may using xs:import as a child of xs:schema to import elements with different namespace, and use xs:include to include elements under same namespace 
+ 
+ Example 2.2 - using xs:import and xs:include under xs:schema
+ 
+ file 1
+    &lt;xs:schema targetNamespace="http://www.greath.com/2004/05/schemas/checkAvailability.xsd"
+     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+     xmlns="http://www.greath.com/2004/05/schemas/checkAvailability.xsd"&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="tRoomType"/&gt;      
+         &lt;/xs:sequence&gt;     
+     &lt;/xs:complexType&gt;   
+         
+     &lt;xs:simpleType name="tRoomType"&gt;     
+         &lt;xs:restriction base="xs:string"&gt;      
+             &lt;xs:enumeration value="Single"/&gt;      
+             &lt;xs:enumeration value="Double"/&gt;      
+             &lt;xs:enumeration value="Queen"/&gt;      
+             &lt;xs:enumeration value="King"/&gt;     
+         &lt;/xs:restriction&gt;    
+     &lt;/xs:simpleType&gt;  
+     
+     &lt;xs:element name="checkAvailabilityResponse" type="xs:double"/&gt;    
+     
+    &lt;/xs:schema&gt;    
+ 
+ file 2 (stored at http://www.greath.com/2004/05/schemas/reservationService1.xsd)
+ 
+   &lt;xs:schema targetNamespace="http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+     xmlns="http://www.greath.com/2004/05/schemas/reservationService.xsd"&gt;
+     
+     &lt;xs:element name="MakeReservation" type="tMakeReservation"/&gt;    
+     &lt;xs:complexType name="tMakeReservation"&gt;     
+         &lt;xs:sequence&gt;      
+             &lt;xs:element  name="customerName" type="xs:string"/&gt;      
+             &lt;xs:element  name="billingAddress" type="xs:string"/&gt;      
+             &lt;xs:element  name="creditCardNumber" type="xs:string"/&gt;      
+         &lt;/xs:sequence&gt;     
+     &lt;/xs:complexType&gt;   
+ 
+     &lt;xs:element name="makeReservationResponse" type="xs:string"/&gt;    
+     
+    &lt;/xs:schema&gt;    
+ 
+ Some elements are embedded in the WSDL file.
+ 
+ 
+ &lt;definitions ...&gt;
+ 
+   &lt;types&gt;
+     &lt;xs:schema	targetNamespace="http://www.greath.com/2004/05/schemas/reservationService.xsd"
+                 xmlns:xs="http://www.w3.org/2001/XMLSchema"
+     		xmlns="http://www.greath.com/2004/05/schemas/reservationService.xsd"&gt;
+ 
+     	&lt;xs:import namespace="http://www.greath.com/2004/05/schemas/checkAvailability.xsd" 
+         	schemaLocation= "http://www.greath.com/2004/05/schemas/checkAvailability.xsd"/&gt;
+ 
+ 	 &lt;xs:include 
+         	schemaLocation= "http://www.greath.com/2004/05/schemas/reservationService1.xsd"/&gt;
+ 
+ 	&lt;xs:element name="invalidCreditCardError" type="xs:string"/&gt;    
+ 
+ 	&lt;xs:element name="inValidDataError" type="tInvalidDataError"/&gt;    
+         &lt;xs:complexType name="tInvalidDataError"&gt;     
+             &lt;xs:sequence&gt;      
+                 &lt;xs:element  name="DataField" type="xs:string"/&gt;      
+                 &lt;xs:element  name="Description" type="xs:string"/&gt;      
+             &lt;/xs:sequence&gt;     
+         &lt;/xs:complexType&gt;
+ 
+     &lt;/xs:schema&gt;    
+   &lt;/types&gt;
+ 
+   ...
+ 
+ &lt;/definitions&gt;
+ 
+ 
+ Example 3 - intra-types schema reference using fragmental id
+ &lt;definitions...&gt;
+  &lt;type&gt;
+      &lt;xs:schema targetNamespace = "a" id="a"&gt; ....&lt;/schema&gt;
+ 
+      &lt;xs:schema targetNamespace = "b"&gt;
+          &lt;xs:import namespace = "a" schemalocation = "#a"/&gt; ...
+      &lt;/schema&gt;
+ 
+      &lt;xs:schema targetNamespace = "a"&gt;
+          &lt;xs:include  schemalocation = "#a"/&gt; ...
+      &lt;/schema&gt;
+ 
+  &lt;type&gt;
+ &lt;/definitions&gt;
+ 
+ 
+ Example 4 - defining reusable faults using interface inheritance 
+ 
+ 
+ &lt;definitions...&gt;
+ 
+   &lt;interface name = "dataFault"&gt;
+ 
+     &lt;fault name = "inValidDataFault"
+             element = "ghns:invalidDataError"/&gt;    
+ 
+   &lt;/interface&gt;
+ 
+   &lt;interface  name = "reservation" extends = "tns:dataFault"&gt;
+         
+     &lt;fault name = "inValidCreditCardFault"
+             element = "ghns:invalidCreditCardError"/&gt;  
+ 
+     &lt;operation name="checkAvailability" pattern="http://www.w3.org/2004/03/wsdl/in-out" &gt;
+         
+         &lt;input messageLabel="In" element="ghns:checkAvailability" /&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:checkAvailabilityResponse" /&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+     &lt;/operation&gt;
+ 
+     &lt;operation name="makeReservation" pattern="http://www.w3.org/2004/03/wsdl/in-out" &gt;
+         
+         &lt;input messageLabel="In" element="ghns:makeReservation"/&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:makeReservationResponse"/&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+         &lt;outfault ref="inValidCreditCardFault" messageLabel="Out"/&gt;
+ 
+     &lt;/operation&gt;
+ 
+   &lt;/interface&gt;
+ 
+   ...
+ 
+ &lt;/definitions&gt;
+ 
+ 
+ Note that the schema of the input and output messages of operation "makeReservation" meets all the rules of the RPC style, so if desired, the operation "makeResercation" can be marked using RPC style.
+ 
+ Example 5 - using RPC style
+ 
+ &lt;definitions xmlns:wrpc = "http://www.w3.org/2004/08/wsdl/rpc" ...&gt;
+ 
+   ...
+   
+   &lt;interface  name = "reservation" ...&gt;
+         
+     ...
+ 
+     &lt;operation name="makeReservation" pattern="http://www.w3.org/2004/03/wsdl/in-out" 
+ 	 style = "http://www.w3.org/2004/08/wsdl/style/rpc"
+ 	 wrpc:signature = "(ghns:customerName #in) (ghns:billingAddress #in) (ghns:creditCardNumber #in) (ghns:makeReservationResponse #return)"&gt;
+         
+         &lt;input messageLabel="In" element="ghns:makeReservation"/&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:makeReservationResponse"/&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+         &lt;outfault ref="inValidCreditCardFault" messageLabel="Out"/&gt;
+ 
+     &lt;/operation&gt;
+ 
+   &lt;/interface&gt;
+ 
+   ...
+ 
+ &lt;/definitions&gt;
+ 
+ 
+  
+ Binding section
+ -----------------
+ 
+ Assume the soap binding of our "reservation" interface uses two soap modules: one for reliability with the uri of "http://example.com/reliability" and is appliable to all messages exchanged with the service, the other for security with the uri of "http://example.com/security" and is only appliable to the input message of operation "checkAvailability".  Example 6 shows how to include these soap modules in the soap 1.2 binding.
+ 
+ Example 6 - Defining soap headers in soap1.2 binding 
+ 
+ &lt;definitions...&gt;
+   ...
+   &lt;binding name="reservationSOAPBinding" 
+ 	  interface="tns:reservation"
+ 	  type="http://www.w3.org/2004/08/wsdl/soap12"
+ 	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"
+           wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response"&gt;
+ 	
+ 
+     &lt;fault ref="tns:invalidCreditCardFault" wsoap:code="soap:Sender"/&gt;
+   
+     &lt;fault ref="tns:invalidDataFault" wsoap:code="soap:Sender"/&gt;
+ 
+     &lt;wsoap:module uri= "http://example.com/reliability" required = "1"/&gt;
+ 
+     &lt;operation ref = "tns:checkAvailability"&gt;
+        &lt;input&gt; 
+ 	 &lt;wsoap:module uri= "http://example.com/reliability" required = "1"/&gt;
+        &lt;/input&gt; 
+     &lt;/operation&gt;
+     ...
+ 
+  &lt;/binding&gt;
+   ...
+ 
+ &lt;/definitions&gt;
+ 
+ the corresponding run time input message for checkAvailability would be something like
+ 
+ 
+ POST /reservation HTTP/1.1
+ Host: http://www.greath.com
+ Content-Type: application/soap+xml; charset="utf-8"
+ Content-Length: nnnn
+ 
+ &lt;?xml version="1.0" ?&gt;
+ &lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt;
+ 
+     &lt;soapenv:Header&gt;
+         &lt;r:some-reliability-headerblock xmlns:r="http://example.com/reliability"&gt;
+             ...
+         &lt;/r:some-reliability-headerblock&gt;
+         &lt;r:some-security-headerblock xmlns:r="http://example.com/security"&gt;
+             ...
+         &lt;/r:some-security-headerblock&gt;
+     &lt;/soapenv:Header&gt;
+ 
+     &lt;soapenv:Body&gt;
+         &lt;m:checkAvailability xmlns:m="http://www.greath.com/2004/05/schemas/reservationService.xsd"&gt;
+             &lt;m:chekcInDate&gt;2008-11-11&lt;/m:checkInDate&gt;
+             &lt;m:chekcOutDate&gt;2008-11-28&lt;/m:checkOutDate&gt;
+ 	    &lt;m:roomType&gt;King&lt;/m:roomType&gt;
+         &lt;/m:checkAvailability&gt;
+     &lt;/soapenv:Body&gt;
+ &lt;/soapenv:Envelope&gt;
+ 
+ 
+ 
+ Example 7 - soap1.1 binding (To be done, pending the work of soap1.1 binding)
+ 
+ 
+ Example 8 - http binding
+ 
+ &lt;definitions...&gt;
+   ...
+   &lt;binding name="reservationHTTPBinding" 
+ 	  interface="tns:reservation"
+ 	  type="http://www.w3.org/2004/08/wsdl/http"
+           whttp:version="1.1"
+ 	  whttp:cookies = "0"&gt;	
+ 
+     &lt;fault ref="tns:invalidCreditCardFault" whttp:code="400"/&gt;
+   
+     &lt;fault ref="tns:invalidDataFault" whttp:code="400"/&gt;
+ 
+     &lt;operation ref = "tns:checkAvailability"
+                whttp:method= "POST"
+ 	       whttp:inputSerialization= "application/xml"&gt;
+ 
+ 	&lt;input whttp:transferCoding="???" /&gt;
+ 
+     &lt;/operation&gt;
+     ...
+ 
+  &lt;/binding&gt;
+ 
+  &lt;service name="reservationService" interface="tns:reservation"&gt;
+ 
+         &lt;endpoint name="reservationEndpoint" 
+                  binding="tns:reservationHTTPBinding"
+                  address ="http://www.greath.com/reservation"
+ 		 whttp:authenticationType = "none"/&gt;
+         
+   &lt;/service&gt;
+ 
+ &lt;/definitions&gt;
+ 
+ 
+ The corresponding HTTP message is something like:
+ 
+ POST /reservation HTTP/1.1
+ Host: http://www.greath.com
+ Content-Type: application/xml; charset="utf-8"
+ Content-Length: nnnn
+ 
+ &lt;m:checkAvailability xmlns:m="http://www.greath.com/2004/05/schemas/reservationService.xsd"&gt;
+   &lt;m:chekcInDate&gt;2008-11-11&lt;/m:checkInDate&gt;
+   &lt;m:chekcOutDate&gt;2008-11-28&lt;/m:checkOutDate&gt;
+   &lt;m:roomType&gt;King&lt;/m:roomType&gt;
+ &lt;/m:checkAvailability&gt;
+ 
+  
+ Advanced Topics
+ -------------------
+ Example 9 -  Alternative authoring styl for the reservation service in Example 1 Using wsdl import and include
+ 
+ file 1: http://www.greath.com/2004/05/schemas/reservationService.xsd
+ 
+    &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+    &lt;xs:schema targetNamespace="http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+     xmlns="http://www.greath.com/2004/05/schemas/reservationService.xsd"&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="tRoomType"/&gt;      
+         &lt;/xs:sequence&gt;     
+     &lt;/xs:complexType&gt;   
+         
+     &lt;xs:simpleType name="tRoomType"&gt;     
+         &lt;xs:restriction base="xs:string"&gt;      
+             &lt;xs:enumeration value="Single"/&gt;      
+             &lt;xs:enumeration value="Double"/&gt;      
+             &lt;xs:enumeration value="Queen"/&gt;      
+             &lt;xs:enumeration value="King"/&gt;     
+         &lt;/xs:restriction&gt;    
+     &lt;/xs:simpleType&gt;  
+     
+     &lt;xs:element name="checkAvailabilityResponse" type="xs:double"/&gt;    
+     
+     &lt;xs:element name="MakeReservation" type="tMakeReservation"/&gt;    
+     &lt;xs:complexType name="tMakeReservation"&gt;     
+         &lt;xs:sequence&gt;      
+             &lt;xs:element  name="customerName" type="xs:string"/&gt;      
+             &lt;xs:element  name="billingAddress" type="xs:string"/&gt;      
+             &lt;xs:element  name="creditCardNumber" type="xs:string"/&gt;      
+         &lt;/xs:sequence&gt;     
+     &lt;/xs:complexType&gt;   
+ 
+     &lt;xs:element name="makeReservationResponse" type="xs:string"/&gt;    
+     
+     &lt;xs:element name="invalidCreditCardError" type="xs:string"/&gt;    
+ 
+     &lt;xs:element name="inValidDataError" type="tInvalidDataError"/&gt;    
+         &lt;xs:complexType name="tInvalidDataError"&gt;     
+             &lt;xs:sequence&gt;      
+                 &lt;xs:element  name="DataField" type="xs:string"/&gt;      
+                 &lt;xs:element  name="Description" type="xs:string"/&gt;      
+             &lt;/xs:sequence&gt;     
+         &lt;/xs:complexType&gt;
+    &lt;/xs:schema&gt;    
+ 
+ File 2 - http://www.greath.com/2004/05/wsdl/reservationService-interface.wsdl
+ 
+  &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+  &lt;definitions xmlns="http://www.w3.org/2004/08/wsdl"
+     targetNamespace= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl" 
+     xmlns:ghns = "http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:tns= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl"&gt;
+ 
+    &lt;types&gt;
+ 
+      &lt;xs:import namespace="http://www.greath.com/2004/05/schemas/reservationService.xsd" 
+         schemaLocation= "http://www.greath.com/2004/05/schemas/reservationService.xsd"/&gt;
+         
+    &lt;/types&gt;
+ 
+   
+    &lt;interface  name = "reservation" &gt;
+         
+      &lt;fault name = "inValidCreditCardFault"
+             element = "ghns:invalidCreditCardError"/&gt;  
+ 
+      &lt;fault name = "inValidDataFault"
+             element = "ghns:invalidDataError"/&gt;    
+ 
+      &lt;operation name="checkAvailability" pattern="http://www.w3.org/2004/03/wsdl/in-out" &gt;
+         
+         &lt;input messageLabel="In" element="ghns:checkAvailability" /&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:checkAvailabilityResponse" /&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+      &lt;/operation&gt;
+ 
+     &lt;operation name="makeReservation" pattern="http://www.w3.org/2004/03/wsdl/in-out" &gt;
+         
+         &lt;input messageLabel="In" element="ghns:makeReservation"/&gt;
+ 
+         &lt;output messageLabel="Out" element="ghns:makeReservationResponse"/&gt;
+ 
+         &lt;outfault ref="inValidDataFault" messageLabel="Out"/&gt;
+ 
+         &lt;outfault ref="inValidCreditCardFault" messageLabel="Out"/&gt;
+ 
+     &lt;/operation&gt;
+ 
+   &lt;/interface&gt;
+ 
+ &lt;/definitions&gt;
+ 
+ File 3 - http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl
+ 
+ &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+ &lt;definitions xmlns="http://www.w3.org/2004/08/wsdl"
+     targetNamespace= "http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl" 
+     xmlns:wsoap= "http://www.w3.org/2004/08/wsdl/soap12"
+     xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
+     xmlns:tns= "http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl"&gt;
+     
+ 
+ 
+   &lt;binding name="reservationSOAPBinding" 
+ 	  interface="tns:reservation"
+ 	  type="http://www.w3.org/2004/08/wsdl/soap12"
+ 	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"
+           wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response"&gt;
+ 
+     &lt;fault ref="tns:invalidCreditCardFault" wsoap:code="soap:Sender"/&gt;
+   
+     &lt;fault ref="tns:invalidDataFault" wsoap:code="soap:Sender"/&gt;
+ 
+   &lt;/binding&gt;
+ 
+ 
+ &lt;/definitions&gt;
+ 
+ 
+ File 4 - the complete service definition
+ 
+ &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+ &lt;definitions xmlns="http://www.w3.org/2004/08/wsdl"
+     targetNamespace= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl" 
+     xmlns:ghns = "http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:wsoap= "http://www.w3.org/2004/08/wsdl/soap12"
+     xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
+     xmlns:tns= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl"
+     xmlns:bns = "http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl"&gt;    
+ 
+   &lt;include location = "http://www.greath.com/2004/05/wsdl/reservationService-interface.wsdl"/&gt;
+   &lt;import namespace = "http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl"
+           location = "http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl"/&gt;
+ 
+   &lt;service name="reservationService" interface="tns:reservation"&gt;
+ 
+         &lt;endpoint name="reservationEndpoint" 
+                  binding="bns:reservationSOAPBinding"
+                  address ="http://www.greath.com/reservation"/&gt;
+         
+   &lt;/service&gt;
+ 
+ &lt;/definitions&gt;
+ 
+ 
+ Example 10 - using media type and MTOM for attachment support
+ 
+ Let's say that the checkAvailability operation may return a vedio file for a virtual tours of the room availale. Example 10 shows how to indicate in WSDL that MTOM may be used to optimize the transmission.
+ 
+ The schema of the response message in Example 1 needs to be modified to indicate the expected media type.
+ 
+ 
+   &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+   &lt;xs:schema targetNamespace="http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:xs="http://www.w3.org/2001/XMLSchema"
+     xmlns:xmlmime="http://www.w3.org/@@@@/@@/xmlmime"
+     xmlns="http://www.greath.com/2004/05/schemas/reservationService.xsd"&gt;
+ 
+    &lt;xs:import namespace="http://www.w3.org/@@@@/@@/xmlmime"
+             schemaLocation="http://www.w3.org/@@@@/@@/xmlmime"/&gt;
+ 
+ 
+     ...
+             
+     &lt;xs:element name="checkAvailabilityResponse" type="xmlmime:base64binary"&gt;    
+             xmlmime:expectedMediaType="vedio/*"/&gt; 
+ 
+      ...
+ 
+  &lt;/xs:schema&gt;    
+ 
+ Then in the binding, use a feature to indicate the use of MTOM
+  
+ &lt;?xml version="1.0" encoding="utf-8" ?&gt; 
+ &lt;definitions xmlns="http://www.w3.org/2004/08/wsdl"
+     targetNamespace= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl" 
+     xmlns:ghns = "http://www.greath.com/2004/05/schemas/reservationService.xsd"
+     xmlns:wsoap= "http://www.w3.org/2004/08/wsdl/soap12"
+     xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
+     xmlns:tns= "http://www.greath.com/2004/05/wsdl/reservationService.wsdl"
+     xmlns:bns = "http://www.greath.com/2004/05/wsdl/reservationService-binding.wsdl"&gt;    
+     
+    ...
+ 
+   &lt;binding name="reservationSOAPBinding" 
+ 	  interface="tns:reservation"
+ 	  type="http://www.w3.org/2004/08/wsdl/soap12"
+ 	  wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"
+           wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response"&gt;
+ 
+       ...
+ 
+      &lt;wsdl:feature uri="http://www.w3.org/2004/08/soap/features/http-optimization"/&gt;
+ 
+      ...
+ 
+   &lt;/binding&gt;
+ 
+   ...
+ 
+ &lt;/definitions&gt;
+ 
+ 
+ 
+ </eg>
+ 										
+ 					
+ 		</div1>
  	</body>
  </spec>
Received on Saturday, 23 October 2004 05:11:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:31:26 UTC