Skip to Content
Jun 30, 2022 at 10:46 AM

HttpException: Connect timed out in UDF


Hi All,

We have scenario where we make a HTTP call to generate salesforce token via UDF using OAuth authentication, it works fine in SAP PI 7.5 dev environment

When we are trying to do the same in test environment we are seeing 'org.w3c.www.protocol.http.HttpException: Connect timed out'

The UDF code and the parameters used and token URL(via VM) all remains the same in both environments.

The UDF code goes as below

String urlParameters = "grant_type=password&username="+username+"&password="+password+"&client_id="+client_id+"&client_secret="+client_secret;

byte[] postData = urlParameters.getBytes(StandardCharsets.UTF_8);

URL url = new URL( token_url);

HttpURLConnection httpClient = (HttpURLConnection) url.openConnection();

httpClient.setRequestProperty( "Content-Type", "application/x-www-form-urlencoded");

DataOutputStream wr = new DataOutputStream(httpClient.getOutputStream());


The configuration works well if used in SAP REST communication channel in test environment as well

Any suggestions on what could be causing this issue in ESR (UDF) of test environment only, any help appreciated.