Dear monks!
I would like to use SOAP::Lite to provide the vital parts of our system functionality. However, not everyone is a perl lover. I found the WSDL::Generator on CPAN, which will be a good help on my way to make these SOAP RPC Servers talk to C/C++/PHP/Perl/whatever speaks SOAP.
While trying to figure out, how this works, I became totally confused about Namespace(s), URI, URN etc.pp. Until now there was no need to use these, since this code works under perl:
Server:
# define the routines ...
sub return_sumfink {
#do something
}
# and
$daemon = SOAP::Transport::HTTP::Daemon
-> new(LocalAddr => $host, LocalPort => $port,
Reuse => 1)
-> dispatch_to('return_sumfink','aFunction')
$daemon->handle;
BTW, if you
ran out of sockets with SOAP::Lite or had to
wait 30secs to start a new SOAP Server (Port already in use), have a look at the
Reuse option above.
Client:
$s = SOAP::Lite
->proxy("http://$machine:$port")
->on_fault(sub{});
$r = $s->test_connection;
unless (defined $r && defined $r->envelope) {
return 'NOGO:', $s->transport->status, "\n";
}
return $s->call(@_)->result;
This worked like a charm, but now for the language independend way ...
AFAIK, one way to construct the URN is using Namespaces (packages) within the Server. Lets say I defined a package ExternalIO in the server, which contains the sub return_sumfink. NOTE: I have no external modules (e.g. ExternalIO.pm), its within the server.
Now I try to call the function:
use SOAP::Lite +autodispatch =>
uri=>'ExternalIO',
proxy=>'http://localhost:8081';
$hi = return_sumfink('scalar');
print $hi . "\n";
The sub return_sumfink never gets called. Where am I wrong? Is there good reading material about SOAP somewhere out there?
Any hint is appreciated,
TIA
Gnork
cat /dev/world | perl -e "(/(^.*? \?) 42\!/) && (print $1))
errors->(c)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.