I tried to wrestle my way through the arcana of WSDL, but I'm giving up. I don't doubt that it can be done, but I don't care enough to work my way through it.
#!/usr/bin/perl -- # -*- Perl -*- use SOAP::Lite; my $usage = "$0 userid\n"; my $userid = shift @ARGV || die $usage; my $wsdl = "http://norman.walsh.name/2005/02/24/examples/witw.wsdl"; my $service = SOAP::Lite->service($wsdl); my $result = $service->name($userid); print "$userid is $result\n";
If it works in some tool that you have, I'd been keen to hear it. Likewise, if it doesn't work and you know how to fix it, I'd like to hear that too.
I tried to extend the file to support all of the methods provided by my SOAP server, but I gave up. I bungled it, or the tools I tried are buggy, or both. Sometimes I got incomprehensible error messages, sometimes I got incomprehensible results, and sometimes the code just went off into an infinite loop.
That said, I do think some sort of web services description language is necessary. While XML geeks may be happy building fancy URIs and parsing XML result documents to get work done, I'm afraid your average programmer isn't going to go for that.
The WITW project uses a function to calculate the distance between two points on the earth. I use that function by declaring it and calling it:
use Math::Trig qw(great_circle_distance); … $dist = great_circle_distance($lat, $long, $llat, $llong, $radius);
Now suppose the implementation of
great_circle_distance was a web service. It could
be a straight-forward REST web service or it could be some sort of RPC
or it could be something else. As a programmer writing WITW,
I don't care! What has to happen is, I declare the
function and then I use it. A little boilerplate is OK, but making
me understand URIs or GET or POST or XML isn't.
I think something dramatically simpler than WSDL could get the job done most of the time. We know the hard things are possible, we just have to make the easy things easy.