Using proxy in SAP PI gives org.w3c.www.protocol.http.httpexception connect timed out

1.9k views Asked by At

I want to use a proxy in the standalone application. I wrote the below code in the application.

Properties proxyProps = new Properties();
proxyProps.setProperty("http.proxySet", "true");
proxyProps.setProperty("http.proxyHost", hostname);
proxyProps.setProperty("http.proxyPort", port);
proxyProps.setProperty("https.proxySet", "true");
proxyProps.setProperty("https.proxyHost", hostname);
proxyProps.setProperty("https.proxyPort", port);

if (null != username && null != password) {
    Authenticator.setDefault(new Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password
                    .toCharArray());
        }
    });
}

Properties systemProperties = System.getProperties();

Enumeration<?> iterator = proxyProps.propertyNames();
while (iterator.hasMoreElements()) {
    String s = (String) iterator.nextElement();
    systemProperties.put(s, proxyProps.get(s));
} 

We have below Java errors:

com.sun.xml.internal.messaging.saaj.soapexceptionimpl message send failed
caused by:
org.w3c.www.protocol.http.httpexception connect timed out

My application runs on SAP PI. How to using proxy for standalone applications?

0

There are 0 answers