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

Error handling on Windows

Expand Messages
  • toddbfleming <tfleming@rrinc.com>
    I m new to SOAP and I keep running into problems with error handling. First a question: When does a function return a result? When does it return an SOM? Now
    Message 1 of 3 , Feb 11, 2003
    • 0 Attachment
      I'm new to SOAP and I keep running into problems with error handling.
      First a question:

      When does a function return a result? When does it return an SOM?

      Now to one of my problems: I can't get the error handling example
      (modified) in http://guide.soaplite.com/#error%20handling to work
      right under Windows 2000. I modified it to call an undefined function
      on my own server.

      If I run the client and server under Solaris everything works fine; I
      get this error message:

      SOAP-ENV:Client, Failed to locate method (c2f) in class
      (test::Callback) at /usr/local/lib/perl5/site_perl/5.8.0/SOAP/Lite.pm
      line 2195.

      If I run them under Windows 2000, I get this garbled error message:
      at c.pl line 7rver Error

      The server sends this response (similar on both Windows and Solaris):

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-
      ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-
      ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-
      ENV:Body><SOAP-ENV:Fault><faultcode xsi:type="xsd:string">SOAP-
      ENV:Client</faultcode><faultstring xsi:type="xsd:string">Failed to
      locate method (c2f) in class (test::Callback) at
      C:/usr/local/perl/site/lib/SOAP/Lite.pm line
      2195.</faultstring><faultactor
      xsi:type="xsd:string">http://goobers:2031/</faultactor></SOAP-
      ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

      ==============
      Client (c.pl)
      ==============
      #!/bin/perl

      use SOAP::Lite;
      $soap = SOAP::Lite
      -> uri('http://www.rrinc.com/test/Callback')
      -> proxy('http://localhost:2031');
      $result = $soap->c2f(37.5);
      unless ($result->fault)
      {
      print $result->result();
      } else
      {
      print join ', ',
      $result->faultcode,
      $result->faultstring;
      }

      =============
      Server (s.pl)
      =============
      #!/bin/perl

      use SOAP::Lite;
      use SOAP::Transport::HTTP;

      package test::Callback;

      sub CopyMessage
      {
      print "in CopyMessage: ", $_[1], "\n";
      $_[1];
      }

      package main;

      $daemon = SOAP::Transport::HTTP::Daemon
      -> new(LocalPort => 2031)
      -> dispatch_to('test::Callback');
      print "SOAP server ", $daemon->url, "\n";

      while (my $connection = $daemon->accept)
      {
      while (my $r = $connection->get_request)
      {
      $connection->force_last_request();
      $daemon->request($r);
      $daemon->SOAP::Transport::HTTP::Server::handle;

      print $daemon->response->content, "\n";

      $connection->send_response($daemon->response)
      }
      $connection->shutdown(2);
      undef $connection;
      }
    • Todd Fleming
      Update: If I run the server on Solaris and the client on Windows 2000 I get the correct error message. If I run the server on Windows and the client on Solaris
      Message 2 of 3 , Feb 11, 2003
      • 0 Attachment
        Update:

        If I run the server on Solaris and the client on Windows 2000 I get the
        correct error message. If I run the server on Windows and the client on
        Solaris I get the garbled error message.

        I then comented out the print statement in the error handler. I still get
        the garbled error from the client when running against the Windows server. I
        got no error message (expected) when running against the Solaris server.
        This indicates that the client dies before it even gets to the error handler
        when it connects to the Windows server.

        Todd Fleming
      • Todd Fleming
        Another clue: I ve traced into Net::HTTP::Methods::my_readline. The lines in the buffer returned by $self- sysread end in CR/CR/LF. Has anyone seen this
        Message 3 of 3 , Feb 12, 2003
        • 0 Attachment
          Another clue: I've traced into Net::HTTP::Methods::my_readline. The lines in
          the buffer returned by $self->sysread end in CR/CR/LF. Has anyone seen this
          behavior before? I'll probably step into the server to see why it's
          producing this incorrect end-of-line sequence.

          Todd Fleming
          Recognition Research, Inc.
        Your message has been successfully submitted and would be delivered to recipients shortly.