Salesforce

CONNECTED() method always returns true for PASOE connection

« Go Back

Information

 
TitleCONNECTED() method always returns true for PASOE connection
URL Nameconnected-method-always-returns-true-for-pasoe-connection
Article Number000179806
EnvironmentProduct: OpenEdge
Version: 11.6, 11.7.x, 12.0, 12.1, 12.2
OS: All Supported Platforms
Question/Problem Description
The CONNECTED() method, when used against a handle that was previously used to store a connection to a PASOE AppServer, always returns TRUE even if the server is down.
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
This is expected behavior and the CONNECTED() method works the same way for PAS as an AIA connection to a classic AppServer.  

The reason for this is that both PASOE and AIA are HTTP based connections and these connections are inherently stateless (as in the connection can go away at any moment).  Therefore, the CONNECTED() method will only do two things when it is passed a handle variable:
  1. It will verify that the handle variable is currently associated with a connection to an AppServer -. the CONNECTED() method was used against the handle.
  2. CONNECTED() will return TRUE because there is nothing more that it can do.
This mean that although the CONNECTED() method will return TRUE if there is a logical connection, however the ABL Session on the server may have timed out, causing the remote request to fail.
Resolution
Upgrade to OpenEdge 12.2.5, 12.3 where the CONNECTED() method's behavior will return TRUE once a valid HTTP connection has been made, similar to an AIA connection to a Classic Appserver. For further details refer to Article: A remote AppServer call to a PAS MSA fails with error 14810

Alternatively, do not use the CONNECTED() method when programming an ABL application to determine if the connection is available to the PASOE AppServer.  

The best way to see if the connection is still valid is to RUN whatever program you are trying to access and catch any errors that may come back then re-establish the connection and retry the RUN as required.
 
IF IsConnected(server) then do:

method private logical IsConnected (input h as handle):

define variable lconnected as logical no-undo:
	do on error undo, throw:
	lconnected = h:connected():
	catch e as Progress.Lang.Error:
	end catch.
	return lconnected.
end method.

// Reconnect

You can try implementing code to do a ping against the AppServer and you can even use our HTTP classes to do a GET against the AppServer (requested a HEAD would be the simplest) or try using an ABL socket object to see if you can connect to the server. However, because HTTP is inherently stateless doing these things immediately prior to making your real call does not guarantee that the AppServer will still be there.
Workaround
Notes
Keyword Phrase
Last Modified Date9/14/2021 11:19 AM

Powered by