11 Replies Latest reply on Jun 17, 2006 2:28 PM by eeerrrwwwuuu

    HTTPService strange problem

    eeerrrwwwuuu
      Hi.
      I'm using Flex 2 Beta 3.
      In my simple application i used : HTTPService to read xml fie from server and display in "DataGrid". The problem is that, when i read file from http://weblogs.macromedia.com/mchotin/index.xml ( Link form Adobe's tutorial) it works, but.. when i copy this link to one of my servers and just swich hyperlint to http://mloderadio.i365.pl/radio/admin/index.xml or http://erwu.alte.pl/erwu/index.xml it doesn't work :/ I don't get why .... Those files are the same... As you can see both links are valid.



      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" width="1000" height="800" creationComplete="log.send()" viewSourceURL="srcview/index.html">

      <mx:HTTPService url=" http://mloderadio.i365.pl/radio/admin/index.xml"
      showBusyCursor="true"
      id="log"
      useProxy="false"
      />

      <mx:Panel x="10" y="10" width="595" height="391" layout="absolute" fontSize="10" color="#000000" title="Motion Detector's Player" >
      <mx:ComboBox x="10" y="29" width="200" dataProvider="{log.lastResult.rss.channel}" id="title">
      </mx:ComboBox>
      <mx:HRule x="10" y="59" width="555" height="20"/>
      <mx:VideoDisplay x="245" y="87" width="320" height="240"/>
      <mx:VRule x="289" y="87" width="20" height="240"/>
      <mx:DataGrid x="10" y="87" width="258" height="240" dataProvider="{log.lastResult.rss.channel.item}">
      <mx:columns>
      <mx:DataGridColumn headerText="cos" dataField="title" />
      <mx:DataGridColumn headerText="Data" dataField="description" />
      </mx:columns>
      </mx:DataGrid>
      </mx:Panel>
      </mx:Application>

      http://weblogs.macromedia.com/mchotin/index.xml
        • 1. Re: HTTPService strange problem
          inlineblue Level 1
          Your problem is most likely a security issue. By default, your SWF is allowed to access services only from the server from which it was served. In order to access an outside service, the outside server must have a crossdomain policy file allowing the access. Macromedia's servers have policy files allowing access from anywhere. Look in the docs about crossdomain files for more info.
          • 2. Re: HTTPService strange problem
            eeerrrwwwuuu Level 1
            What about local files? Let's say i have C:\DocumentsAndSettings\Project\app.mxml directory. I want to read file from within Project dir. I tryed many difrent combinations with url and crosspolicity...
            within(Project ) url = "myfile.xml" cross policity in C:\ , C:\Project and in app's dir. even in "bin" and it doean't work.


            Ps. inlineblue ;) thx for help.. http://weblogs.macromedia.com/crossdomain.xml ;) now i know why i had possibility to load this file. ;)
            • 3. Re: HTTPService strange problem
              I have the same question: WHAT ABOUT LOCAL FILES????

              I have XML files in subdirectory /xml and I can't load them:

              [RPC Fault faultString="Error #2028: Local untrusted file xml/sprzedaz.xml may not access Internet URL file:///c:/Documents and Settings/agnieszka/My Documents/Flex Builder 2.0/wookWykresy/bin/wookWykresy.swf." faultCode="InvokeFailed" faultDetail="null"]

              • 4. Re: HTTPService strange problem
                ur_dtrain Level 1
                <mx:HTTPService id="srv" url="./data/stones.xml" useProxy="false" result="resultHandler(event)" showBusyCursor="true"/>

                I use a local relative file reference for local xml. When I serve the application on the web I make sure that the reletive path is valid on the server as well.
                • 5. Re: HTTPService strange problem
                  eeerrrwwwuuu Level 1
                  Hmm.. i don't get one thing... Do i need server on my PC? I want to simply launch file from directory :
                  C:\Document... \myApp.html i guess Flex doesn't support Windows dir style? I tryed 100s of combinations with path...
                  I need simple movie browser with xml list of files. It must work without any servers...

                  • 6. Re: HTTPService strange problem
                    I use a local relative file reference for local xml as well...
                    ( serwis.url = "./xml/foodcost.xml"; )

                    But I get the error...



                    • 7. Re: HTTPService strange problem
                      ur_dtrain Level 1
                      You should probably make sure you have a crossdomain file setup in the root of your web server if you are running a served application, if you are running locally (launching from FB) then you shouldn't have a problem.

                      <?xml version="1.0" encoding="iso-8859-1" ?>
                      <cross-domain-policy>
                      <allow-access-from domain="*" />
                      </cross-domain-policy>
                      • 8. Re: HTTPService strange problem
                        eeerrrwwwuuu Level 1
                        1. I do have CrossDomain xml file with "*" in all directories.
                        2. I have problem with lounching from FB .
                        • 9. Re: HTTPService strange problem
                          ur_dtrain Level 1
                          The only thing I can think of might be a naming collision. Try renaming your 'xml' folder (and your references to it) to something like 'data' or 'assets'. I'm using local xml just like in the felxstore example. Maybe your xml is not well formed. I think the outline tool in FB might give you a visual check. If you post a sample of your xml, that might help.
                          • 10. Re: HTTPService strange problem
                            eeerrrwwwuuu Level 1
                            I think we both with Agnieszka have polish OS ;)
                            I have XP PRO PL. maybe there is problem with multibyte chars.... I tryed to launch it even from C:\App\ ;)


                            Bye
                            • 11. HTTPService strange problem
                              eeerrrwwwuuu Level 1
                              I have the same problem with macromedia's sample Flex Store

                              I use "Windows XP SP2 PL / Fire Fox 1.5 PL / FLEX 2 Beta 3 / FLASH PLAYER 9"
                              on IE 6/7 the same...

                              :| i guess it must have a bug. I can load XML via HTTPService only from HTTP://

                              Maybe it's becouse FireFox changes url on the :

                              file:///C:/Documents%20and%20Settings/erwu/Pulpit/%5BFlex%5D/Test/bin/Projekt.html
                              i tryed file://C:/App/ too....

                              i give up.. :| there must be something wrong with that.... i got only one day do write player :| Flex sux for now.. :/ Time to launch Apatche & PHP5