logo       

Re: ISA not working as expected in SOAP::Lite servlets: msg#00008

windows.devel.soap.general

Subject: Re: ISA not working as expected in SOAP::Lite servlets

Hi Paul,

>File Test/Root.pm
>---------------------------------
>package Root;

You may want to change that to 'package Test::Root;'. Everything seems to
be working after that.

>my $myob=$remoteserver->createObject();
>print $myob->foo();
>
>I have to do
>
>my $myob=$remoteserver->createObject();
>my $soapcall=SOAP::Lite->uri("http://soap.somewhere.net/Myob";)->
> proxy("http://blah.net/";);
>print $soapcall->foo($myob)->result;

yes, these are two alternatives.

>My biggest problem is when I was using autodispatch everything appeared to
>just work but now I need to talk to multiple soap servers in one piece of
>code so autodispatch no longer seems sensiable.

You may do something like this:

# go to server 1
my $myob=$remoteserver->createObject();
print $myob->foo();

# SOAP::Lite->self returns SOAP::Lite object that does autodispatch, so
you can get/set any properties on that object as you would usually do
SOAP::Lite->self->endpoint("http://foo/";);

# go to server 2
my $myob=$remoteserver->createObject();
print $myob->foo();

Hope it helps.

Best wishes, Paul.

On Mon, 9 Sep 2002 12:27:43 +0100, Paul Hirst <paul.hirst@xxxxxxxxxx>
wrote:

>I haven't been able to find any information or examples which would clear
>this up for me so apologies if this is a dumb question.
>
>The problem is that I can't call a method in an object which is actually
>defined in it's superclass. It returns the error Failed to locate method
>(x) in class (y).
>
>An example:
>
>File: daemon
>---------------------------------
>#!/usr/bin/perl -w
>
>use strict;
>use warnings;
>require Test::Test;
>require Test::Root;
>
>use SOAP::Transport::HTTP;
>
>$SIG{PIPE} = 'IGNORE';
>
>my $daemon = SOAP::Transport::HTTP::Daemon
> -> new (LocalPort => 8012, Reuse => 1)
> -> objects_by_reference(qw( Test::Test Test::Root ))
> -> dispatch_to(qw( Test::Test Test::Root ))
> -> options({compress_threshold => 10000})
>;
>print "Contact to SOAP server at ", $daemon->url, "\n";
>$daemon->handle;
>---------------------------------
>
>File: Test/Test.pm
>---------------------------------
>package Test::Test;
>require Test::Root;
>
>our @ISA=qw( Test::Root );
>
>sub foo {
> return "This is a foo\n";
>}
>
>1;
>---------------------------------
>
>File Test/Root.pm
>---------------------------------
>package Root;
>
>sub bar {
> return "This is a bar\n";
>}
>
>1;
>---------------------------------
>
>File: client
>---------------------------------
>use SOAP::Lite;
>
>my $s=SOAP::Lite->uri("http://soap.somewhere.net/Test/Test";)->
> proxy("http://localhost:8012";);
>
>my $a=$s->foo;
>print $a->faultstring."\n";
>print $a->result;
>$a=$s->bar;
>print $a->faultstring."\n";
>print $a->result;
>---------------------------------
>
>The client program prints out this:
>
>This is a foo
>Failed to locate method (bar) in class (Test::Test) at
>/usr/lib/perl5/site_perl/5.6.1/SOAP/Lite.pm line 2195.
>
>A slightly related problem is I was expecting to be able to return objects
>and call them almost as normal objects (even though they are remote) but
it
>seems I have to create a SOAP::Lite object and pass my object as the first
>argument to any function calls. Ie instead of:
>
>my $myob=$remoteserver->createObject();
>print $myob->foo();
>
>I have to do
>
>my $myob=$remoteserver->createObject();
>my $soapcall=SOAP::Lite->uri("http://soap.somewhere.net/Myob";)->
> proxy("http://blah.net/";);
>print $soapcall->foo($myob)->result;
>
>I think I may be suffering from a fatal misunderstanding about how
>everything fits together so any help or in depth examples involving
>multiple classes and inheritance would be really useful.
>
>My biggest problem is when I was using autodispatch everything appeared to
>just work but now I need to talk to multiple soap servers in one piece of
>code so autodispatch no longer seems sensiable.
>
>Thanks in advance.
>
>
>--
>Paul Hirst, Virus Researcher Sophos Anti-Virus
>email: paul.hirst@xxxxxxxxxx http://www.sophos.com
>
>You can read messages from the SOAP archive, unsubscribe from SOAP, or
subscribe to other
>DevelopMentor lists at http://discuss.develop.com.

You can read messages from the SOAP archive, unsubscribe from SOAP, or
subscribe to other
DevelopMentor lists at http://discuss.develop.com.



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise