#174 error with autodispatch: "Not a HASH reference" in Lite.pm

open
Binding (1)
5
2014-08-24
2009-12-24
No

I took the following code from the perldoc pages for SOAP::Lite, and when it is run I get the following error:

Not a HASH reference at /usr/local/share/perl/5.10.0/SOAP/Lite.pm line 3753.

test2.pl (client) :

#!/usr/bin/perl
use warnings;
use strict;

use SOAP::Lite +autodispatch =>
uri => 'http://localhost/Demo',
proxy => 'http://localhost/~david/cgi-bin/soap/soapobj.cgi';

# using SOAP calls as objects
my $t = Demo->new(100);
print($t->nxt,"\n");

soapobj.cgi (server):

#!/usr/bin/perl
use warnings;
use strict;

use SOAP::Lite +autodispatch =>
uri => 'http://localhost/Demo',
proxy => 'http://localhost/~david/cgi-bin/soap/soapobj.cgi';

# using SOAP calls as objects
my $t = Demo->new(100);
print($t->nxt,"\n");

Discussion

  • David Dombrowsky

    SOAP client

     
  • David Dombrowsky

    sorry, cut and paste error when copying in server code.

    soapobj.cgi (server):

    #!/usr/bin/perl
    use warnings;
    use strict;

    use SOAP::Transport::HTTP;

    SOAP::Transport::HTTP::CGI
    -> dispatch_to('Demo')
    -> handle;

    package Demo;

    sub new {
    my $self = shift;
    my $class = ref($self) || $self;
    bless {_num => shift} => $class;
    }

    sub nxt {
    my $self = shift;
    $self->{_num}++;
    return $self->{_num};
    }

     
  • David Dombrowsky

    The following code without autodispatch does work:
    --------------
    my $s = SOAP::Lite->new(
    uri => 'http://localhost/Demo',
    proxy => 'http://localhost/~david/cgi-bin/soap/soapobj.cgi'
    );

    # using SOAP calls as objects
    my $t = $s->call(new => 123)->result;
    my $d = SOAP::Data->value($t);
    print("result: ".$s->nxt($d)->result,"\n");

    ---------------
    output is correct:

    result: 124

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks