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

soap client aborts during transport

Expand Messages
  • Scott
    While testing our asp.net web app service we noticed that the client aborts if the service id down. For example if port 80 is unavailable the client aborts
    Message 1 of 2 , Jan 26, 2011
    • 0 Attachment
      While testing our asp.net web app service we noticed that the client aborts if the service id down. For example if port 80 is unavailable the client aborts with a 500 internal server error. I have worked around this issue by placing an eval block but my question is why would it do that. This doesn't seem to be practical or normal behavior to exit the script on an error. Is this a possible client coding issue where i am not handling this properly?

      CLIENT CODE:
      use SOAP::Lite +trace => 'debug';
      use VSM::VSMWindows;

      my $serviceNs = 'http://g5w2502g.atlanta.hp.com/VSMapi';
      my $serviceProxy = 'http://g5w2502g.atlanta.hp.com/VSMapi/VSMapi.asmx';

      my ($soap_depot_stat,$soap_msg) = VSM::VSMWindows::CheckStatus('serviceNS'=>$serviceNs, 'proxy'=>$serviceProxy);

      print "$soap_depot_stat,$soap_msg\n";

      CLIENT FUNCTION:
      sub CheckStatus {
      my $function = 'CheckStatus';
      my $SUB = $MODULE . '::' . $function;
      my %args = @_;
      my $serviceNs = $args{'serviceNS'};
      my $serviceProxy = $args{'proxy'};
      my $stat = '';
      my $retmsg = '';

      my $soap = SOAP::Lite
      -> uri($serviceNs . '/')
      -> on_action( sub { join '/', $serviceNs, $_[1] } )
      -> proxy($serviceProxy);

      if ($soap) {
      $retmsg = $soap
      -> CheckStatus()
      -> result;

      if (!defined($retmsg)) {
      $stat = $FALSE;
      $retmsg = "SOAP FAULT ERROR";
      } else {
      $stat = $TRUE;
      }
      } else {
      $retmsg = "SOAP connection Failure";
      $stat = $FALSE;
      }
      return $stat,$retmsg;
      }

      CLIENT OUTPUT:
      schall/soap $ ./client.pl
      SOAP::Transport::HTTP::Client::send_receive: POST http://.../VSMapi/VSMapi.asmx HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Accept: application/soap
      Content-Length: 444
      Content-Type: text/xml; charset=utf-8
      SOAPAction: http://..../VSMapi/CheckStatus

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><CheckStatus xmlns="http://..../VSMapi/" xsi:nil="true" /></soap:Body></soap:Envelope>
      SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to ....:80 (connect: Invalid argument)
      Content-Type: text/plain
      Client-Date: Wed, 26 Jan 2011 18:13:07 GMT
      Client-Warning: Internal response

      500 Can't connect to ....:80 (connect: Invalid argument)
      500 Can't connect to ....:80 (connect: Invalid argument)
    • Martin Busik
      Hi Scott, using eval { ... } if($@) { ... } is a common try/catch pattern. I do not see anything suspect/wrong with that. cheers, Martin
      Message 2 of 2 , Jan 27, 2011
      • 0 Attachment
        Hi Scott,
        using

        eval {
        ...
        }
        if($@) {
        ...
        }

        is a common try/catch pattern. I do not see anything suspect/wrong with
        that.

        cheers,
        Martin


        > -----Urspr√ľngliche Nachricht-----
        > Von: soaplite@yahoogroups.com
        > [mailto:soaplite@yahoogroups.com] Im Auftrag von Scott
        > Gesendet: Mittwoch, 26. Januar 2011 19:50
        > An: soaplite@yahoogroups.com
        > Betreff: [soaplite] soap client aborts during transport
        >
        > While testing our asp.net web app service we noticed that the
        > client aborts if the service id down. For example if port 80
        > is unavailable the client aborts with a 500 internal server
        > error. I have worked around this issue by placing an eval
        > block but my question is why would it do that. This doesn't
        > seem to be practical or normal behavior to exit the script on
        > an error. Is this a possible client coding issue where i am
        > not handling this properly?
        >
        > CLIENT CODE:
        > use SOAP::Lite +trace => 'debug';
        > use VSM::VSMWindows;
        >
        > my $serviceNs = 'http://g5w2502g.atlanta.hp.com/VSMapi';
        > my $serviceProxy =
        > 'http://g5w2502g.atlanta.hp.com/VSMapi/VSMapi.asmx';
        >
        > my ($soap_depot_stat,$soap_msg) =
        > VSM::VSMWindows::CheckStatus('serviceNS'=>$serviceNs,
        > 'proxy'=>$serviceProxy);
        >
        > print "$soap_depot_stat,$soap_msg\n";
        >
        > CLIENT FUNCTION:
        > sub CheckStatus {
        > my $function = 'CheckStatus';
        > my $SUB = $MODULE . '::' . $function;
        > my %args = @_;
        > my $serviceNs = $args{'serviceNS'};
        > my $serviceProxy = $args{'proxy'};
        > my $stat = '';
        > my $retmsg = '';
        >
        > my $soap = SOAP::Lite
        > -> uri($serviceNs . '/')
        > -> on_action( sub { join '/',
        > $serviceNs, $_[1] } )
        > -> proxy($serviceProxy);
        >
        > if ($soap) {
        > $retmsg = $soap
        > -> CheckStatus()
        > -> result;
        >
        > if (!defined($retmsg)) {
        > $stat = $FALSE;
        > $retmsg = "SOAP FAULT ERROR";
        > } else {
        > $stat = $TRUE;
        > }
        > } else {
        > $retmsg = "SOAP connection Failure";
        > $stat = $FALSE;
        > }
        > return $stat,$retmsg;
        > }
        >
        > CLIENT OUTPUT:
        > schall/soap $ ./client.pl
        > SOAP::Transport::HTTP::Client::send_receive: POST
        > http://.../VSMapi/VSMapi.asmx HTTP/1.1
        > Accept: text/xml
        > Accept: multipart/*
        > Accept: application/soap
        > Content-Length: 444
        > Content-Type: text/xml; charset=utf-8
        > SOAPAction: http://..../VSMapi/CheckStatus
        >
        > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        >
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:B
        > ody><CheckStatus xmlns="http://..../VSMapi/" xsi:nil="true"
        > /></soap:Body></soap:Envelope>
        > SOAP::Transport::HTTP::Client::send_receive: 500 Can't
        > connect to ....:80 (connect: Invalid argument)
        > Content-Type: text/plain
        > Client-Date: Wed, 26 Jan 2011 18:13:07 GMT
        > Client-Warning: Internal response
        >
        > 500 Can't connect to ....:80 (connect: Invalid argument)
        > 500 Can't connect to ....:80 (connect: Invalid argument)
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.