function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rtompkinsrtompkins 

HOWTO share binding in J2ee App

I have a java enterprise application that connects to salesforce and queries data.

I want the application to create a single BindingStub and share it between all of the users on the webapp. It also needs to automatically relogin when the session expires every 30 minutes.

 

I am currently creating a new bindingStub and logging in everytime a user wants to query salesforce. This is very slow and wasteful. What is the best way to implemenet the sharing of a bindingstub that will automtically relogin when the session expires.

 

 

Thanks in Advance.

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
don't share a single instance of the binding object, in almost all soap toolkits these objects are not thread safe. instead share the sessionId & serverUrl strings, and construct/configure a binding object as needed. for automatic relogin, most people either keep track of the time of the last login attempt, and login every XX minutes, or catch the invalid_sessionId error, and relogin at that point.