You need to sign in to do that
Don't have an account?
Sample.java : Login Apex API Call is not working
I am new to Salesforce, trying to connect salesforce through JAVA but getting below error.
I have got this sample code from Salesforce documentation on API.
Did anyone face this issue before? Please help me to resolve this error.
Enter username: xxxxxxxxxxxxxxxxxxxx
Enter password: xxxxxxxxxxxx
LOGGING IN NOW....
An unexpected error has occurred: ; nested exception is:
java.net.ConnectException: Connection timed out: connect
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.net.ConnectException: Connection timed out: connect
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)
at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.sforce.soap.enterprise.SoapBindingStub.login(SoapBindingStub.java:3750)
at com.doc.samples.Samples.login(Samples.java:78)
at com.doc.samples.Samples.run(Samples.java:318)
at com.doc.samples.Samples.main(Samples.java:35)
Thanks,
Most likely your network is blocking the connection attempt, and you need to go via a proxy server.
Thanks Simon for your quick response.
Could you please advise, what changes would be needed to make this request via proxy?
Thanks,
Ali
If your network has a proxy, in the Java code, you'll need to do the following before you attempt to connect to salesforce.com:
System.setProperty("http.proxyHost", _proxyHost);
System.setProperty("http.proxyPort", _proxyPort);
where _proxy Host is a variable holding the machine name of your proxy machine, e.g. proxy.mydomain.com
and _proxyPort is a variable holding the port on which you communicate to the proxy, e.g. 8080