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

3343Apache, mod_perl and objects_by_reference

Expand Messages
  • Andre Bonhote
    Feb 5, 2004

      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:

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

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

      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(@_) }

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

      package A::Test;

      use Class::MethodMaker
      get_set => [qw(
      new => 'new';


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

      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);

      (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:

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


      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

      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!


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