Updated 2014-01-25 16:08:17 by RLE

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!

AM (7 august 2009) This example was very helpful in setting up a client program (first in Tcl, then in C with Tcl embedded) to connect to a server written in Java. The services were readily available in Tcl, provided the name of the SOAP procedure matches the name of the Java function that implements the service. (I did not pay much attention to the -uri argument though, I do not know what it is for ;)).