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

SOAP::Lite hack for compatibility of mod_perl2

Expand Messages
  • Michael Stepanov
    I ve ported my application from Apache1 to Apache2 and I ve needed to change all code where I called mod_per1 API. Also, I ve hacked module
    Message 1 of 3 , Oct 27, 2003
    • 0 Attachment
      I've ported my application from Apache1 to Apache2 and I've needed to
      change all code where I called mod_per1 API.
      Also, I've hacked module SOAP::Lite::Transport::HTTP because it uses
      mod_perl1 API.
      I'd like to suggest you my patch. Of couse, I understand that it isn't
      good way. It will be better to include compatibility with both version
      of mod_perl. But I hope that my patch will help someone as temporary
      solution for migration to Apache2.

      --- /usr/lib/perl5/site_perl/5.8.0/SOAP/Transport/HTTP.pm
      2002-04-16 07:43:02.000000000 +0300
      +++ HTTP.pm 2003-10-24 14:00:22.000000000 +0300
      @@ -409,7 +409,7 @@

      sub DESTROY { SOAP::Trace::objects('()') }

      -sub new { require Apache; require Apache::Constants;
      +sub new { require Apache2; require Apache::Const;
      my $self = shift;

      unless (ref $self) {
      @@ -421,13 +421,14 @@
      }

      sub handler {
      + use Apache::Const qw(OK);
      my $self = shift->new;
      my $r = shift || Apache->request;
      $self->request(HTTP::Request->new(
      $r->method => $r->uri,
      HTTP::Headers->new($r->headers_in),
      - do { my $buf; $r->read($buf, $r->header_in('Content-length'));
      $buf; }
      + do { my $buf; $r->read($buf,
      $r->headers_in->get('Content-length')); $buf; }
      ));
      $self->SUPER::handle;

      @@ -438,10 +439,10 @@
      # will emulate normal response, but with custom status code
      # which could also be 500.
      $r->status($self->response->code);
      - $self->response->headers->scan(sub { $r->header_out(@_) });
      + $self->response->headers->scan(sub { $r->headers_out->set(@_) });
      $r->send_http_header(join '; ', $self->response->content_type);
      $r->print($self->response->content);
      - &Apache::Constants::OK;
      + OK;
      }

      sub configure {
    • rcalosso
      I tried to apply this patch to my SOAP::Lite (60a) and am getting Can t locate object method send_http_header via package Apache:RequestRec with the
      Message 2 of 3 , May 6 10:12 PM
      • 0 Attachment
        I tried to apply this patch to my SOAP::Lite (60a) and am getting
        Can't locate object method "send_http_header" via package
        Apache:RequestRec" with the following:

        $r->send_http_header(join ';',$self->resonse->content_type);

        line around # 475

        Can anyone help me with the patches needed to get SOAP::Lite to work
        with mod_perl 1.99.xx.

        Thanks


        --- In soaplite@yahoogroups.com, "Michael Stepanov"
        <nite_man_2001@y...> wrote:
        > I've ported my application from Apache1 to Apache2 and I've needed
        to
        > change all code where I called mod_per1 API.
        > Also, I've hacked module SOAP::Lite::Transport::HTTP because it
        uses
        > mod_perl1 API.
        > I'd like to suggest you my patch. Of couse, I understand that it
        isn't
        > good way. It will be better to include compatibility with both
        version
        > of mod_perl. But I hope that my patch will help someone as
        temporary
        > solution for migration to Apache2.
        >
        > --- /usr/lib/perl5/site_perl/5.8.0/SOAP/Transport/HTTP.pm
        > 2002-04-16 07:43:02.000000000 +0300
        > +++ HTTP.pm 2003-10-24 14:00:22.000000000 +0300
        > @@ -409,7 +409,7 @@
        >
        > sub DESTROY { SOAP::Trace::objects('()') }
        >
        > -sub new { require Apache; require Apache::Constants;
        > +sub new { require Apache2; require Apache::Const;
        > my $self = shift;
        >
        > unless (ref $self) {
        > @@ -421,13 +421,14 @@
        > }
        >
        > sub handler {
        > + use Apache::Const qw(OK);
        > my $self = shift->new;
        > my $r = shift || Apache->request;
        > $self->request(HTTP::Request->new(
        > $r->method => $r->uri,
        > HTTP::Headers->new($r->headers_in),
        > - do { my $buf; $r->read($buf, $r->header_in('Content-length'));
        > $buf; }
        > + do { my $buf; $r->read($buf,
        > $r->headers_in->get('Content-length')); $buf; }
        > ));
        > $self->SUPER::handle;
        >
        > @@ -438,10 +439,10 @@
        > # will emulate normal response, but with custom status code
        > # which could also be 500.
        > $r->status($self->response->code);
        > - $self->response->headers->scan(sub { $r->header_out(@_) });
        > + $self->response->headers->scan(sub { $r->headers_out->set
        (@_) });
        > $r->send_http_header(join '; ', $self->response->content_type);
        > $r->print($self->response->content);
        > - &Apache::Constants::OK;
        > + OK;
        > }
        >
        > sub configure {
      • blueswimhorse
        Hi rcalosso, I tried your patch too .. now i am getting .. Usage: Apache::RequestRec::read(r, bufsv, len, offset=0) at
        Message 3 of 3 , May 14 3:33 PM
        • 0 Attachment
          Hi rcalosso,

          I tried your patch too .. now i am getting ..

          Usage: Apache::RequestRec::read(r, bufsv, len, offset=0) at
          /usr/local/lib/perl5/site_perl/5.8.0/SOAP/Transport/HTTP.pm line 433

          cheers ..

          --- In soaplite@yahoogroups.com, "rcalosso" <rcalosso@y...> wrote:
          > I tried to apply this patch to my SOAP::Lite (60a) and am getting
          > Can't locate object method "send_http_header" via package
          > Apache:RequestRec" with the following:
          >
          > $r->send_http_header(join ';',$self->resonse->content_type);
          >
          > line around # 475
          >
          > Can anyone help me with the patches needed to get SOAP::Lite to work
          > with mod_perl 1.99.xx.
          >
          > Thanks
          >
          >
          > --- In soaplite@yahoogroups.com, "Michael Stepanov"
          > <nite_man_2001@y...> wrote:
          > > I've ported my application from Apache1 to Apache2 and I've needed
          > to
          > > change all code where I called mod_per1 API.
          > > Also, I've hacked module SOAP::Lite::Transport::HTTP because it
          > uses
          > > mod_perl1 API.
          > > I'd like to suggest you my patch. Of couse, I understand that it
          > isn't
          > > good way. It will be better to include compatibility with both
          > version
          > > of mod_perl. But I hope that my patch will help someone as
          > temporary
          > > solution for migration to Apache2.
          > >
          > > --- /usr/lib/perl5/site_perl/5.8.0/SOAP/Transport/HTTP.pm
          > > 2002-04-16 07:43:02.000000000 +0300
          > > +++ HTTP.pm 2003-10-24 14:00:22.000000000 +0300
          > > @@ -409,7 +409,7 @@
          > >
          > > sub DESTROY { SOAP::Trace::objects('()') }
          > >
          > > -sub new { require Apache; require Apache::Constants;
          > > +sub new { require Apache2; require Apache::Const;
          > > my $self = shift;
          > >
          > > unless (ref $self) {
          > > @@ -421,13 +421,14 @@
          > > }
          > >
          > > sub handler {
          > > + use Apache::Const qw(OK);
          > > my $self = shift->new;
          > > my $r = shift || Apache->request;
          > > $self->request(HTTP::Request->new(
          > > $r->method => $r->uri,
          > > HTTP::Headers->new($r->headers_in),
          > > - do { my $buf; $r->read($buf, $r->header_in('Content-length'));
          > > $buf; }
          > > + do { my $buf; $r->read($buf,
          > > $r->headers_in->get('Content-length')); $buf; }
          > > ));
          > > $self->SUPER::handle;
          > >
          > > @@ -438,10 +439,10 @@
          > > # will emulate normal response, but with custom status code
          > > # which could also be 500.
          > > $r->status($self->response->code);
          > > - $self->response->headers->scan(sub { $r->header_out(@_) });
          > > + $self->response->headers->scan(sub { $r->headers_out->set
          > (@_) });
          > > $r->send_http_header(join '; ', $self->response->content_type);
          > > $r->print($self->response->content);
          > > - &Apache::Constants::OK;
          > > + OK;
          > > }
          > >
          > > sub configure {
        Your message has been successfully submitted and would be delivered to recipients shortly.