2 Replies Latest reply on Jan 26, 2010 3:12 AM by enotodden

    Httpservice problem - xml parsing error?

    enotodden

      I have been up all night trying to figure this out.. But I can't find a solution anywhere.
      I'm new to flex and just started trying out HTTPService for getting xml data from my database.

      I followed one of Lee Brimlow's videos (http://tv.adobe.com/#vi+f1472v1491) slightly modified to my usage, and i keep getting this error:

       

       

      [RPC Fault faultString="Error #1093: XML parser failure: Unterminated DOCTYPE declaration." faultCode="Client.CouldNotDecode" faultDetail="null"]

      at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()[C:\autobuild\3.2.0\frameworks\ projects\rpc\src\mx\rpc\http\HTTPService.as:851]

      at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:188]

      at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responde r.as:43]

      at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:74]

      at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:403]

      at flash.events::EventDispatcher/dispatchEventFunction()

      at flash.events::EventDispatcher/dispatchEvent()

      at flash.net::URLLoader/onComplete()

       

       

      So I was hoping someone here could help me figure this one out..

       

      My mxml(the write.php file has a misleading name, just reused an old one i had on my server):

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="xmlData.send()" >

      <mx:HTTPService url="http://www.enotodden.net/write.php" id="xmlData"/>

       

      <mx:DataGrid dataProvider="{xmlData.lastResult.posts.post}" width="100%" height="100%"/>

       

       

      </mx:Application>

       

       

       

       

      my PHP:

       

       

      <?php

      mysql_connect("localhost", "username", "password");

      mysql_select_db("database name goes here");

       

      $query = "SELECT * FROM table1";

      $result = mysql_query($query) or exit(mysql_error());

       

       

       

      print "<?xml version=\"1.0\"?>\n\n";

       

      print "<posts>\n";

      while($row = mysql_fetch_array($result))

      {

      print "<post>\n<title>";

      print $row['post_title'];

      print "</title>\n<content>";

      print $row['post_content'];

      print "</content>\n</post>";

      }

       

      print "</posts>";

       

      mysql_close();

       

      ?>