#!/usr/local/bin/perl -w
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('Hello::(?:hello)')
-> handle
;
This example has two key parts: it will look for a module named
"Hello" and will execute
Hello::hello( ) when called. Note that you
don't have to explicitly
"require"
Hello.pm; SOAP::Lite does this for you. Now,
let's look at the client:
#!/usr/local/bin/perl -w
use SOAP::Lite;
# If you want to see why something isn't working, enable +trace after
# use SOAP::Lite, as shown below
#use SOAP::Lite +trace;
my $proxy = 'http://www.some.server/cgi-bin/hello';
print SOAP::Lite
-> uri('urn:Hello')
-> proxy($proxy)
-> hello()
-> result . "\n\n"
;
It's essential that uri, as used
above, matches the module in which the hello( )
function lives. If it doesn't, you
won't see any returned results, since SOAP::Lite
won't be able to find the module in
@INC (using the +trace option
makes it clear that an unavailable module was not found in
@INC). Now that we have some context,
let's take a look at the proxy
option. In the above example, proxy is the URL
where the SOAP server lives. When SOAP::Lite sees the
proxy option, it loads the appropriate module based
on what you request.