EnterpriseConnection connection = new enterpriseConnection();
loginResult = connection.login(userName, Password);
System.out.println(“Succesfully logged IN”);
connection._setProperty

(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,loginResult.getServerUrl());

SessionHeader sessionHdr = new SessionHeader();

sessionHdr.setSessionId(loginResult.getSessionId());
connection.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),”SessionHeader”, sessionHdr);