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
vfDeveloper.ax341vfDeveloper.ax341 

INVALID_SESSION_ID after winter9 release

I faced INVALID_SESSION_ID  exception calling getUserInfo() of SalesforceAppExPartnerAPI.SforceService from my .net web service.


my code:
Code:
SalesforceAppExPartnerAPI.GetUserInfoResult userInfoResult = Binding.getUserInfo();

 Binding is property where _authHeader.EXTSessionID and _authHeader.EXTServerLocation are values passed to web service from salesforce portal.
_autHeader.ExtSessionID value retrieved via apex code : UserInfo.getSessionId() and _authHeader.ExtServerLocation is
https://na6-api.salesforce.com/services/Soap/u/12.0/511500D80000000Kb2v

Code:
 private SalesforceAppExPartnerAPI.SforceService Binding {
   get {
  
     try {      

      // binding
      SalesforceAppExPartnerAPI.SforceService binding = new SalesforceAppExPartnerAPI.SforceService();
      // by setting these values, we are essentially logged in to the API as this user
      binding.SessionHeaderValue = new SalesforceAppExPartnerAPI.SessionHeader();
      binding.SessionHeaderValue.sessionId = _authHeader.EXTSessionID;
      binding.Url = _authHeader.EXTServerLocation;
                           

      return binding;
     } catch (System.Web.Services.Protocols.SoapException exsoap) {
      if (exsoap.Code.ToString().Contains("API_DISABLED_FOR_ORG")) {
       throw new EXTAPIAuthFail("This edition of salesforce.com does not provide API access."
        + "API access is a standard feature of Enterprise "
        + "and Unlimited Editions.<br>"
        + "Certify your application to gain API access to "
        + "Professional Edition as well.<br><br>", exsoap);
      } else {
       throw new EXTAPIAuthFail("SoapException: Unable to validate incoming web call.", exsoap);
      }
     } catch (System.UriFormatException uriEx) {
      throw new EXTAPIAuthFail("The Server URL is invalid. " + uriEx.Message, uriEx);
     } catch (Exception e) {
      throw new EXTAPIAuthFail("Unable to connect to the API. " + e.Message, e);
     }
    } else {
     return _binding;
    }
   }
  }

 
Exception Stack trace:

Code:
{System.Web.Services.Protocols.SoapException: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at Mindflash.SalesforceAppExPartnerAPI.SforceService.getUserInfo()
 

It works fine before salesforce introduces winter9 release and version 14.0 API.







rcravenrcraven
Were you able to resolve this issue, and if so, what did you do to resolve it?
 
We've had code in place for a month now, and over the past few days, @ 12:00 a.m., we've been recieving the below exception message:

Exception Message: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Session timed out. 

We haven't changed any of our Salesforce security admin settings.  Salesforce may have changed it’s login so that the Session expires every day, this would cause the session to be invalid. Else, it’s just a coincidence that the session had timed out at 12 a.m. each day?

Is any one else having issues like this related to the Winter 09 release?  Does anyone have any suggestions?