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

Irregular message fault: Can't call method "body" without a package or object reference

Expand Messages
  • CristiAn Fuenzalida
    Hello :-), I m using SOAP::Lite/Perl/0.65_3, and i get with an irregular frequency the following message, when i execute the client:
    Message 1 of 2 , Oct 28, 2005
    • 0 Attachment
      Hello :-),

      I'm using SOAP::Lite/Perl/0.65_3, and i get with an "irregular frequency" the following message, when i execute the client:

      <?xml version="1.0" encoding="iso-8859-1"?><soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault>
      <faultcode>soap:Server</faultcode><faultstring>Can't call method "body" without a package or object reference at /home/devel/server.cgi line 113.
      </faultstring></soap:Fault></soap:Body></soap:Envelope>

      The client code is the following.

        my $content = SOAP::Data->name("content")->value("$_content")->type("string");
        my $soap = SOAP::Lite
          -> uri ('http://www.my_server.com/my_package')
          -> encoding('iso-8859-1')
          -> proxy('http://developer_site.com/server.cgi');
        my $som = $soap-> getValue($content);


      The server.cgi code where the problem ocurrs is:

       my $cgi_server = SOAP::Transport::HTTP::CGI
                      ->packager(SOAP::Packager::MIME->new)
                      -> dispatch_to('my_package);

        $cgi_server->serializer->encoding("ISO-8859-1");
        $cgi_server->handle;

        package my_package;
        use vars qw(@ISA);
        @ISA = qw(Exporter SOAP::Server::Parameters);

      sub getValue {
        my $class = shift;
        my $request = pop;
        my $body = $request->body->{getValue};   # HERE IS THE PROBLEM !!!
      ...
      }
      1;

      With an "irregular frequency" i mean that sometimes, the first 3 or 4 times i execute the client code it throws the error, but after that, if i execute the client again, i dont get the problem anymore, and the program executes succesfully !!

      Does anybody knows, what is this happening, and how to solve it ?


      Regards,


         CristiAn.
    • Duncan Cameron
      ... This might not be the cause of the problem but the @ISA assignment should be in a BEGIN block or the my_package package should be defined before the server
      Message 2 of 2 , Oct 28, 2005
      • 0 Attachment
        On 2005-10-28 at 13:51:47 CristiAn Fuenzalida wrote:

        >Hello :-),
        >
        >I'm using SOAP::Lite/Perl/0.65_3, and i get with an "irregular
        >frequency"

        ... snipped ...

        >The server.cgi code where the problem ocurrs is:
        >
        >my $cgi_server = SOAP::Transport::HTTP::CGI
        >->packager(SOAP::Packager::MIME->new)
        >-> dispatch_to('my_package);
        >
        >$cgi_server->serializer->encoding("ISO-8859-1");
        >$cgi_server->handle;
        >
        >package my_package;
        >use vars qw(@ISA);
        >@ISA = qw(Exporter SOAP::Server::Parameters);
        >
        >sub getValue {
        >my $class = shift;
        >my $request = pop;
        >my $body = $request->body->{getValue}; # HERE IS THE PROBLEM !!!
        >...
        >}
        >1;
        This might not be the cause of the problem but the @ISA assignment
        should be in a BEGIN block or the my_package package should be
        defined before the server code. Currently the @ISA statement will
        have been compiled but not have been executed when the getValue()
        method is called. Also, you don't need to use Exporter.

        Regards
        Duncan
      Your message has been successfully submitted and would be delivered to recipients shortly.