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

SOAP::Lite fault doesn't report misspelled srvc as expected

Expand Messages
  • Bill.Costa@alumni.unh.edu
    Folks, In a Tech Republic article: http://articles.techrepublic.com.com/5100-10878_11-1052448.html the author describes the free fault detection you get with
    Message 1 of 1 , Feb 12, 2009
    • 0 Attachment
      Folks,

      In a Tech Republic article:

      http://articles.techrepublic.com.com/5100-10878_11-1052448.html

      the author describes the 'free' fault detection you get with
      SOAP::Lite, including:

      "...if someone were to invoke a method that wasn't defined in
      the dispatch handler, SOAP::Lite would return SOAP Fault with
      a fault string that said something like Failed To Locate
      Method (Foo) In Class (Echo)."

      This is exactly the sort of behavior I expected. But in my
      simple test, I try to first call an existing service (works fine)
      then call an non-existing one, and the error comes back that
      suddenly it can't find the class it successfully used in the
      first call. I am very confused. Any ideas what silly thing I'm
      doing wrong?

      server: 0.710.08
      client: 0.69

      Thanks in advance for any clues.

      ...BC

      -- server -- -- -- -- -- -- --

      #!/usr/bin/perl
      #
      # A super simple SOAP service.

      use warnings;
      use strict;
      use SOAP::Transport::HTTP;
      use Sys::Hostname;

      my $thisHost = hostname();

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

      package Demo;

      sub hi { return "$thisHost sez: hello, world" }

      1;

      -- client -- -- -- -- -- -- --

      #!/usr/bin/perl

      # Super simple client for a super simple service.

      use warnings;
      use strict;
      use SOAP::Lite;

      my $soap =
      SOAP::Lite -> uri('https://riddle.unh.edu/Demo')
      -> proxy('https://riddle.unh.edu/cgi-bin/SOAP/hibye.cgi');

      my $rtrn; # The result object returned from remote call.

      $rtrn = $soap->hi(); # A real service
      if (not $rtrn->fault())
      {
      print($rtrn->result(), "\n");
      }
      else
      {
      print(" faultcode = ", $rtrn->faultcode, "\n",
      " faultstring = ", $rtrn->faultstring, "\n",
      " faultactor = ", $rtrn->faultactor, "\n",
      " faultdetail = ", $rtrn->faultdetail, "\n",
      );
      }

      $rtrn = $soap->hello(); # A non-service
      if (not $rtrn->fault())
      {
      print($rtrn->result(), "\n");
      }
      else
      {
      print(" faultcode = ", $rtrn->faultcode, "\n",
      " faultstring = ", $rtrn->faultstring, "\n",
      " faultactor = ", $rtrn->faultactor, "\n",
      " faultdetail = ", $rtrn->faultdetail, "\n",
      );
      }

      -- output -- -- -- -- -- -- --

      $ ./simple-client.pl
      riddle.unh.edu sez: hello, world
      faultcode = soap:Client
      faultstring = Failed to access class (Demo):
      Can't locate Demo.pm in
      @INC (@INC contains: /usr/l .... etc ....

      faultactor =
      faultdetail =


      --
      +-------------------------[ Bill.Costa@... ]---+
      | Bill Costa | No good
      | 1 Leavitt Lane Voice: | deed...
      | CIS/Telecom -- 2nd Floor +1-603-862-3056 |
      | University of New Hampshire | Goes
      | Durham, NH 03824 USA | unpunished.
      +---------------[ http://pubpages.unh.edu/~wfc/ ]--+
    Your message has been successfully submitted and would be delivered to recipients shortly.