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

unable to 'use' other classes in dispatched class.

Expand Messages
  • iordy@iordy.com
    I m very new to SOAP::Lite but when I try to use another class (i.e Data::Dumper) in my dispatched class I generate the faultstring: Denied access to method
    Message 1 of 2 , Feb 23, 2003
    • 0 Attachment
      I'm very new to SOAP::Lite but when I try to 'use' another class (i.e
      Data::Dumper) in my dispatched class I generate the faultstring:
      "Denied access to method (foo) in class (bar) at
      /usr/share/perl5/SOAP/Lite.pm". If I comment out the 'use' statement the
      class works as expected.

      I printed out @INC inside my class at runtime and all the paths are there so
      I do not understand why SOAP is doing this to me. I've read through all the
      documentation I could find but I still havn't had any luck resolving this.

      BTW, I've used SOAP::Transport::TCP::Server and
      SOAP::Transport::HTTP::Apache and both still give the same result.

      Any help would be great,

      Shane.



      SERVER:
      #!/usr/bin/perl -w
      use strict;

      use SOAP::Transport::TCP;

      my $daemon = SOAP::Transport::TCP::Server
      ->new (LocalAddr => 'localhost', LocalPort => 82, Listen => 5, Reuse
      => 1) # ->objects_by_reference(qw())
      ->dispatch_to('/mnt/hda5/www/soap.iordy.com/services/');
      $daemon->handle;

      1;

      SERVICE:
      package woot;

      use strict;
      use warnings;

      use Exporter;
      use Data::Dumper;

      use vars qw(@ISA @EXPORT);
      @ISA = qw(Exporter);
      @EXPORT = qw(woot);

      sub woot {
      my $msg = shift;

      if ($msg) {
      return $msg x 4;
      }

      return "no message";
      }

      1;

      CLIENT:
      #!/usr/bin/perl -w

      use strict;
      use warnings;

      use SOAP::Lite; #qw(trace);

      my $soap = SOAP::Lite->proxy('tcp://127.0.0.1:82/');
      $soap->uri('urn:/woot');

      my $result = $soap->woot('woot');

      unless ($result->fault) {
      print 'woot: ',$result->result();
      } else {
      print join ', ',
      $result->faultcode,
      $result->faultstring,
      $result->faultdetail;
      }
    • techrg99 <bhess@techrg.com>
      I ran into this problem and one way I found to make a script that has a use statement in it is to include it in startup.pl For example - if your httpd.conf
      Message 2 of 2 , Feb 23, 2003
      • 0 Attachment
        I ran into this problem and one way I found to make a script that has
        a 'use' statement in it is to include it in startup.pl

        For example - if your httpd.conf looks like:

        PerlRequire conf/startup.pl

        <Location /soap>
        SetHandler perl-script
        PerlHandler Apache::SOAP
        PerlSetVar dispatch_to "C:/www/soap"
        PerlSetVar options "compress_threshold => 10000"
        </Location>

        Then startup.pl:

        BEGIN {
        use Apache ();
        }

        use Apache::Constants ();
        use DBI; # Or whatever module(s) you want to use...

        1;



        Like I said this is one way that I have figured - there are probably
        others - Hope this helps...
      Your message has been successfully submitted and would be delivered to recipients shortly.