开发者

Flex Ruby-on-Rails http xml request error

I'm currently developing a Ruby on Rails application with Rails 3.0 on Ubuntu 10.4. I intend to use Adobe Flex for the front-end. For this reason I've installed Flash Builder 4 on Windows XP using Virtual Box. The Internet connection of this virtual machine is bridged.

The Flex Application currently only consists of a simple HTTP Request that retrieves an XML file from the Rails Application running on Ubuntu localhost:3000 :

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.a开发者_如何学Pythondobe.com/flex/spark" 
      xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
      creationComplete="plansService.send()">
 <fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
  <s:HTTPService id="plansService"
        url="http://192.168.1.102:3000/plans/list" />
 </fx:Declarations>
 <fx:Script>
  <![CDATA[
   private function printPlans():void {
    for each (var xm:XML in plansService.lastResult.plans.plan) {
     trace("my name is "+ xm.child("name"));
    }

   }
  ]]>

 </fx:Script>
</s:Application>

In the Flash Builder Network Manager the HTTP Request is displayed as working. The response is there and contains the correct XML data. But when the Flex Application loads in the Browser I get this error:

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file://C:\Documents and Settings\susi\Adobe Flash Builder 4\naturalstudy\bin-debug\naturalstudy.swf cannot load data from localhost:27813.
 at mx.netmon::NetworkMonitorImpl()[/ndepot/fb_401/ide_builder/ActionscriptProjects/src/mx/netmon/NetworkMonitorImpl.as:81]
 at mx.netmon::NetworkMonitorImpl$/init()[/ndepot/fb_401/ide_builder/ActionscriptProjects/src/mx/netmon/NetworkMonitorImpl.as:49]
 at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2620]
 at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\SystemManager.as:2539]
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.preloaders::Preloader/timerHandler()[E:\dev\4.x\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515]
 at flash.utils::Timer/_timerDispatch()
 at flash.utils::Timer/tick()

I googled this and thus have tried these things:

- added use-network=false to the Flash Builder compiler options for this project

- added a crossdomain.xml file to the Rails Project public folder:

   <?xml version="1.0" encoding="utf-8"?>
    <cross-domain-policy>
    <site-control permitted-cross-domain-policies="all" />
    <allow-access-from domain="*" />
    <allow-http-request-headers-from domain="*" headers="*"/>
    </cross-domain-policy>

But it still doesn't work and the error is the same. I think the problem is that the Flex application is trying to receive something from localhost:27813 ... but I'm stuck at this point. Help would be much appreciated!


A shot in the dark. Go here and add that location (localhost:27813) as trusted location:

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

More guesses:

  • Run your project with Flash Builder Network Monitor disabled.
  • Export a release build and run that
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜