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

Class::method() works but, $cref->method() stopped working

Expand Messages
  • jitendra_vaidya
    Hi SOAP::Lite members, I have been using a soap lite based service for the last three years at my company s website without any problems. Yesterday, when I
    Message 1 of 1 , Jul 10 10:54 AM
    • 0 Attachment
      Hi SOAP::Lite members,

      I have been using a soap lite based service for the last three
      years at my company's website without any problems. Yesterday, when I
      tried the service (after a few month's gap), I observed the follwing:

      Calls on remote objects using object names work correctly, but calls
      made using object references have suddenly stopped working.

      So, this works:

      Class::method();

      But this does not:

      $cref = new Class(); # this line works
      $cref->method(); # this line produces the following error:

      # faultcode: SOAP-ENV:Client
      # faultstring: Denied access to method (setValue) in class (TestSOAP)
      #at /usr/lib/perl5/site_perl/5.6.1/SOAP/Lite.pm line 2267.

      Here is the more relevent info about my setup:

      Client: 'SOAP::Lite/Perl/0.51',
      SOAPServer: 'SOAP::Lite/Perl/0.60'
      SERVER_SOFTWARE : 'Apache/1.3.33 (Unix) mod_auth_passthrough/1.8
      mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635
      mod_ssl/2.8.22 OpenSSL/0.9.6b PHP-CGI/0.1b',

      I have reduced the problem to a testcase and included the following
      with my post:

      1. test_server.pl
      2. TestSOAP.pm
      3. test_client.pl
      4. Environment variables as seen by the server

      Since my code (either on client or server) did not change, I suspect
      that this is caused by some change in the environment at
      my ISP's set up. Unfortunately, I can not access the httpd.conf file.
      Any pointers about what I should be looking at or why this might be
      happening would be very much appreciated. I searched through the
      archives but could not find anything that helped.

      Thanks,
      Jiten

      #==================== test_server.pl =========================
      my $soap_path = "/home/MY_COMPANY/www/cgi-bin/service/lib";
      require SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to($soap_path)
      -> handle;

      #===================== TestSOAP.pm ===========================
      package TestSOAP;

      sub new {
      bless {}, shift;
      };

      sub getValue
      {
      my $self = shift;
      return $self->{Val};
      }

      sub setValue
      {
      my $self = shift;
      return $self->{Val} = shift;
      }

      sub getEnv
      {
      my $env = {};
      %$env = %ENV;
      return $env;
      }

      1;

      #==================== test_client.pl =========================

      use Data::Dumper;
      use SOAP::Lite +trace => all;
      use SOAP::Lite +autodispatch =>
      uri=>"TestSOAP",
      proxy=>"http://www.MY_COMPANY.com/cgi-
      bin/service/bin/test_server.pl";
      on_fault=>\&handle_soap_fault;

      # demonstrate that calls made without ref work correctly
      # this block works and prints out server-side env
      my $senv = TestSOAP::getEnv();
      print Dumper $senv;

      # the following block used to print out "Good"
      # Now the first line works, the second line gives the following error
      # faultcode: SOAP-ENV:Client
      # faultstring: Denied access to method (setValue) in class (TestSOAP)
      #at /usr/lib/perl5/site_perl/5.6.1/SOAP/Lite.pm line 2267.

      my $ts = new TestSOAP();
      $ts->setValue("Good");
      print $ts->getValue(); print "\n";

      # end of main

      sub handle_soap_fault
      {
      my($soap, $res) = @_;
      my $content = $soap->{'_call'}{'_content'};
      my $ehash = ${$content}[$#{$content}];
      my $fc = $ehash->{'Body'}->{'Fault'}->{'faultcode'};
      my $fs = $ehash->{'Body'}->{'Fault'}->{'faultstring'};
      print "faultcode: $fc\n";
      print "faultstring: $fs\n";
      die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
      }



      ================= environment variables on server ===================

      $VAR1 = {
      'QUERY_STRING' => '',
      'SERVER_ADDR' => '66.78.26.16',
      'CONTENT_TYPE' => 'text/xml; charset=utf-8',
      'SERVER_PROTOCOL' => 'HTTP/1.0',
      'REMOTE_PORT' => '4332',
      'HTTP_ACCEPT' => 'text/xml, multipart/*',
      'HTTP_USER_AGENT' => 'SOAP::Lite/Perl/0.51',
      'HTTP_HOST' => 'www.MY_COMPANY.com',
      'GATEWAY_INTERFACE' => 'CGI/1.1',
      'SERVER_ADMIN' => 'webmaster@MY_COMPANY.com',
      'SERVER_SOFTWARE' => 'Apache/1.3.33 (Unix)
      mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4
      FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.6b PHP-CGI/0.1b',
      'REMOTE_ADDR' => '67.123.173.118',
      'SCRIPT_NAME' => '/cgi-bin/service/bin/test_server.pl',
      'SERVER_NAME' => 'www.MY_COMPANY.com',
      'DOCUMENT_ROOT' => '/home/MY_COMPANY/public_html',
      'REQUEST_URI' => '/cgi-bin/service/bin/test_server.pl',
      'HTTP_SOAPACTION' => '"/TestSOAP#getEnv"',
      'SCRIPT_FILENAME' => '/home/MY_COMPANY/public_html/cgi-
      bin/service/bin/t
      est_server.pl',
      'REQUEST_METHOD' => 'POST',
      'CONTENT_LENGTH' => '435',
      'PATH' => '/usr/local/bin:/usr/bin:/bin',
      'SERVER_PORT' => '80'
      };
    Your message has been successfully submitted and would be delivered to recipients shortly.