+ Start a Discussion

Flex Toolkit - mx rpc Fault



I have a problem using the Flex Toolkit for salesforce.  I would greatly appreciate if anyone patiently reads this and helps me out.


The following are the steps I followed:


1. Created a flex project in Flex Builder 3

2. Dropped in the salesforce.mxml file as a startup application

3. Included the as3Salesforce.swc in the library path

4. Entered my own developer username and password into this (salesforce.mxml) file

5. Set the Setup --> Administration Setup --> Security Controls --> Session Settings --> 'Require secure connections (HTTPS)' Checkbox to FALSE

6. Built the project and ran the application salesforce.mxml

Now this works perfectly fine if I run this from my Flex Builder, and I have no issues.


Then, what I did was, I exported this as a ".swf" file and uploaded it as a Static Resource in another developer org. of mine. I then embedded this onto a VF Page.


Now, when I access this VF Page, the "login" operation works perfectly fine (logging into my 1st developer org) and I get the following text in the "ta.text" Textarea:


Login successful:
  context = (null)
  passwordExpired = false
  serverUrl = "https://na7-api.salesforce.com/services/Soap/u/9.0/...............



Here is my issue. When I try to do any other operation after this, like "describeSObjects" / "describe all" and so on, I receive this error:


fault from operation: (mx.rpc::Fault)#0
  content = (null)
  errorID = 0
  faultCode = "Channel.Security.Error"
  faultDetail = "Destination: DefaultHTTP"
  faultString = "Security error accessing url"
  message = "faultCode:Channel.Security.Error faultString:'Security error accessing url' faultDetail:'Destination: DefaultHTTP'"
  name = "Error"
  rootCause = (flash.events::SecurityErrorEvent)#1
    bubbles = false
    cancelable = false
    currentTarget = (flash.net::URLLoader)#2
      bytesLoaded = 0
      bytesTotal = 0
      data = (null)
      dataFormat = "text"
    eventPhase = 2
    target = (flash.net::URLLoader)#2
    text = "Error #2170: Security sandbox violation: http:<my developer org 2 VF Page URL> cannot send HTTP headers to https://na7-api.salesforce.com/services/Soap/u/9.0/<dev org 1 ID>."
    type = "securityError"



 Could anyone tell me why exactly this happens and what is the Solution?


 I checked out the community Posts:



  • http://community.salesforce.com/sforce/board/message?board.id=ajax_toolkit&message.id=2741
  • http://community.salesforce.com/sforce/board/message?board.id=general_development&message.id=11600



and tried them out, but doesn't seem to work.



I would greatly appreciate any help on this issue.


Thank You.

Message Edited by Suri on 10-09-2009 06:20 PM
Message Edited by Suri on 10-14-2009 04:39 PM

Hi Suri,


You don't mention exactly what you have tried so it is hard to diagnose your problem.  Before calling login, have you set the protocol to "http" on your Connection object? 






In brief, my problem is that the "salesforce.mxml" sample given in the Flex Toolkit for salesforce - this file works perfectly fine when I run it from my Flex Builder locally.


But when I load the swf file on a Site page (or any HTML page), only the "Login" call works. The Describe, Query etc. don't work.


Any clue why? Have you tried running the sample "salesforce.mxml" file in the Flex Toolkit?


And yes. The protocol is set to http.



Message Edited by Suri on 11-02-2009 12:54 PM


On step 3 when you added the as3Salesforce.swc, did you click Add SWC Folder and chose the folder where as3Salesforce.swc lives? Also, is the Framework linkage set to Merged in code?






Yes I did click Add SWC Folder and choose the folder where as3Salesforce.swc lives.


And Sorry I don't understand what is meant by "the Framework linkage set to Merged in code?" ?!






I made the assumption you were using Eclipse. If you are, here is a screenshot.

flex eclipse framework linkage
Message Edited by DrawloopSupport on 12-18-2009 08:55 AM
Message Edited by DrawloopSupport on 12-18-2009 08:56 AM
Message Edited by DrawloopSupport on 12-18-2009 08:57 AM



The Framework Linkage is set to "Merged into Code".