home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / demos / TclSOAP / XMLRPC-tests.tcl < prev   
Encoding:
Text File  |  2001-10-22  |  3.5 KB  |  108 lines

  1. # XMLRPC-tests.tcl - Copyright (C) 2001 Pat Thoyts <Pat.Thoyts@bigfoot.com>
  2. #
  3. # Create some remote XML-RPC access methods to demo servers.
  4. #
  5. # If you live behind a firewall and have an authenticating proxy web server
  6. # try executing SOAP::proxyconfig and filling in the fields. This sets
  7. # up the SOAP package to send the correct headers for the proxy to 
  8. # forward the packets (provided it is using the `Basic' encoding scheme).
  9. #
  10. # -------------------------------------------------------------------------
  11. # This software is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  13. # or FITNESS FOR A PARTICULAR PURPOSE.  See the accompanying file `LICENSE'
  14. # for more details.
  15. # -------------------------------------------------------------------------
  16. #
  17. # @(#)$Id: XMLRPC-tests.tcl,v 1.3 2001/06/15 00:45:33 patthoyts Exp $
  18.  
  19. package require XMLRPC
  20.  
  21. set methods {}
  22.  
  23. # -------------------------------------------------------------------------
  24.  
  25. # Some of UserLands XML RPC examples.
  26.  
  27. lappend methods [ \
  28.     XMLRPC::create getStateName \
  29.         -name "examples.getStateName" \
  30.         -proxy "http://betty.userland.com/RPC2" \
  31.         -params { state i4 } ]
  32.  
  33. lappend methods [ \
  34.     XMLRPC::create getStateList \
  35.     -name "examples.getStateList" \
  36.     -proxy "http://betty.userland.com/RPC2" \
  37.     -params { states array(int) } ]
  38.  
  39. # Meerkat
  40. namespace eval Meerkat {
  41.     set proxy {http://www.oreillynet.com/meerkat/xml-rpc/server.php}
  42.  
  43.     # returns array of meerkat method names
  44.     lappend methods [ \
  45.          XMLRPC::create listMethods \
  46.             -name "system.listMethods" \
  47.             -proxy $proxy \
  48.             -params {} ]
  49.  
  50.     # returns an array of category structs: {int id; string title;}
  51.     lappend methods [ \
  52.          XMLRPC::create getCategories \
  53.             -name "meerkat.getCategories" \
  54.             -proxy $proxy \
  55.             -params {} ]
  56.  
  57.     # returns an array of channel structs: { int id; string title; }
  58.     lappend methods [ \
  59.          XMLRPC::create getChannels \
  60.             -name "meerkat.getChannels" \
  61.             -proxy $proxy \
  62.             -params {} ]
  63.  
  64.     # returns array of channel structs: {int id; string title;} given
  65.     # a category id.
  66.     lappend methods [ \
  67.          XMLRPC::create getChannelsByCategory \
  68.             -name "meerkat.getChannelsByCategory" \
  69.             -proxy $proxy \
  70.             -params {id int} ]
  71.  
  72.     # requires a recipe struct and returns an array of structs:
  73.     # {string title; string link; string description; string dc_creator;
  74.     #  string dc_subject; string dc_publisher; string dc_date;
  75.     #  string dc_format; string dc_language; string dc_rights 
  76.     # }
  77.     # try getItems {search {/[Tt]cl/} num_items 5 descriptions 0}
  78.     #
  79.     # try: foreach item [Meerkat::getItems 2081] {
  80.     #          array set d $item
  81.     #          puts "$d(title)\n$d(link)\n$d(description)\n"
  82.     #      }
  83.     
  84.     lappend methods [ \
  85.          XMLRPC::create getItems \
  86.             -name "meerkat.getItems" \
  87.             -proxy $proxy \
  88.             -params { item struct } ]
  89.  
  90. }
  91.  
  92. # Userland RSS server
  93. lappend methods [ \
  94.         XMLRPC::create getServiceInfo \
  95.            -name "aggregator.getServiceInfo" \
  96.            -proxy "http://aggregator.userland.com/RPC2" \
  97.            -params { id int } ]
  98.  
  99. # -------------------------------------------------------------------------
  100.  
  101. set methods
  102.  
  103. # -------------------------------------------------------------------------
  104.  
  105. # Local variables:
  106. #    indent-tabs-mode: nil
  107. # End:
  108.