axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hawk...@apache.org
Subject cvs commit: ws-axis/c/src/transport/axis3/HTTPChannel HTTPChannel.cpp
Date Thu, 27 Jan 2005 18:12:04 GMT
hawkeye     2005/01/27 10:12:04

  Modified:    c/src/transport/axis3/HTTPChannel HTTPChannel.cpp
  Log:
  Added back in the extra error information that was in axis 2 transport when
  we can't open a connection.
  
  Revision  Changes    Path
  1.7       +34 -35    ws-axis/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp
  
  Index: HTTPChannel.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- HTTPChannel.cpp	20 Jan 2005 19:36:12 -0000	1.6
  +++ HTTPChannel.cpp	27 Jan 2005 18:12:04 -0000	1.7
  @@ -1,4 +1,6 @@
   #include "HTTPChannel.hpp"
  +#include "../../../platforms/PlatformAutoSense.hpp"
  +
   
   HTTPChannel::HTTPChannel()
   {
  @@ -270,11 +272,26 @@
           {
               // Cannot open a channel to the remote end, shutting down the
               // channel and then throw an exception.
  -            CloseChannel();
  +            // Before we do anything else get the last error message;
  +			long dw = GETLASTERROR
   
  +			closeChannel();
               free( paiAddrInfo0);
  +			
  +			string* message = PLATFORM_GET_ERROR_MESSAGE(dw);
  +
  +			char fullMessage[600];
  +			sprintf(fullMessage,
  +				"Failed to open connection to server: \n \
  +				hostname='%s'\n\
  +				port='%d'\n\
  +				Error Message='%s'\
  +				Error Code='%d'\n",
  +				m_URL.getHostName(), m_URL.getPort(), message->c_str(), dw);
  +				
  +			delete(message);
   
  -            throw HTTPTransportException( SERVER_TRANSPORT_SOCKET_CONNECT_ERROR);
  +			throw AxisTransportException( CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED, fullMessage);
           }
   
           break;
  @@ -361,44 +378,26 @@
   // Cannot open a channel to the remote end, shutting down the
   // channel and then throw an exception.
   
  -#ifdef WIN32
   // Before we do anything else get the last error message;
  -// I'd like to put the getting of the error message into platform specifics
  -// but not sure how!  I think it would be nicer to make the platform
  -// specifics a class and not just macros.  That way we could have e.g.
  -// char * Windows#getLastErrorMessage().
  -		long lLastError = GetLastError();
  -#endif // WIN32
  +			long dw = GETLASTERROR
  +			CloseChannel();
   
  -		CloseChannel();
  +			
  +			string* message = PLATFORM_GET_ERROR_MESSAGE(dw);
   
  -#ifdef WIN32
  -		char	szErrorBuffer[200]; 
  -	    LPVOID	lpErrorBuffer;
  -
  -		FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
  -					   NULL,
  -					   lLastError,
  -					   MAKELANGID( LANG_NEUTRAL, SUBLANG_DEFAULT),
  -					   (LPTSTR) &lpErrorBuffer,
  -					   0,
  -					   NULL);
  -
  -		sprintf( szErrorBuffer, 
  -				 "Failed to open connection to server:\n\
  -				 hostname='%s'\n\
  -				 port='%d'\n\
  -				 Error Message='%s'\
  -				 Error Code='%d'\n",                     \
  -				 m_URL.getHostName(), m_URL.getPort(), lpErrorBuffer, lLastError); 
  - 
  -	    LocalFree( lpErrorBuffer);
  +			char fullMessage[600];
  +			sprintf(fullMessage,
  +				"Failed to open connection to server: \n \
  +				hostname='%s'\n\
  +				port='%d'\n\
  +				Error Message='%s'\
  +				Error Code='%d'\n",
  +				m_URL.getHostName(), m_URL.getPort(), message->c_str(), dw);
  +				
  +			delete(message);
   
  -		m_LastError = szErrorBuffer;
  -#else // WIN32 not defined
  -		m_LastError = "Cannot open a channel to the remote end.";
  +		m_LastError = fullMessage;
   
  -#endif // WIN32
   	    return bSuccess;
       }
   	else
  
  
  

Mime
View raw message