Version 0 of SOAP - hello world

Updated 2006-04-12 14:45:08

John Seal posted this hello world example for SOAP on comp.lang.tcl. tjk


 Here's a "Hello, world!" example.  First the server:

 package require SOAP::Domain

 namespace eval YourNamespace {

    proc iam {name} {
       return "Hello, $name!"
    }

    SOAP::export iam

 }

 SOAP::Domain::register -prefix /yourPrefix \
     -namespace YourNamespace \
     -uri YourNamespace

 Put the server in the CGI directory of your webserver (tclhttpd works
 great if you don't already have one).  Now the client:

 package require SOAP

 SOAP::create iam \
    -uri YourNamespace \
    -proxy http://localhost:8015/yourPrefix \
    -params {name string}

 Now invoke the procedure in the client:

 (sandbox) 1 % iam busirane
 Hello, busirane!