Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Basic WSDL Example: XMethods eBay Price Watcher Service - Page 5

April 3, 2002

Before moving on to more complicated WSDL examples, let's examine another relatively simple one. Example 6-3 provides a WSDL file for the XMethods eBay Price Watcher Service. The service takes an existing eBay auction ID, and returns the value of the current bid.

Example 6-3: eBayWatcherService.wsdl (reprinted with permission of XMethods, Inc.)

<?xml version="1.0"?>
<definitions name="eBayWatcherService" 
   targetNamespace=
      "http://www.xmethods.net/sd/eBayWatcherService.wsdl"
   xmlns:tns="http://www.xmethods.net/sd/eBayWatcherService.wsdl"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns="http://schemas.xmlsoap.org/wsdl/">
  
   <message name="getCurrentPriceRequest">
      <part name="auction_id" type = "xsd:string"/>
   </message>
   <message name="getCurrentPriceResponse">
      <part name="return" type = "xsd:float"/>
   </message>
  
   <portType name="eBayWatcherPortType">
      <operation name="getCurrentPrice">
         <input 
            message="tns:getCurrentPriceRequest"
            name="getCurrentPrice"/>
         <output 
            message="tns:getCurrentPriceResponse"
            name="getCurrentPriceResponse"/>
      </operation>
   </portType>
  
   <binding name="eBayWatcherBinding" type="tns:eBayWatcherPortType">
      <soap:binding 
         style="rpc"
         transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="getCurrentPrice">
         <soap:operation soapAction=""/>
         <input name="getCurrentPrice">
            <soap:body 
               use="encoded"
               namespace="urn:xmethods-EbayWatcher"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </input>
         <output name="getCurrentPriceResponse">
            <soap:body
               use="encoded"
               namespace="urn:xmethods-EbayWatcher"
               encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
      </operation>
   </binding>
  
   <service name="eBayWatcherService">
      <documentation>
         Checks current high bid for an eBay auction
      </documentation>
      <port name="eBayWatcherPort" binding="tns:eBayWatcherBinding">
         <soap:address 
          location=
	  "http://services.xmethods.net:80/soap/servlet/rpcrouter"/>
      </port>
   </service>
</definitions>

Here is an overview of the main WSDL elements:

messages
Two messages are defined: getCurrentPriceRequest and getCurrentPriceResponse. The request message contains a single string parameter; the response message contains a single float parameter.

portType
A single operation, getCurrentPrice, is defined. Again, we see the request/response operation pattern.

binding
The binding element specifies HTTP SOAP as the transport. The soapAction attribute is left as an empty string ("").

service
This element specifies that the service is available at http://services.xmethods.net/soap/servlet/rpcrouter.

To access the eBay watcher service, you can use any of the WSDL invocation tools defined earlier. For example, the following call to GLUE:

invoke http://www.xmethods.net/sd/2001/EBayWatcherService.wsdl
    getCurrentPrice 1271062297

retrieves the current bid price for a Handspring Visor Deluxe:

result = 103.5

TIP:  The XMethods web site (http://www.xmethods.net/) provides dozens of sample SOAP and .NET services. Nearly all of these services include WSDL files and therefore provide an excellent opportunity for learning WSDL in detail. As you browse the XMethods directory, try interfacing with the specified services via any of the WSDL invocation tools described here. Quite likely, you will be amazed at how easy it is to integrate and invoke new services.

WSDL Invocation Tools, Part I - Page 4
Web Services Essentials
WSDL Invocation Tools, Part II - Page 6


Up to => Home / Authoring / Languages / XML / WebServices / WSDL / Essentials




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers