5 Replies Latest reply on May 23, 2010 7:59 AM by wawka0807

    Problem with data/service connection

    wawka0807

      Hi,

       

      I really need a help with connecting via Data/Services to my php class.

       

      Every time I try to connect I get this error:

       

      Make sure that Zend Framework is installed correctly and  the parameter "amf.production" is not set to true in the amf_config.ini file  located in the project output folder.     /0/onResult˙˙˙˙ � Uflex.messaging.messages.AcknowledgeMessage correlationId clientId destination messageId timestamp timeToLive headers  body I7E1E21E4-DB0E-77B1-ABA3-CB9880AE189D I05AA20AB-5167-FA68-9BAF-000050FFDC3C  I005EF7ED-A839-6F89-4B76-00005EBA80D9  127454094300      �M

       

       

      The parameter  "amf.production"  is set to false.

       

      When I choose an option "generate a sample", Flex has no problem with generating proper methods from my database but if I bind for example method:

       

      getAllLanguages() to datagrid, when I run application I get another error:

       

      Channel disconnected

      Channel disconnected before an acknowledgement was received

       

      I was looking for answer of my problem but I couldn't find any solution, so please help.

       

      My Flash Builder is standard version and my operation system is Window Vista.

       

      When I worked on Windows XP and Flash Builder Premium everything worked fine.

        • 1. Re: Problem with data/service connection
          nikos101 Level 2

          are you writing your own php services?


          • 2. Re: Problem with data/service connection
            wawka0807 Level 1

            Yes, I'm trying to connect with my own service. This is my code:

             

            include 'Language.php';
            
            class LanguageService {
                 
                 protected $host = "localhost";
                 protected $username = "root";
                 protected $password = "wawa0807";
                 protected $db = "smart_learning";
                 
                 protected function connect()
                 {     
                      $connection = mysql_connect($this->host,$this->username,$this->password)
                      or die ("Unable to connect to database.");
                      
                      $db = mysql_select_db($this->db)
                      or die ("Unable to select database.");
                 }
                 
                 public function getLanguageList()
                 {
                      $this->connect();
                      $rs = mysql_query("select * from languages")
                      or die ("Unable to complete query.");
                      
                      $languageList = array();
                      
                      while( $row = mysql_fetch_assoc($rs) )
                      {
                           $language = new Language($row['id_lang'], $row['abbreviation'], $row['description']);
                           array_push($languageList, $language);     
                      }
                      
                      return $languageList;
                 }
                 
                 
            }
            

            • 3. Re: Problem with data/service connection
              wawka0807 Level 1

              Ok, I found the solution but I don't understand it.

               

              I changed the encoding from utf-8 to ANSI and it worked. Is there any information about encoding php files in documentation? If it is so important I think it sholud be there.

              • 4. Re: Problem with data/service connection
                nikos101 Level 2

                Using die() is not recommended as you will see a "Channel Disconnected" message when something goes wrong. Die() stops the construction of a complete AMF response, hence this message.

                • 5. Re: Problem with data/service connection
                  wawka0807 Level 1

                  Ok, I found the real source of my problem. I was using polish version of Dreamwever to create my php file. There is an option which is active as default during saving the file: Include Unicode Signature (BOM). If you deactivate this option, even files with utf-8 encoding work fine.