13 Replies Latest reply on Apr 22, 2008 6:06 PM by PrideU2

    Flex crossdomain issue

    rt300000
      *UPDATE* -- View source is now enabled

      I am working on building a very simple RSS reader for a website I am working on. I am able to get the RSS feed into my Flex project fine and the debug works great (on local machine). However, when exporting a release version it throws a security error and does not get the feed. The RSS source (a blog) has the crossdomain policy allowing access from all sites. Why am I getting this error? I would highly prefer not to use a proxy file, as I am not sure where this site where even be hosted yet. Thanks for reading, hopefully someone can shed some light on this.

      Flex project page
      RSS blog feed (data source)
      Crossdomain policy on the above host (in directory root folder)

      The error:
      [RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"]
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::faultHandler()
      at mx.rpc::Responder/fault()
      at mx.rpc::AsyncRequest/fault()
      at DirectHTTPMessageResponder/securityErrorHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/redirectEvent()
        • 1. Re: Flex crossdomain issue
          rt300000 Level 1
          anybody?
          • 2. Re: Flex crossdomain issue
            Mike J. Potter
            Enabling View Source on the application would be a help for people to solve this problem.

            Mike
            • 3. Re: Flex crossdomain issue
              rt300000 Level 1
              View source is now enabled, thanks for the suggestion. Like I mentioned, it works in debug (locally) but not when I export a release build. I can't figure it out, from what I can tell it should work with that crossdomain policy in place correctly. Thanks.
              • 4. Re: Flex crossdomain issue
                Mike J. Potter Level 1
                I don't get any errors - but I don't see any content in there either.

                The code looks right - try saving the RSS feed to a the same directory as your Flex app, change the URL to call for the web service and see if you get the error still?

                Mike
                • 5. Flex crossdomain issue
                  rt300000 Level 1
                  I updated the project. It now has the option to use the actual web RSS feed (default) or switch to a local copy of that feed (edited to remove some items so the content is visibly different). The local copy works, actual RSS web feed still gives me the error (or, in some cases apparently does NOT throw the error yet doesn't display the results either). View source will show the new code and also the local xml file. Thanks for helping me with this! Could it be a namespace or SOAP issue? I am fairly new to this, and haven't quite grasped namespaces beyond using them for local components and classes.

                  Rob
                  • 6. Re: Flex crossdomain issue
                    rt300000 Level 1
                    Any ideas?
                    • 7. Re: Flex crossdomain issue
                      rt300000 Level 1
                      :(
                      • 8. Re: Flex crossdomain issue
                        Mike J. Potter Level 1
                        Not sure - keep trying to debug the problem. Use the Flex debugger to inspect the code that is coming back from the web service call.

                        Mike
                        • 9. Flex crossdomain issue
                          rt300000 Level 1
                          It's just a bit odd that if i open the bin-debug (or debug from the builder) it works great, but when i open the bin-release version I get that error (or in some cases no error yet no results either as you mentioned). Any ideas of a difference between a debug version and a release build that could possibly affect/cause this?

                          When I look at the web service call results it has all the data I need, but like I mentioned its only when exporting a release build that I get this problem.

                          Also, I have tried switching to XML to hold the data received but that yielded the same issue/results as the ArrayCollection so I am just clueless as to why I am getting this security error. Are there any other good forums or sources of knowledge on this type stuff? Thanks for helping, I really need to get this figured out and I appreciate you taking the time to respond.
                          • 10. Re: Flex crossdomain issue
                            PrideU2
                            Hello, nice meeting you, and I must say i have the very same problem. I did some further research and maybe I can provider further info for someone who can help us.

                            First of all, the app was working perfectly until this weekend, and it is hosted in an external ISP. I'm getting now the nice message: "[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Destination: DefaultHTTP"]"

                            Here's the issue : The SWF is hosted at an address let's say: http://www.myportal.com.ar and also responds to http://www.myportal.net.ar .
                            The SWF calls a webservice located at http://www.myportal.com.ar/services.asmx?WSDL .

                            If I enter the site via http://www.myportal.com.ar it works perfectly, however if I use http://www.myportal.net.ar (different from the domain of the webservice) I get the error.

                            Of course I have crossdomain.xml working and triple checked.

                            The issue couldn't be stranger.

                            Victor
                            • 11. Re: Flex crossdomain issue
                              rt300000 Level 1
                              * UPDATE* -
                              I tried to manually add the security policy and get this warning in the trace output...I have yet to determine if this is the problem but it's at least a new direction to search for an answer.
                              • 12. Flex crossdomain issue
                                rt300000 Level 1
                                * UPDATE* - Could THIS be the issue? I don't see a content-type on the crossdomain policy file from the RSS provider ( crossdomain policy)

                                I think I may be closer closer to a solution. This would mean the host would have to update the policy file with a content-type of either...
                                text/* (any text type)
                                OR
                                application/xml or application/xhtml+xml
                                ...from what I understand. This seems to be why the policy file is not being loaded and the security error is thrown.
                                • 13. Re: Flex crossdomain issue
                                  PrideU2 Level 1
                                  Mate, I think this is it. After version 9,0,124,0 there were changes on the cross domain policy.

                                  You should add a line to your crossdomain.xml as not only the domain, you must now allow headers, I added this line and now everything is working like a charm:

                                  <allow-http-request-headers-from domain="*" headers="*" />

                                  Let me know if this solved your problem as it did for me!

                                  Victor