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

SOAP::Lite with mod_perl

Expand Messages
  • Larry Mulcahy
    Using SOAP::Lite 0.50, Perl 5.6.0 on a Solaris 8 box, I can get CGI SOAP::Lite servers to work. Example: The client, hello-client.perl: #!/usr/local/bin/perl
    Message 1 of 7 , Apr 23, 2001
    • 0 Attachment
      Using SOAP::Lite 0.50, Perl 5.6.0 on a Solaris 8 box, I can get
      CGI SOAP::Lite servers to work.

      Example:

      The client, hello-client.perl:

      #!/usr/local/bin/perl

      use SOAP::Lite;

      &main();

      sub main
      {
      my($response);
      my($proxy) = 'http://minime.ip.qwest.net/cgi-bin/hello-server.perl';
      my($result);

      # Optional command line argument giving a different proxy
      if ( $#ARGV == $[ )
      {
      $proxy = $ARGV[$[];
      }

      $response = SOAP::Lite
      ->uri('HELLO')
      ->proxy($proxy)
      ->HelloWorld();

      $result = $response->result();

      print "$result\n";
      }

      The server, hello-server.perl, installed in the CGI directory:

      #!/usr/local/bin/perl

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('HELLO')
      -> handle;

      package HELLO;

      ######################################################################
      #
      # HelloWorld
      #
      ######################################################################

      sub HelloWorld
      {
      my($class) = @_;

      return('Hello World');
      }

      I run hello-client.perl and it prints, 'Hello, World.'

      I would like to get this working using mod_perl. I have added the
      following to my Apache httpd.conf file:

      # SOAP::Apache

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

      I have created /usr/local/apache/lib/perl/Apache.pm containing:

      package SOAP::Apache;

      use SOAP::Transport::HTTP;

      my $server = SOAP::Transport::HTTP::Apache
      -> dispatch_to('/usr/local/apache/soaplite-modules')
      # enable compression support
      -> options({compress_threshold => 10000})
      ;

      sub handler { $server->handler(@_) }

      1;

      Mod_perl status shows /usr/local/apache/perl/lib to be in @INC.

      In /usr/local/apache/soaplite-modules I install
      mod_perl-hello-server.perl containing:

      #!/usr/local/bin/perl

      package HELLO;

      ######################################################################
      #
      # HelloWorld
      #
      ######################################################################

      sub HelloWorld
      {
      my($class) = @_;

      return('Hello World');
      }

      My client, mod_perl-hello-client.perl, looks like:

      use SOAP::Lite;

      &main();

      sub main
      {
      my($response);
      my($proxy) =
      'http://minime.ip.qwest.net/soaplite/mod_perl-hello-server.per
      l';
      my($result);

      # Optional command line argument giving a different proxy
      if ( $#ARGV == $[ )
      {
      $proxy = $ARGV[$[];
      }

      $response = SOAP::Lite
      ->uri('HELLO')
      ->proxy($proxy)
      ->HelloWorld();

      $result = $response->result();

      print "$result\n";
      }

      When I run this it fails with the error:

      500 unexpected EOF before status line seen
      at ./mod_perl-hello-client.perl line 19

      As this error occurs, a message like:

      [Mon Apr 23 11:06:33 2001] [notice] child pid 6739 exit signal Illegal
      Instruction (4)

      appears in the server log.

      Can someone give me a push in the right direction to get this
      working?

      I don't really understand what's supposed to go in Apache.pm, this
      doesn't seem to be very well documented.

      In Apache.pm, instead of just

      -> dispatch_to('/usr/local/apache/soaplite-modules')

      should I have

      -> dispatch_to('/usr/local/apache/soaplite-modules', 'HELLO')

      or

      -> dispatch_to('/usr/local/apache/soaplite-modules',
      HELLO::HelloWorld)?

      --
      Larry Mulcahy lmulcahy@...
      PGP public key at:
      http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
    • Larry Mulcahy
      ... This should have read, /usr/local/apache/lib/perl/SOAP/Apache.pm . -- Larry Mulcahy lmulcahy@qip.qwest.net PGP public key at:
      Message 2 of 7 , Apr 23, 2001
      • 0 Attachment
        Larry Mulcahy wrote:

        > I have created /usr/local/apache/lib/perl/Apache.pm containing:

        This should have read, '/usr/local/apache/lib/perl/SOAP/Apache.pm'.

        --
        Larry Mulcahy lmulcahy@...
        PGP public key at:
        http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
      • Philip Molter
        ... I m not sure if this is related to your problem or not, but I ve had Apache compiled with mod_perl crash on applications that use XML::Parser 2.30.
        Message 3 of 7 , Apr 23, 2001
        • 0 Attachment
          On Mon, Apr 23, 2001 at 11:18:54AM -0600, Larry Mulcahy wrote:
          : When I run this it fails with the error:
          :
          : 500 unexpected EOF before status line seen
          : at ./mod_perl-hello-client.perl line 19
          :
          : As this error occurs, a message like:
          :
          : [Mon Apr 23 11:06:33 2001] [notice] child pid 6739 exit signal Illegal
          : Instruction (4)
          :
          : appears in the server log.

          I'm not sure if this is related to your problem or not, but I've had
          Apache compiled with mod_perl crash on applications that use
          XML::Parser 2.30. Basically, Apache uses its own version of expat, and
          XML::Parser dynamically links to the system version of expat, confusing
          Apache and leading to the segfault. The solution is to compile Apache
          with --disable-rule=EXPAT.

          See if that works for you. Usually, a mod_perl segfault is related to
          a C-based module doing something wrong.

          Philip

          * Philip Molter
          * DataFoundry.net
          * http://www.datafoundry.net/
          * philip@...
        • Larry Mulcahy
          ... Thanks, I did that and it made the HTTP processes stop crashing and I was able to work the rest of the problem in a straightforward way. -- Larry Mulcahy
          Message 4 of 7 , Apr 23, 2001
          • 0 Attachment
            Philip Molter wrote:
            >
            > On Mon, Apr 23, 2001 at 11:18:54AM -0600, Larry Mulcahy wrote:
            > : When I run this it fails with the error:
            > :
            > : 500 unexpected EOF before status line seen
            > : at ./mod_perl-hello-client.perl line 19
            > :
            > : As this error occurs, a message like:
            > :
            > : [Mon Apr 23 11:06:33 2001] [notice] child pid 6739 exit signal Illegal
            > : Instruction (4)
            > :
            > : appears in the server log.
            >
            > ...The solution is to compile Apache
            > with --disable-rule=EXPAT.

            Thanks, I did that and it made the HTTP processes stop crashing
            and I was able to work the rest of the problem in a straightforward
            way.

            --
            Larry Mulcahy lmulcahy@...
            PGP public key at:
            http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
          • ekw1
            Can SOAP::Lite be used with mod_perl without using mod_soap? This is running under Apache 1.3.20/mod_perl 1.24/RedHat 7.2 (kernel 2.4.7). I have a perl script
            Message 5 of 7 , Mar 10, 2002
            • 0 Attachment
              Can SOAP::Lite be used with mod_perl without using mod_soap? This is
              running under Apache 1.3.20/mod_perl 1.24/RedHat 7.2 (kernel 2.4.7).

              I have a perl script that runs fine under regular CGI execution.
              When I try to run the same script through mod_perl handled by
              Apache::PerlRun, the log file shows that it segfaults and I don't
              where/how to debug this. As I understand it, Apache::PerlRun can run
              perl CGI scripts without modification.

              Here is the perl script, client.pl:
              ---begin
              #!/usr/bin/perl -w

              use strict;
              use SOAP::Lite;

              print "Content-Type: text/html\n\n";
              print SOAP::Lite
              -> uri('http://server/module)
              -> proxy('http://user:pw@server/cgi-bin/script.pl')
              -> func1()
              -> result;
              ---end

              Here is the contents of script.pl:
              ---begin
              #!/usr/bin/perl -w

              use SOAP::Transport::HTTP;

              SOAP::Transport::HTTP::CGI
              -> dispatch_to('/dir_to/soapmodules', 'module')
              -> handle;
              ---end

              And finally, here is the soap module itself, module.pm:
              ---begin
              package module;

              sub func1 {
              return "hello";
              }
              1;
              ---end

              Can anyone help me with this? All it does is make a SOAP call that
              returns a string. Under regular CGI execution, it returns "hello" as
              it should. Under mod_perl with Apache::PerlRun handler, it
              segfaults. Thanks for any help.

              Eric
            • Sam Tregar
              ... Yes. I got a PerlHandler using SOAP::Lite running with relative ease. ... Apache::PerlRun is a bit of a monstrosity. Try with Apache::Registry or write a
              Message 6 of 7 , Mar 10, 2002
              • 0 Attachment
                On Sun, 10 Mar 2002, ekw1 wrote:

                > Can SOAP::Lite be used with mod_perl without using mod_soap? This is
                > running under Apache 1.3.20/mod_perl 1.24/RedHat 7.2 (kernel 2.4.7).

                Yes. I got a PerlHandler using SOAP::Lite running with relative ease.

                > I have a perl script that runs fine under regular CGI execution.
                > When I try to run the same script through mod_perl handled by
                > Apache::PerlRun, the log file shows that it segfaults and I don't
                > where/how to debug this.

                Apache::PerlRun is a bit of a monstrosity. Try with Apache::Registry or
                write a real PerlHandler. I bet that will solve the problem.

                If not, it's gdb time! You'll have to build debugging versions of Apache,
                Perl and mod_perl. Then run your server single-process using "httpd -X"
                under gdb to catch the seg-fault.

                -sam
              • Paul Kulchenko
                Hi, ekw1! It coule also be problem with Expat and mod_perl. Take a look here:
                Message 7 of 7 , Mar 10, 2002
                • 0 Attachment
                  Hi, ekw1!

                  It coule also be problem with Expat and mod_perl. Take a look here:
                  http://theoryx5.uwinnipeg.ca/CPAN/data/SOAP-Lite/SOAP/Transport/HTTP.html#TROUBLESHOOTING

                  To make a quick check, you may disable XML::Parser with:

                  use SOAP::Lite;
                  $SOAP::Constants::DO_NOT_USE_XML_PARSER = 1;

                  on server side. Hope it helps.

                  Best wishes, Paul.

                  --- Sam Tregar <sam@...> wrote:
                  > On Sun, 10 Mar 2002, ekw1 wrote:
                  >
                  > > Can SOAP::Lite be used with mod_perl without using mod_soap?
                  > This is
                  > > running under Apache 1.3.20/mod_perl 1.24/RedHat 7.2 (kernel
                  > 2.4.7).
                  >
                  > Yes. I got a PerlHandler using SOAP::Lite running with relative
                  > ease.
                  >
                  > > I have a perl script that runs fine under regular CGI execution.
                  > > When I try to run the same script through mod_perl handled by
                  > > Apache::PerlRun, the log file shows that it segfaults and I don't
                  > > where/how to debug this.
                  >
                  > Apache::PerlRun is a bit of a monstrosity. Try with
                  > Apache::Registry or
                  > write a real PerlHandler. I bet that will solve the problem.
                  >
                  > If not, it's gdb time! You'll have to build debugging versions of
                  > Apache,
                  > Perl and mod_perl. Then run your server single-process using
                  > "httpd -X"
                  > under gdb to catch the seg-fault.
                  >
                  > -sam
                  >
                  >
                  >
                  > ------------------------ Yahoo! Groups Sponsor
                  >
                  > To unsubscribe from this group, send an email to:
                  > soaplite-unsubscribe@yahoogroups.com
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to
                  > http://docs.yahoo.com/info/terms/
                  >
                  >


                  __________________________________________________
                  Do You Yahoo!?
                  Try FREE Yahoo! Mail - the world's greatest free email!
                  http://mail.yahoo.com/
                Your message has been successfully submitted and would be delivered to recipients shortly.