• Jacob Hutchings
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I ran through the example code from https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_quickstart_steps.htm but all I get is a timeout error during the first login stage. I've created a developer login and generated the wsdl, and then the .jar. The program compiles. I even tried it with the following example I found elsewhere:
import com.sforce.soap.enterprise.Connector;
import com.sforce.soap.enterprise.EnterpriseConnection;
import com.sforce.ws.ConnectionException;
import com.sforce.ws.ConnectorConfig;
 
public class Main {
    static final String USERNAME = "username redacted";
    static final String PASSWORD = "password redacted";
    static final String AUTH = "https://login.salesforce.com/services/Soap/c/37.0/0DF58000000L2Vm";
    static EnterpriseConnection connection;
 
    public static void main(String[] args) {
        ConnectorConfig config = new ConnectorConfig();
        config.setUsername(USERNAME);
        config.setPassword(PASSWORD);
        config.setAuthEndpoint(AUTH);
        try {
            connection = Connector.newConnection(config);
            // display some current settings
            System.out.println("Auth EndPoint:"+config.getAuthEndpoint());
            System.out.println("Service EndPoint:"+config.getServiceEndpoint());
            System.out.println("Username: "+config.getUsername());
            System.out.println("SessionId: "+config.getSessionId());
        } catch (ConnectionException e1) {
            e1.printStackTrace();
        }
   }
}
But when I run both hang for ages and then give a ConnectException: Connection Timed Out
com.sforce.ws.ConnectionException: Failed to send request to https://login.salesforce.com/services/Soap/c/37.0/0DF58000000L2Vm
	at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:121)
	at com.sforce.soap.enterprise.EnterpriseConnection.login(EnterpriseConnection.java:1207)
	at com.sforce.soap.enterprise.EnterpriseConnection.<init>(EnterpriseConnection.java:386)
	at com.sforce.soap.enterprise.Connector.newConnection(Connector.java:27)
	at Main.main(Main.java:18)
Caused by: java.net.ConnectException: Connection timed out
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:579)
	at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:637)
	at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:977)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1093)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
	at com.sforce.ws.transport.JdkHttpTransport.connectRaw(JdkHttpTransport.java:136)
	at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:100)
	at com.sforce.ws.transport.JdkHttpTransport.connectLocal(JdkHttpTransport.java:95)
	at com.sforce.ws.transport.JdkHttpTransport.connect(JdkHttpTransport.java:91)
	at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:95)
	... 4 more
I've checked using wireshark and with my system admin that its not the firewall: the DNS lookup is correctly resolving 'login.salesforce.com' and there are definetly packages going out. What else could I be doing wrong?

 
Hi,

I am getting started with the Streaming API but I haven't been able to subscribe to any Streaming Push Topic.
I have followed the steps suggested by the Trailhead tutorial: https://developer.salesforce.com/trailhead/api_basics/api_basics_streaming
When I click the Subscribe button, nothing happens. The channel section appears Connected/Disconnected randomly.

I have tried to debug the issue using my browser console, and the only message received when trying to subscribe is:
uncaught exception: Illegal state: already disconnected
The message persists either when the channel status is Connected/Disconnected.

The subscription has failed in any browser (Chrome, Firefox, IE).

Any hint? Thanks!!!!!!