Loading ...
Sorry, an error occurred while loading the content.

3343Apache, mod_perl and objects_by_reference

Expand Messages
  • Andre Bonhote
    Feb 5, 2004
    • 0 Attachment
      Hi!

      This might be a very stupid question, but I didn't find the answer to it
      anywhere. I have problems using remote objects by reference using
      Apache's mod_perl. I am able to create the object, but as soon as I want
      to access methods in it it says 'Object with specific id not found'.
      That's my test setup:

      - Mac OS X 10.3
      - Apache 1.3.29 from source
      - mod_perl 1.29 from source
      - SOAP::Lite 0.55
      - These lines inside httpd.conf:

      --->8---
      <Location /soap>
      SetHandler perl-script
      PerlHandler SOAP::Apache
      </Location>
      --->8---

      - inside @INC, I created a dir called SOAP and placed this Apache.pm
      into it:

      --->8---
      package SOAP::Apache;
      use SOAP::Transport::HTTP;
      my $server = SOAP::Transport::HTTP::Apache
      -> objects_by_reference(qw(A::Test))
      -> dispatch_to(qw(/Users/andre/sec/dev/soap A::Test A::Test::new A::Test::test))
      -> options({compress_threshold => 10000})
      ;
      sub handler { $server->handler(@_) }
      1;
      --->8---

      - In /Users/andre/sec/dev/soap, there's a directory called 'A' with
      this simple piece inside:

      --->8---
      package A::Test;

      use Class::MethodMaker
      get_set => [qw(
      test
      )],
      new => 'new';

      1;
      --->8---

      - After a restart of Apache, I try this code:

      --->8---
      se strict;
      use Data::Dumper;
      use SOAP::Lite +autodispatch =>
      uri => 'http://www.soaplite.com/',
      proxy => 'http://localhost/soap',
      on_fault => sub { my($soap, $res) = @_;
      print Dumper($res);
      die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
      }
      ;

      my $p = A::Test->SOAP::new; # same thing remotely
      $p->SOAP::test(100); ## [1]
      print $p->SOAP::test(); ## [2]
      print Dumper($p);
      --->8---

      (you might know these code fragments, they are almost 1:1 out of the
      User's guide)

      Now, commenting out the two lines [1] and [2], the output of $p looks
      good IMHO:

      ---8<---
      $VAR1 = bless( {
      'id' => '10759909909814200'
      }, 'A::Test' );

      ---8<---

      But as soon as I want to access the method 'test', it doesn't work
      anymore. SOAP::Lite calls the on_fault coderef and dumps $res, which
      shows (among other things) this:

      'faultstring' => 'Failed to locate method (new) in class (A::Test) at
      /Library/Perl/5.8.1/SOAP/Lite.pm line 2195.


      Ok, now flame me. What am I doing wrong? I checked the mailing list's
      archive, without success. Has anyone had the same problem and resolved
      it?

      Almost the same pieces of code work fine, without any problem, when I
      create a standalone http daemon, like the ./examples/soap.daemon thing.
      No problem at all.

      Any hints? Rants?

      Thanks a lot in advance!

      André

      --
      :(){ :|:&};:
    • Show all 3 messages in this topic