- Home
- Technical Library
- Boards
- Cookbook
- Code Share
- Blogs
- Partners
-
More
-
Services
- Training & Certification
- Support
-
Galleries
- Force.com Sites Gallery
- Chatter Challenge Entries
-
Other Web Sites
- Salesforce.com
- Database.com
- AppExchange
- CRM Community
-
Discussions
- Announcements
- General Development
- Schema Development
- New to Cloud Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules Discussion
- Security
- Mobile
- Force.com Sites
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby Development
- Adobe Flash Builder for Force.com
- Desktop Integration
- REST API Integration
- Streaming API
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- Excel Connector
- AJAX Toolkit & S-controls
- Force.com Builder & Native Apps
- AppExchange Directory & Packaging
- Force.com Labs Projects
- Open Source
- Site.com
- Jobs Board - Administrators
- Jobs Board - Developers
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Adobe Flash Builder for Force.com
- :
- Re: Invalid Session Id using Flex
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Invalid Session Id using Flex
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-26-2009 05:15 AM
Hello I am Newbie with Salesforce, sorry if this is a very easy question
We developed and application with flex, and now we are trying to connect it to SalesForce: we created the ApexPage:
<apex:page sidebar="false" showHeader="false" standardController="Oferta__c">
<apex:flash src="{!$Resource.CO}" height="100%" width="100%"
flashvars="sessionId={!$Api.Session_ID}&urlServidor={!$Api.Partner_Server_URL_150}&idOferta=a09S0000 000925WIAQ&idOpportunity="/>
</apex:page>
We created a Custom Buttom that called the Previus VisualForce Page
We added the Buttom to the Format Page
And we are getting the following error when we clicked on the buttom:
[SWF] /resource/1256553573000/CO - 3.969.554 bytes after decompression
App Domain = null
Api Server name = c.cs1.visual.force.com
loading the policy file: http://c.cs1.visual.force.com/services/Soap/cross-
loginWithSessionId(
sid: 00DS0000000FP4X!AR12345gD59GORSzw.7LHejW4Zz.aAmtfn
surl: https://c.cs1.visual.force.com/services/Soap/u/15.
);
App Domain = c.cs1.visual.force.com
Api Server name = c.cs1.visual.force.com
loading the policy file: http://c.cs1.visual.force.com/services/Soap/cross-
transport.url = http://c.cs1.visual.force.com/services/Soap/u/15.0
Method name is: getUserInfo
Method name is: getUserInfo
responseType: Fault
Saleforce Soap Fault: sf:INVALID_SESSION_ID
INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
But that is the session Id that we are getting through the API
On S-Controls we used the
sessionId={!$Api.Session_ID}And it is working OK
If you have any suggest, it will be wellcome
Thanks in advance
Solved! Go to Solution.
Re: Invalid Session Id using Flex
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-26-2009 03:21 PM
This actually seems to be a bug for the apex:flash component. If you use the standard html object/embed tag it will work properly.
Not sure when the fix will be in for for this.
Cheers,
Re: Invalid Session Id using Flex
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-29-2009 01:44 PM
Give this a try ..
It might work
<apex: page>
<apex:includescript value="/soap/ajax/15.0/connection.js" />
<script>
window.onload = setSessionId;
function setSessionId(){
sforce.connection.sessionId = '{!$Api.Session_ID}';
}
</script>
YOUR code here...
</apex:page>
Re: Invalid Session Id using Flex
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-17-2009 05:05 AM
We had that problem several times in several orgs and what we found out is this: The Session ID you receive from the API global variable can be different from the session ID which you really have on visual force pages. I'm not sure, but I think it happens if a VF page switches to a different server (visual.force.com instead of salesforce.com).
To solve this, you need to get the session from a Controller or Extension instead of the API global variable:
A very simple Extension:
public class GetSessionControllerExtension {
private final SObject myObject;
public GetSessionControllerExtension(ApexPages.StandardController stdController) {
this.myObject = stdController.getRecord();
}
public String GetMySessionId() {
return UserInfo.getSessionId();
}}
Just add it to your VF page, then you can use flashvars="sessionId={!sessionId}&..." to receive a working sessionId for your Flex application:
<apex:Page sidebar="false" showHeader="false" standardController="Oferta__c" extensions="GetSessionControllerExtension">
<apex:flash src="{!$Resource.CO}" height="100%" width="100%"
flashvars="sessionId={!sessionId}&urlServidor={!$Api.Partner_Server_URL_150}&idOferta=a09S0000000925 WIAQ&idOpportunity="/>
</apex:Page>
This approach fixed our problem however we are still wondering how such a feature bug can remain for such a long time without being documented (feature) or fixed (bug).
hth
Ingo

