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
SpectorSpector 

Package: Session ID changing mid login! Please help.

 Hello,

Since the upgrade to Winter 09 I have had several critical problems with my current application (that was working fine before the upgrade). The main difference is that I now have a package that I have created with many VisualForce pages in them. These pages work in conjunction with a web service (which I have written and control).

At first my problem was that within a package, the {!$API.Partner_Server_Url_XX} variable was not getting set appropriately. I was getting set  to "https://www.salesforce.com/services/Soap/u/14.0/" which is entirely different from what it used to be (ex. "https://<server>.salesforce.com/services/Soap/u/14.0/<partial sess id>"). With a little help from the community I found a workaround that involved just modifiying that URL before sending it to my web service (as the web service needs to call getUserInfo() in the partner API). Now I have modified that URL to be "https://<package namespace>.<server>.visual.force.com/services/Soap/u/14.0/<partial sess id>".

This seems to work fine on the initial callback to the partner API. I can get the user info via getUserInfo() on the first page load. However... whenever I call the webservice again (via a submit button on the same page) the session ID (via UserInfo.getSessionId()) is CHANGING! It does not match the initial value that was used when the page was first loaded! This causes my call to the parner API to throw an exception that reads: "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session".

So why is the session id changing? This only seems to happen in a package. When I run the code in unmanaged form (unpackaged) it works just fine. Is this a bug?

Our company is planning to showcase this at our booth at Dreamforce, please help!