I've gone ahead and extend the simple 'soap' package I have to
include a SoapClient class that helps support writing SOAP
clients in Unicon. It's pretty rudimentary - for example you
cannot get more than the return value back from the server
(no support for in/out or out) parameters.
I haven't tried out Steve Lumos' fixes yet, so this version
does a direct TCP connection instead of using the HTTP
messaging support in Unicon. Someone might want to change
the code to use HTTP messaging!
Here's a sample client:
---------------------------------------------------------
import soap
procedure main()
soap := SoapClient(URI_GOES_HERE, PROXY_GOES_HERE)
result := soap.call("query","*","host = 'weaver'","date DESC")
every row := !result do {
write(" ",row["host"]," ",row["percent"]," ",
row["date"]," ",row["filesys"])
}
end
----------------------------------------------------------
and the output when run (with the correct URI and PROXY filled
in, of course:
----------------------------------------------------------
% soapclient
weaver 38.0 2003-03-03 10:30:01 /
weaver 40.0 2003-03-03 10:30:01 /boot
weaver 18.0 2003-03-03 10:30:01 /home
weaver 2.0 2003-03-03 10:30:01 /tmp
weaver 72.0 2003-03-03 10:30:01 /usr
weaver 62.0 2003-03-03 10:30:01 /var
weaver 38.0 2003-03-03 06:30:00 /
weaver 40.0 2003-03-03 06:30:00 /boot
weaver 18.0 2003-03-03 06:30:00 /home
weaver 2.0 2003-03-03 06:30:00 /tmp
---------------------------------------------------------
For comparison, here's an equivalent Perl script:
---------------------------------------------------------
#!/usr/local/bin/perl -w
# Query a database of filesystem utilization information and
# display some of the statistics for a specific machine ('weaver').
#
use SOAP::Lite
on_fault => sub { my($soap,$res) = @_;
die ref $res ? $res->faultstring : $soap->transport->status, "
dead\n";
};
my $soap = SOAP::Lite
-> uri(URI_GOES_HERE)
-> proxy(PROXY_GOES_HERE);
eval {
$result = $soap->query("*","host = 'weaver'", "date DESC")->result;
foreach $row (@{$result}) {
print " ",$row->{'host'};
print " ",$row->{'percent'};
print " ",$row->{'date'};
print " ",$row->{'filesys'};
print "\n";
}
1} or die;
------------------------------------------------------------------
The output is identical.
There's a lot of improvements that can (*should*) be made to better
support a wider range of features of SOAP, but I'm not enough of
an expert on SOAP to be the one to do so... Someone should really
look at both SoapClient and SoapServer and make sure they're
reasonable approximations of reality.
Improvements and bug fixes welcome!
You can pick up a tar file containing (among other things) the
soap package files by following the links to the CVS repository
at:
http://tapestry.tuc.noao.edu/unicon
on-line documentation is also there.
--
Steve Wampler <[EMAIL PROTECTED]>
National Solar Observatory
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group