+ Start a Discussion
mk2013mk2013 

Facing a problem in with EnterpriseConncetion when session expired

I am integrating a java web app with SalesForce. when the session is expired, and I try to create a new Connection I get some weird error and am bot able to connect to SalesForce.

The error shows as below. I do not understand why does it say username null. I am new to SalesForce and not able to understand what the error is. It is not throwing the exception either. The java webapp is on weblogic application server.

Any help is apprecated.

------------------------------------------------------------------------------------------------------------------------------------------------------------------
WSC: Creating a new connection to https://***api.salesforce.com/services/Soap/c/27.0/00DV00000051xMT/0DFV0000000Cav2 Proxy = DIRECT username null
------------ Request start ----------
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001$
------------ Request end ----------
null=[HTTP/1.1 500 Server Error]
Date=[Wed, 01 May 2013 15:21:26 GMT]
Content-Length=[1011]
Content-Type=[text/xml;charset=UTF-8]
------------ Response start ----------
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enter$
------------ Response end ----------
<May 1, 2013 8:21:39 AM PDT> <Warning> <Socket> <BEA-000450> <Socket 6 internal data record unavailable (probable closure due idle timeout)$

---------------------------------------------------------------------------------------------------------------------------------------------------------

 

I have the connection code as below.

 

public EnterpriseConnection getConnectionToSalesForce(){
if(connection != null){
return connection;
}else{
// Connect to SalesForce
ConnectorConfig config = new ConnectorConfig();
config.setUsername("userName");
config.setPassword("passwrord");
config.setTraceMessage(true);
try {
connection = Connector.newConnection(config);
String sessionId = config.getSessionId();
String authEndPoint = config.getAuthEndpoint();
String serviceEndPoint = config.getServiceEndpoint();
connection.getSessionHeader().setSessionId(sessionId);

// display current settings
logger.debug("SessionId: " + sessionId);
logger.debug("Auth EndPoint: "+ authEndPoint );
logger.debug("Service EndPoint: "+ serviceEndPoint);
logger.debug("Username: "+config.getUsername());
}catch (ConnectionException e1) {
e1.printStackTrace();
}
}
return connection;
}

 

 

------------------------------------------------------------------------------------

 

Thanks,

mk2013

mk2013mk2013

Adding to my previous post......I now see in the response I get the folowinf fault when calling API from java as the session has timed out. But still looking for solution on how to handle this fault in java application which calls this API.  I see in the request there is a session Id and as the session has timed out on SF side, it does not match. PLease advise on how to resolve session toimeout issue.

 

<sf:exceptionCode>INVALID_SESSION_ID</sf:exceptionCode><sf:exceptionMessage>Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: 00DV00000051xMT!ARUAQOpg36B6GPWKObo.6apPGD0awqtdC4NoNKdQYH0e1ApGCiS9EGnN03j4xsHZCc9MiXqiwC7GZ

 

Thanks,

MK2013