1 Reply Latest reply on Apr 11, 2008 11:02 AM by powerflex

    HTTPService Error

      I've been struggling with this for several days now.. so any input at all would be appreciated!

      I have an app that (among other things) loads a simple XML file and displays it in a dataGrid. Slightly simplified code:

      [Bindable] public var myData:ArrayCollection;

      private function getFeed(event:ResultEvent):void{
      myData = event.result.root.asset;

      private function init():void {
      xmlFeed.url=" http://localhost/cc/getList";

      <mx:HTTPService url="" method="POST" id="xmlFeed" result="getFeed(event)" />

      <mx:DataGrid id="dataGrid" width="400" dataProvider="{myData}">
      <mx:DataGridColumn dataField="name" headerText="name" />
      <mx:DataGridColumn dataField="type" headerText="type" />

      My URL, " http://localhost/cc/getList" is a Struts (Java framework) call that returns an XML file. If I build a flex application with this exact code and run it in the browser, everything works fine.

      When I run this exact code in an AIR application, I get an error message:
      XML parser failure: Unterminated element." faultCode="Client.CouldNotDecode" faultDetail="null"

      These are two different projects, but they are identical in every way except one is "Application" and the other is "WindowedApplication".

      If I change the URL to point to a physical XML file (e.g. mData.xml) it works in both environments.

      Has anyone experienced this? Any ideas?

      The frustrating thing is that it works in one environment (browser) and not in the other (AIR) so I'm certain the XML is valid even though the error seems to say otherwise.

      Any help/thoughts greatly appreciated.
        • 1. Re: HTTPService Error
          Sorry, I dont know the answer. I had endless amounts of trouble trying to do what you are describing also, and ended up just putting the xml into a variable in the response and converting it to an XML object in the flex app. So the server would return xml=<data>...</data> and the app would post: xml=<newdata>...</newdata>