Hello,
I am trying to get a SOAP::Lite client/server working but keep getting this error on the client side when using autodispatch (Not a HASH reference at C:/Perl/site/lib/SOAP/Lite.pm line 3828.) with SOAP::Lite version 0.712 or higher. With the older version 0.60a of this module the code seems to work as expected.
Martin Kutter (the author of this module) conveyed that I could be missing an API, which I am still not sure of as I went through all the documentation. Can you please help review this and point out the error?
Thanks
############## Server ##############
#!perl -w
use strict;
use warnings;
use SOAP::Lite +trace => 'all';
use SOAP::Transport::HTTP;
my $daemon = SOAP::Transport::HTTP::Daemon->new(
LocalAddr => 'localhost',
LocalPort => 8001,
listen => 5
);
$daemon->dispatch_to('Hello');
print "Contact SOAP server at ", $daemon->url, "\n";
$daemon->handle();
package Hello;
sub new {
my $class = shift;
my $self = {
TEXT => "ABC",
@_,
};
bless $self, $class;
return $self;
}
sub getText {
my ($self, $arg) = @_;
return $self->{TEXT};
}
1;
############## Client ##############
#!perl -w
use strict;
use warnings;
use SOAP::Lite +autodispatch => on_fault => sub {
my ($soap, $res) = @_;
print ref $res ? $res->faultstring : $soap->transport->status,
+ "\n";
return "SOAP_TRANSPORT_ERROR";
},
#trace => 'all',
;
my $uri = "http://localhost/Hello";
my $proxy = "http://localhost:8001/server.pl";
SOAP::Lite->self->uri($uri)->proxy($proxy);
my $h = Hello->new();
my $output = $h->getText();
print $output . "\n";
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.