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

Re: [soaplite] Trying to get SOAP::Lite "hello world" working.

Expand Messages
  • Steven Hilton
    Eric, Thanks for the reply. Changing the dispatch_to() params as suggested does fix my problem. But this begs the question -- can I only dispatch to a single
    Message 1 of 4 , Mar 29, 2006
    • 0 Attachment
      Eric,

      Thanks for the reply.

      Changing the dispatch_to() params as suggested does fix my problem.
      But this begs the question -- can I only dispatch to a single class?
      If I am able to dispatch to multiple clases, how do I set that up?

      Hopefully I can try out Apache::SOAP.

      Thanks again.

      - Steven

      On 29 Mar 2006 13:14:16 -0500, Eric Bridger <eric@...> wrote:
      > Steven,
      >
      > I'm trying to remember the details but I ran into some very similar
      > problems when first starting out with SOAP::Lite and mod_perl cgi.
      >
      > I'm thinking that your My::Test.pm module cannot be defined inside your
      > cgi script and you must use something like:
      >
      > -> dispatch_to('/home/shilton/shared/test', 'My::Test')
      >
      > But really I don't remember exactly what the issue was. I did finally
      > get CGI mode working but switched to Apache::SOAP long ago. Much
      > speedier using something like:
      >
      > <LocationMatch /soap/mytest$>
      > SetHandler perl-script
      > PerlHandler Apache::SOAP
      > PerlSetVar dispatch_to "/home/shilton/shared/test, My::Test"
      > PerlSetVar options "compress_threshold => 10000"
      > </LocationMatch>
      >
      >
      >
      >
      >
      >
      > On Wed, 2006-03-29 at 12:25, Steven Hilton wrote:
      > > Greetings,
      > >
      > > I'm trying to get a hello world app working with SOAP::Lite. As a
      > > straight cgi, it seems to work as expected.
      > >
      > > But under mod_perl, whether as a straight handler or through
      > > Apache::Registry, it seems to fail when the same httpd process is hit
      > > a second time. I'm not sure what I'm doing wrong.
      > >
      > > The *first* time a process is hit, I get expected output. On all
      > > subsequent hits to the same PID, I get unexpected behavior.
      > >
      > > When I turns +trace => 'debug' on, the non-first PID hits have this as
      > > a fault string:
      > >
      > > [...] <faultstring>Denied access to method (hello) in class (My::Test)
      > > at [path to]/lib/site_perl/5.8.3/SOAP/Lite.pm line 2267.
      > > </faultstring> [...]
      > >
      > > I'm not sure why it works on the first PID hit, but not subsequent
      > > ones. I'm currently reading a lot of docs on SOAP::Lite
      > > (http://cookbook.soaplite.com/ ,http://guide.soaplite.com/
      > > http://search.cpan.org/dist/SOAP-Lite/lib/OldDocs/SOAP/Lite.pm and
      > > others) but I'm hoping to get some assistance on this simple hello
      > > world thing.
      > >
      > > I haven't tried (yet) to define the Module and method name of during
      > > the 'use SOAP::Lite' line because (a) it *does* work on the first
      > > PID-hit and (b) I haven't seen syntax to include muliple modules and
      > > methods in one declaration. I really just want to include a path, so
      > > that anything dropped there will be publicly available.
      > >
      > > Any advice will be greatly appreciated. Thanks.
      > >
      > > Here's the set up:
      > >
      > > SERVER:
      > > script:
      > > --------------------
      > > #!/usr/perl/bin/perl -w
      > > use strict;
      > > # $Id$
      > > use lib "/home/shilton/shared/test";
      > >
      > > use SOAP::Transport::HTTP;
      > > use Data::Dumper;
      > > warn "$$ ---->";
      > > SOAP::Transport::HTTP::CGI->dispatch_to(
      > > '/home/shilton/shared/test',
      > > )->handle();
      > > 1;
      > > ----------------------
      > >
      > >
      > > module:
      > > --------------
      > > package My::Test;
      > >
      > > use strict;
      > > my $count = 0;
      > > sub hello {$count++; return "hello... $$ . $count"};
      > > 1;
      > > ---------------
      > >
      > >
      > > CLIENT: soap_test.pl
      > > ---------------------------
      > > #!/nm/sw/perl/bin/perl -w
      > > use strict;
      > > use Data::Dumper;
      > > use SOAP::Lite +trace => 'debug', +autodispatch =>
      > > #use SOAP::Lite +autodispatch =>
      > > uri => 'http://localhost/',
      > > proxy => 'http://shilton-red-preview.apps.nandomedia.com/api-bin/soap.cgi'
      > > ;
      > > my $t;
      > > $t = My::Test->hello();
      > > warn Dumper $t;
      > >
      > >
      > > httpd.conf:
      > > ---------------------------------
      > > ScriptAlias /api-bin /home/shilton/shared/test/api-bin
      > > <Location /api-bin>
      > > SetHandler perl-script
      > > #PerlHandler NM::Registration::API::SOAP
      > > PerlHandler Apache::Registry
      > > </Location>
      > > ---------------------------------
      > >
      > > After a fresh restart of apache, this is the results:
      > > client output:
      > >
      > > $VAR1 = 'hello... 21671 . 1';
      > > $VAR1 = 'hello... 21672 . 1';
      > > $VAR1 = 'hello... 21673 . 1';
      > > $VAR1 = 'hello... 21674 . 1';
      > > $VAR1 = undef;
      > > $VAR1 = undef;
      > > $VAR1 = undef;
      > > $VAR1 = undef;
      > > $VAR1 = undef;
      > > $VAR1 = undef;
      > > $VAR1 = undef;
      > >
      > >
      > > server output:
      > > 21671 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21672 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21673 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21674 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21671 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21672 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21673 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21674 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21671 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21672 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > > 21673 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
      > >
      > >
      > >
      > > --
      > > Steven Hilton <mshiltonj@...>
      > > <http://mshiltonj.com/>
      > >
      > > "It is the duty of the patriot to protect
      > > his country from its government." -- Thomas Paine
      > >
      > >
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      > >
      > >
      >
      >
      >


      --
      Steven Hilton <mshiltonj@...>
      <http://mshiltonj.com/>

      "It is the duty of the patriot to protect
      his country from its government." -- Thomas Paine
    • Eric Bridger
      I believe dispatch_to can work a number of ways: - dispatch_to( /path/to/your/modules ); Will give access to all the modules at that dir.
      Message 2 of 4 , Mar 29, 2006
      • 0 Attachment
        I believe dispatch_to can work a number of ways:
        ->dispatch_to('/path/to/your/modules'); Will give access to all the
        modules at that dir.
        ->dispatch_to('/path/to/your/modules', My:Module, My::Module2, etc.);
        Give access to Module and Module2, etc in that dir.
        ->dispatch_to(Module, Module2, Module3);
        Give access to Module, Module2 and Module3. Need to be in your @INC.

        On Wed, 2006-03-29 at 13:36, Steven Hilton wrote:
        > Eric,
        >
        > Thanks for the reply.
        >
        > Changing the dispatch_to() params as suggested does fix my problem.
        > But this begs the question -- can I only dispatch to a single class?
        > If I am able to dispatch to multiple clases, how do I set that up?
        >
        > Hopefully I can try out Apache::SOAP.
        >
        > Thanks again.
        >
        > - Steven
        >
        > On 29 Mar 2006 13:14:16 -0500, Eric Bridger <eric@...> wrote:
        > > Steven,
        > >
        > > I'm trying to remember the details but I ran into some very similar
        > > problems when first starting out with SOAP::Lite and mod_perl cgi.
        > >
        > > I'm thinking that your My::Test.pm module cannot be defined inside your
        > > cgi script and you must use something like:
        > >
        > > -> dispatch_to('/home/shilton/shared/test', 'My::Test')
        > >
        > > But really I don't remember exactly what the issue was. I did finally
        > > get CGI mode working but switched to Apache::SOAP long ago. Much
        > > speedier using something like:
        > >
        > > <LocationMatch /soap/mytest$>
        > > SetHandler perl-script
        > > PerlHandler Apache::SOAP
        > > PerlSetVar dispatch_to "/home/shilton/shared/test, My::Test"
        > > PerlSetVar options "compress_threshold => 10000"
        > > </LocationMatch>
        > >
        > >
        > >
        > >
        > >
        > >
        > > On Wed, 2006-03-29 at 12:25, Steven Hilton wrote:
        > > > Greetings,
        > > >
        > > > I'm trying to get a hello world app working with SOAP::Lite. As a
        > > > straight cgi, it seems to work as expected.
        > > >
        > > > But under mod_perl, whether as a straight handler or through
        > > > Apache::Registry, it seems to fail when the same httpd process is hit
        > > > a second time. I'm not sure what I'm doing wrong.
        > > >
        > > > The *first* time a process is hit, I get expected output. On all
        > > > subsequent hits to the same PID, I get unexpected behavior.
        > > >
        > > > When I turns +trace => 'debug' on, the non-first PID hits have this as
        > > > a fault string:
        > > >
        > > > [...] <faultstring>Denied access to method (hello) in class (My::Test)
        > > > at [path to]/lib/site_perl/5.8.3/SOAP/Lite.pm line 2267.
        > > > </faultstring> [...]
        > > >
        > > > I'm not sure why it works on the first PID hit, but not subsequent
        > > > ones. I'm currently reading a lot of docs on SOAP::Lite
        > > > (http://cookbook.soaplite.com/ ,http://guide.soaplite.com/
        > > > http://search.cpan.org/dist/SOAP-Lite/lib/OldDocs/SOAP/Lite.pm and
        > > > others) but I'm hoping to get some assistance on this simple hello
        > > > world thing.
        > > >
        > > > I haven't tried (yet) to define the Module and method name of during
        > > > the 'use SOAP::Lite' line because (a) it *does* work on the first
        > > > PID-hit and (b) I haven't seen syntax to include muliple modules and
        > > > methods in one declaration. I really just want to include a path, so
        > > > that anything dropped there will be publicly available.
        > > >
        > > > Any advice will be greatly appreciated. Thanks.
        > > >
        > > > Here's the set up:
        > > >
        > > > SERVER:
        > > > script:
        > > > --------------------
        > > > #!/usr/perl/bin/perl -w
        > > > use strict;
        > > > # $Id$
        > > > use lib "/home/shilton/shared/test";
        > > >
        > > > use SOAP::Transport::HTTP;
        > > > use Data::Dumper;
        > > > warn "$$ ---->";
        > > > SOAP::Transport::HTTP::CGI->dispatch_to(
        > > > '/home/shilton/shared/test',
        > > > )->handle();
        > > > 1;
        > > > ----------------------
        > > >
        > > >
        > > > module:
        > > > --------------
        > > > package My::Test;
        > > >
        > > > use strict;
        > > > my $count = 0;
        > > > sub hello {$count++; return "hello... $$ . $count"};
        > > > 1;
        > > > ---------------
        > > >
        > > >
        > > > CLIENT: soap_test.pl
        > > > ---------------------------
        > > > #!/nm/sw/perl/bin/perl -w
        > > > use strict;
        > > > use Data::Dumper;
        > > > use SOAP::Lite +trace => 'debug', +autodispatch =>
        > > > #use SOAP::Lite +autodispatch =>
        > > > uri => 'http://localhost/',
        > > > proxy => 'http://shilton-red-preview.apps.nandomedia.com/api-bin/soap.cgi'
        > > > ;
        > > > my $t;
        > > > $t = My::Test->hello();
        > > > warn Dumper $t;
        > > >
        > > >
        > > > httpd.conf:
        > > > ---------------------------------
        > > > ScriptAlias /api-bin /home/shilton/shared/test/api-bin
        > > > <Location /api-bin>
        > > > SetHandler perl-script
        > > > #PerlHandler NM::Registration::API::SOAP
        > > > PerlHandler Apache::Registry
        > > > </Location>
        > > > ---------------------------------
        > > >
        > > > After a fresh restart of apache, this is the results:
        > > > client output:
        > > >
        > > > $VAR1 = 'hello... 21671 . 1';
        > > > $VAR1 = 'hello... 21672 . 1';
        > > > $VAR1 = 'hello... 21673 . 1';
        > > > $VAR1 = 'hello... 21674 . 1';
        > > > $VAR1 = undef;
        > > > $VAR1 = undef;
        > > > $VAR1 = undef;
        > > > $VAR1 = undef;
        > > > $VAR1 = undef;
        > > > $VAR1 = undef;
        > > > $VAR1 = undef;
        > > >
        > > >
        > > > server output:
        > > > 21671 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21672 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21673 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21674 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21671 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21672 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21673 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21674 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21671 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21672 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > > 21673 ----> at /home/shilton/shared/test/api-bin/soap.cgi line 7.
        > > >
        > > >
        > > >
        > > > --
        > > > Steven Hilton <mshiltonj@...>
        > > > <http://mshiltonj.com/>
        > > >
        > > > "It is the duty of the patriot to protect
        > > > his country from its government." -- Thomas Paine
        > > >
        > > >
        > > >
        > > > Yahoo! Groups Links
        > > >
        > > >
        > > >
        > > >
        > > >
        > >
        > >
        > >
        >
        >
        > --
        > Steven Hilton <mshiltonj@...>
        > <http://mshiltonj.com/>
        >
        > "It is the duty of the patriot to protect
        > his country from its government." -- Thomas Paine
      Your message has been successfully submitted and would be delivered to recipients shortly.