You need to sign in to do that
Don't have an account?
Maintaining a session for the subsequent call
Hi
i hava a login class where i am creating a login and i am getting a session id.
public class Login_SupportForce { Â Â Â public SoapBindingStub sfdc = null; Â Â Â private String sessionID; Â private String serverURL; Â Â Â public void getLogin() throws ServiceException, ApiFault, RemoteException, MalformedURLException { Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â SforceService service = new SforceServiceLocator(); Â Â Â Â Â Â Â sfdc = (SoapBindingStub)service.getSoap();
       System.out.println("Connecting to: " + service.getSoapAddress());            try{                                // login            LoginResult loginResult = sfdc.login("psohal@njtransit.com", "nanki"); System.out.println("Logged in");                  // Reset the SOAP endpoint to the returned server URL            sfdc = (SoapBindingStub) new SforceServiceLocator().getSoap(new java.net. URL(loginResult.getServerUrl()));        // Create a new session header object        // add the session ID returned from the login            _SessionHeader sh = new _SessionHeader();            sh.setSessionId(loginResult.getSessionId());            sessionID = loginResult.getSessionId();            serverURL = loginResult.getServerUrl();        // Set the session header for subsequent call authentication            sfdc.setHeader(service.getServiceName().getNamespaceURI(),"SessionHeader", sh); System.out.println("get Session Id " + loginResult.getSessionId()); System.out.println("get user Id " + loginResult.getUserId()); System.out.println("get user Id " + loginResult.getServerUrl());  Â
    }catch(Exception e ){System.out.println("error in login class " + e);}             }    }
Â
now i am calling the getLogin() method of  Login_Supportforce in a servlet. i am getting a session id.
Connecting to: https://www.salesforce.com/services/Soap/c/5.0 logged in get Session Id ho3Cs8qyOVw6XmaaVxAX1XzjdG0ItJFgFQVVQMwkbydr1ssrj_4yX.J4DayBR5WPA PIwpytqduBfrSnAV.SojTteaH1xyGi1 get user Id 00530000000ekzzAAA get user Id https://na1-api.salesforce.com/services/Soap/c/5.0 error in creating case Destination URL not reset. The URL returned from login mu st be set in the SforceService
how ever i cant able to pull the result from any object i am getting an error i.e.
error in creating case Destination URL not reset. The URL returned from login must be set in the SforceService
thank u
Hi Param,
You should probably set the binding object as a session variable.
when using the Force IDE and I'm suspecting that it's causing another error as well. I'm seeing the error on the command line because I have logging enabled. I think it's causing this error too:
Would anyone know why this is happening? Thanks.