Problems on Windows 7 Professional 64 with PHP data service

I've created a data service using PHP in a PHP Eclipse project and I'm trying to connect to it from my new Flash project. When I try to create a custom data type via the Configure Return Type dialog, "Auto detect the return type from sample data" radio button, I get the following error:
There was an error while invoking the operation. Check  your operation inputs or server code and try invoking the operation again. 
Reason:
Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2003): Can't connect to MySQL  server on 'localhost' (10061) in  C:\Users\davidk\workspace\php-global-includes\mysqlAccess.inc.php on line  11
    /0/onStatusÿÿÿÿ �SIflex.messaging.messages.ErrorMessage extendedData faultCode faultDetail faultString rootCause correlationId clientId destination messageId timestamp timeToLive headers  body  „m …a#0  C:\Zend\ZendServer\share\ZendFramework\library\Zend\Amf\Server.php(550):  Zend_Amf_Server->_dispatch('getProductVersi...', Array, 'GetPlayData')#1  C:\Zend\ZendServer\share\ZendFramework\library\Zend\Amf\Server.php(626):  Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))#2  C:\Zend\Apache2\htdocs\play-debug\gateway.php(69):  Zend_Amf_Server->handle()#3 {main} ‚UError instantiating class GetPlayData to  invoke method getProductVersions: Error connecting to database server as user  via password configured in  config_cdna_testdb.php  IE83D9958-920E-E203-54BC-E5365BD85289 I5496259E-8C36-AC89-E234-00000D37FD49  I7E8A1BD7-9D60-9329-DBFB-00001B5BE8C7  126823334100     
Note that I've tested the GetPlayData class and the getProductVersions() method with some simple "unit testing" code and it works fine when I execute it directly. It just won't run when called from this dialog.
I tried to debug the gateway.php process that is used to do this connecting without much success so far.
Is Windows 7 supported for PHP data service development in this beta release? I'm using Version 4.0 build 253292

One more clue: the message from the exception shows that the global variables I'm using to configure the MySQL connection parameters are not set somehow. Maybe I need to upgrade my Zend Framework?
Nope. I upgraded to the latest Zend Framework and it still did not work. The global variables are not working. When I hard coded the connection parameters into the constructor of the GetPlayData class, then it worked fine. I just switched to using define() to create constants instead of using the globals and that worked, too.
It is as if globals set in one include file are not available in another include file. I agree that using them might be a bad programming practice of sorts, but it seems wrong to disallow / not support something that is part of the core language!
So, I don't know if this is a Windows 7 thing or just a general behavior. Globals within the same file seem to work fine still, but not from another include file.
So the answer for me is to not use these cross-include file globals in code that is going to be used from Flash Builder.

Similar Messages

  • Insert problems with Php Data Services

    Hi All,
    I am using Flex Data wizards to create a simple CRUD application and i am having problems adding data. It works the first time i start my application but subsequent calls to the insert fail.
    I am using FB2 Beta with MAMP. The php classes are being generated using the data wizard. i have tried commenting out mysqli_close but still it doesn't work.
    public function createDive_events($item) {
    $stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename ( divedate, divesite, divecost, description, totalDays) VALUES ( ?, ?, ?, ?, ?)");
    $this->throwExceptionOnError();
    mysqli_bind_param($stmt, 'ssdsi', $item->divedate, $item->divesite, $item->divecost, $item->description, $item->totalDays);
    $this->throwExceptionOnError();
    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();
    $autoid = mysqli_stmt_insert_id($stmt);
    mysqli_stmt_free_result($stmt);
    //mysqli_close($this->connection);
    return $autoid;
    Any ideas, what i am doing wrong. I have tried using the update and it works only once as well, it seems that the connection to the function is lost after the first call.
    thank you,
    Nayan

    Ok, this is what I got.
    create a mysql table (`people`) with columns id (auto increment), first_name, last_name, age
    in the data/service panel connect to a php service, generate a php service from the database and the people table
    generate a form from the createPeople service call
    observe that in source view we have something like this: <fx:Script>
      <![CDATA[
           protected function button_clickHandler(event:MouseEvent):void {
              createPeopleResult.token = peopleService.createPeople(people);
      ]]>
    </fx:Script>
    <fx:Declarations>
      <valueObjects:People id="people"
                           people_id="{parseInt(people_idTextInput.text)}"
                           age="{parseInt(ageTextInput.text)}"/>
      <peopleservice:PeopleService id="peopleService"/>
      <s:CallResponder id="createPeopleResult"/>
    </fx:Declarations>
    If you now try to execute the code, you will find that you can only insert one person, where each successive addition silently fails.
    There is nothing really wrong with the php code (well actually since it's auto incrementing on id you should pull all id reference out of the insert statements...) rather there is a problem with the flex people object.
    If you make the following changes the code will work
    protected function button_clickHandler(event:MouseEvent):void {
      var myPerson:People = new People();
      myPerson.first_name = people.first_name;
      myPerson.last_name = people.last_name;
      myPerson.age = people.age;
      createPeopleResult.token = peopleService.createPeople(myPerson);
    - e

  • PDF Generation with LiveCycle Data Services

    Hi everybody!
    I am using LiveCycle Data Services to generate a dynamic pdf. I worked with this tutorial : livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/pdfgen_1.html and i adapted the code to my own example.
    I created a pdf template with livecycle designer and i succeed to generate the pdf thanks to LiveCycle Data Services.
    Here is my problem :
    In LiveCycle Designer i create a table and bind my data connection (from xml source) to this table and i bind subforms to repeating data.
    It works when i try to open an overview of the pdf with LiveCycleDesigner.
    But when i try to generate the pdf with livecycle data service, there is no repeat of my data. There is only a number of items corresponding to the minimum of repeating i set in livecycle designer binding window...
    Is it possible to generate repeating data with LiveCycle DS ?
    an example of my xml source :
    <item id="1">
         <data>blabla</data>
    </item>
    <item id="2">
         <data>blabla</data>
    </item>
    In livecycle designer, if i set the minimum of repeating to 1,  LiveCycle DS generate a pdf with only one item.
    if i set the minimum of repeating to 2,  LiveCycle DS generate a pdf with only 2 items. etc.
    I don't know how to generate an indeterminate number of items...
    Thanks in advance for your help.
    Bye
    Guillaume

    Hi Guillaume,
    there is no limitation. Dynamic PDF files can be generated with Livecycle Data Services.
    You should have a look at the XML file generated by your Flex code. Try to save it and see how the XML file behaves when you generate a PDF preview with Designer. You can go to the menu:  File >  Properties > Preview > Use XML test data...
    With the XFAHelper class, you can either load a PDF or a XDP file. Have you tried with a XDP ?
    I've attached a dynamic PDF file that I've created for a customer. I generate a dynamic PDF file using LiveCycle Data Services. Maybe you'll find some clues within the file.
    Michael

  • Flash Builder 4.5 Auto-Gen Code For PHP Data Service Produces Errors

    Hello
    I'm currently running a fresh install of MAMP on my Mac and when I start a new flex project, add a php data service that pulls from a mysql database I have. Everything works fine until I try to compile. The error I'm getting is 'uid' being the primary key which is a bigint(20). The file _Super_Users.as (auto-gen based on the user table below) reports 2 errors: [Managed] requires uid to be of type 'String'. (same error on 2 lines of code) Now the MySQL table wants it to be a int, the auto gen code seems to want it to be an int as well but for some reason its putting in these requires for String on the getter and setters for 'uid'. The is before I even add any of my own code, just auto-gen then compile.
         * data/source property getters
    [Bindable(event="propertyChange")]
        public function get uid() : int /*error line*/
            return _internal_uid;
         * data/source property setters
        public function set uid(value:int) : void /*error line*/
            var oldValue:int = _internal_uid;
            if (oldValue !== value)
                _internal_uid = value;
    This is what my database looks when I export it:
    CREATE TABLE `users` (
      `uid` bigint(20) unsigned NOT NULL,
      `name` varchar(150) NOT NULL,
      `first_name` varchar(50) NOT NULL,
      `middle_name` varchar(50) NOT NULL,
      `last_name` varchar(50) NOT NULL,
      `gender` tinyint(1) NOT NULL,
      `locale` varchar(5) NOT NULL,
      `link` varchar(255) NOT NULL,
      `username` varchar(50) NOT NULL,
      `email` varchar(255) NOT NULL,
      `picture` varchar(255) NOT NULL,
      `friends` text NOT NULL,
      `created` datetime NOT NULL,
      `updated` datetime NOT NULL,
      PRIMARY KEY (`uid`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    It's empty right now...
    Apache 2.0.64
    MySQL 5.5.9
    PHP 5.2.17 & 5.3.5
    APC 3.1.7
    eAccelerator 0.9.6.1
    XCache 1.2.2 & 1.3.1
    phpMyAdmin 3.3.9.2
    Zend Optimizer 3.3.9
    SQLiteManager 1.2.4
    Freetype 2.4.4
    t1lib 5.1.2
    curl 7.21.3
    jpeg 8c
    libpng-1.5.0
    gd 2.0.34
    libxml 2.7.6
    libxslt 1.1.26
    gettext 0.18.1.1
    libidn 1.17
    iconv 1.13
    mcrypt 2.5.8
    YAZ 4.0.1 & PHP/YAZ 1.0.14
    I tried to give as much info as possible, if you need more let me know...

    I discovered my problem was uid seems to be a built in global or something and was filling in that data field with a bunch of letters and number, like the device id. Because of the letters flex was throwing a fit. So if you're using Facebook API in flex be sure to not go with uid for the user id, which is was facebook api calls it.

  • Using PHP Data Services to create an object and accessing that objects data in an unbound way in AS

    Hello,
    I've been able to use the php data services and bind the results of a function to a component. However I am having a hard time figuring out the syntax to use the data services to create an object out of the results, and then use that object as an array of filenames to provide the current index of the filename to a new sound object.
    My problem is obviously in not being able to figure out the specific syntax, I have declared the service and and object of the services returned type and in the creationComplete() function I have assigned object.token = service.getData();
    I've tried various ways of then pulling that data out of the object, with no success.
    Can someone point me in the right direction?
    This code probably looks horrible because it doesn't work yet.
    - Joel
                import flash.media.Sound;
                import flash.media.SoundChannel;
                import mx.controls.Alert;
                var playing:Sound = new Sound();
                var channel:SoundChannel = new SoundChannel();
                var sndIndex:int=0;
                var skpTr:String;
                public function init():void{
                 mp3Array.token = mp3service.getData();
                 currentTrack(mp3Array.lastResult.filename); 
                     trace(mp3Array.lastResult.filename[sndIndex]);
                public function currentTrack(t:String):void{
                    playing = new Sound();
                    playing.load(new URLRequest("mp3/" +t));
                public function skip():void{
                    stop();
                    if (sndIndex != mp3Array.lastResult.length-1){
                        sndIndex++;
                        var skipTr:String=mp3Array.lastResult.filename[sndIndex].data;
                        currentTrack(skipTr);
                        play();
                    } else {
                        sndIndex=0;
                        skipTr=mp3Array.lastResult.filename[sndIndex].data;
                        currentTrack(skipTr);
                        play();
                public function stop():void{
                    channel.stop();
                public function play():void{
                    channel = playing.play();
        <fx:Declarations>
            <s:CallResponder id="mp3Array"/>
            <mp3services:Mp3Service id="mp3service" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>

    Hello Joel;
    In retrieving your data - what is your php returning to FB, an object, object array, an array?  Either way, I have a brief example below that an object(s) is being returned.  Pull the data from the lastResult in a ResultEvent.  The object instantiated in the resultEvent will contain your data and you can do what you want from there. 
    Also, I always use Network Monitor to see what data (if any) is being returned from the server, you can also see how it is being sent back.
    John
    private function init():void
         mp3Array.token = mp3service.getData();
         mp3Array.addEventListener(FaultEvent.FAULT, faultHandler);
         mp3Array.addEventListener(ResultEvent.RESULT, mp3Array_resultHandler);
    protected function faultHandler(event:FaultEvent):void
         Alert.show("There was a fault error!" + event.message, "Fault Error", Alert.OK);
    protected function mp3Array_resultHandler(event:ResultEvent):void
         // Not sure if your service is sending back an object or an array or ?
        var info:Object = mp3Array.lastResult;
         doSomeFunction(info)
    protected function doSomeFunction(data:Object):void
         trace(info.filename);

  • Tutorial: Flash Builder 4 beta 2 and PHP Data/Services for beginners

    Hi fellas,
    I've written this tutorial for total beginners to get quickly to FB4 and PHP. Comments welcome
    Flash Builder 4 and PHP Data/Services for beginners
    http://www.flashrealtime.com/flash-builder-4-and-php-data-services/

    Hi,
    The first issue will be the pathing differences between wamp/mamp/xampp, some use www as root others htdoc you need to setup the php services on your local machine rather than importing a project.
    The created services will have a connection array declared at the top of the code that points to the mysql server, in the project default debug folder you will have the config file that has the zend and webserver path
    top of service file
    ============
    var $username = "root";
    var $password = "";
    var $server = "localhost";
    var $port = "3306";
    var $databasename = "zend";
    var $tablename = "clients";
    var $connection;
    amfconfig.ini
    =========
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    webroot =C:/wamp/www
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework\library
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
    ;zend_path =
    [zendamf]
    amf.production = false
    amf.directories[]=Zender-debug/services
    In your main project folder you have a .model folder the file there is an *.fml file that contains your channel endpoints etc.
    David.

  • Is LC Foundation bundled with LiveCycle Data Services

    I recently got this question - Do I get LC Workbench and LC Foundation when I buy LiveCycle Data Services?
    The answer is "No".
    With LiveCycle Data Services you get:
    1.       LiveCycle Data Services server - It works with most application server, but ship with a tomcat based turnkey option
    2.       Adobe Application Modeling Plugin - This is a plugin to Flash Builder 4 that enables to do Model Driven Development of Flex applications. This is "New in 3.0"
    Anil Channappa | Sr. Product Manager LiveCycle Data Services and Blaze DS
    Adobe Systems Inc | 21-61 Hickory Dr, Waltham, MA 02451-1011
    [email protected]<mailto:[email protected]>| 781.839.1331 | myBlog<http://anilchannappa.org/

    Hi Guillaume,
    there is no limitation. Dynamic PDF files can be generated with Livecycle Data Services.
    You should have a look at the XML file generated by your Flex code. Try to save it and see how the XML file behaves when you generate a PDF preview with Designer. You can go to the menu:  File >  Properties > Preview > Use XML test data...
    With the XFAHelper class, you can either load a PDF or a XDP file. Have you tried with a XDP ?
    I've attached a dynamic PDF file that I've created for a customer. I generate a dynamic PDF file using LiveCycle Data Services. Maybe you'll find some clues within the file.
    Michael

  • BAM Data Control - Group query with Active Data Service

    Trying to get a group query from a BAM data control to work with Active Data Service in an ADF application (JDeveloper 11.1.1.4.0).
    With a flat query, as the data changes, I can see DataChangeEvents fired, resulting in a data push to the client -
    <BAMDataChangeEventFilter> <log>
    #### DataChangeEvent #### on [DataControl name=CEP_Person_DOB_Flat, binding=data.view_mainPageDef.FlatDOB1.view_pageDefs_FlatDOBViewPageDef_WEB_INF_FlatDOB_xml_FlatDOB.QueryIterator]
    Filter/Collection Id : 1966
    Collection Level : 0
    Event Id : 5
    ==== DataChangeEntry (#1)
    ChangeType : INSERT_AFTER
    KeyPath : [2157, 0]
    InsertKeyPath : [null, 0]
    AttributeNames : [id, _PersonKey, _County, _Surname, _AGE, _DOB, _Country, _FirstName]
    AttributeValues : [2157, 10008/129, Vagzukarbsm, Gnnfzxxyqfgpsijcr, 110, Thu Dec 26 00:00:00 GMT 1901, Ekcqvrkoksr, Vwhm]
    When I try a group query on the same data, currently just trying to group by _DOB for every 10 years to count the number of people, I get no data change events fired, so don't get any data pushed to the client, though the data has been changed if I refresh the page.
    Any ideas ?

    can you include bam and jdev versions and also include exception from logs?

  • ORADC problem on Windows 2000 with Service pack 1 and service pack 2

    Hi,
    I have a VB application running on NT4.0 workstations. It uses
    ORADC control to talk to ORACLE 7.3 When I load it on Windows
    2000 with service pack 1 or service pack 2, I encounter some
    problems.
    The ORADC control is used in most of the VB forms and the
    Refresh method of the ORADC conrol is used to refresh the APEX
    TRUE DBGRID PRO control. When this action is executed, I receive
    a run time error
    "Method Refresh of object '_DORADC' failed Err#: -2147417848
    It works fine when no service pack is applied on Win2K.
    Can anyone tell me what's going on?
    Thanks

    satheesh_p wrote:
    Thanks for your reply.
    When I checked the system requirements. I couldn't find information on windows 2003 service pack 2
    link http://www.adobe.com/products/coldfusion/systemreqs/.
    Whether your OS is windows 2003 with service pack 2?
    Are you sure coldfusion 8 will work on windows 2003 with service pack 2?
    Regards,
    Satheesh.
    Well it was there, if you understand the naming properly:
    ColdFusion 8 system requirements
            Windows
    Intel® Pentium® II or AMD Athlon processor
    Microsoft®
    Windows® 2000 Professional with Service Pack 3; Windows 2000 Server,
    Advanced Server, or Datacenter Server with Service Pack 3; Windows
    Server® 2003 Web, Standard, or Enterprise Edition with Service Pack 1
    and R2; Windows Server® 2008; Windows XP Professional or Home Edition;
    or Windows Vista®
    R2 is the "offical" Microsoft name for service pack 2.

  • [FB4] PHP Data Service - how to use with DB2?

    Hi,
    I've tried to follow the tutorial that wires a datagrid to a PHP service. However I need to get data from DB2 rather than MySQL. I have created the service and populated an array using db2_fetch_object - the service works as I can call it with a simple test PHP script. However if I try to use this in the Data Service dialogs, when I get to the point of creating a return type for my getAllItems() call, it returns an error telling me to look in my server logs. My PHP logs say nothing.... Does this work with DB2? As far as I know the data returned by a db2_fetch_object is pretty close to the mysql version.
    Thanks
    NB my PHP code is as follows:
    public function getAllItems() {
            $rows=Array();
            $query_cust = ".....SQL in here.............";
            $conn = connectLocal();
            if ($conn) {
                //error_log("Got connection");
                $stmt = db2_prepare($conn, $query_cust);
                $thisrow=0;
                db2_execute($stmt,array(0));
                while($row = db2_fetch_object($stmt)){
                    $rows[$thisrow]=$row;
                    //error_log($row->CUSTNUM);
                    //error_log($rows[$thisrow]->CUSTNUM);
                    $thisrow++;
                db2_close($conn);
            return $rows;

    OK, if I remove the customer name field all works OK. So I tried reinstating the customer name field but modifying it in the returned array with a custom PHP function that replaces all the non-printing characters with acceptable ones. This function works ok when I create XML to use with Flex 3 datagrids, or with some javascript apps that use JSON arrays. But I still get the error. This is the function I use:
    function stripcharsnotblanks($input){
    $output = str_replace("&","+",$input);
    $output = str_replace('"',"",$output);
    $output = str_replace("²","+",$output);
    $output = str_replace("ü","ue",$output);
    $output = str_replace("ä","ae",$output);
    $output = str_replace("ö","oe",$output);
    $output = str_replace("Ö","Oe",$output);
    $output = str_replace("\'","'",$output);
    $output = str_replace("€","Eur",$output);
    $output = str_replace("/","",$output);
    $output = str_replace("%","pc",$output);
    $output = str_replace(">","]",$output);
    $output = str_replace("<","[",$output);
    $output = str_replace("@"," at ",$output);
    $output = str_replace(";",":",$output);
    return $output;
    Do you know of any other characters that could cause problems with AMF?
    Thanks

  • Php data service with something other than localhost for mysql

    Hello
    I'm trying to use an external host as an mysql source.
    I've used the 'generate from template' option and filled it out with the correct data.
    The php code is on my localhost on my mac.
    I've made a testfile in php to test my service and it seems to work and get the data from the database.
    But flashbuilder doesn't see an operation and when I try to refresh it says:
    java.lang.IllegalArgumentException: protocol = http host = null
    I get the same error if I try to 'generate from database' and I click the 'connect database' button.
    in the hostname field, I've tried the url to the server and also the IP (in case of a DNS problem), but either of them generate the same error.
    I hope some one can help me, so I can really start trying out the new data services.
    Thanks
    Johan Velthuis

    Thanks for replying, it works now!
    At first I got the error below, but after putting a ZendFramework folder in the /Library/Webserver/Documents folder my settings got accepted.
    Warning: require_once(Zend/Loader/Autoloader.php) [function.require-once]: failed to open stream: No such file or directory in /Users/johan/Sites/test/tempgateway.php on line 27
    Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader/Autoloader.php' (include_path='.:/usr/lib/php:/Library/WebServer/Documents/ZendFramework/library') in /Users/johan/Sites/test/tempgateway.php on line 27
    I think this is some kind of bug too, since I let the project wizard create a local ZendFramework folder in my project automatically, but it did not get used.
    It would really be great to have the webroot on a remote server through ftp or maybe afp in a private network to the remote server, but with only tapping into the remote database already solves a lot of problems for the workflow.
    In order to make this work (mysql remote connection) one should create a user on the mysql server with host '%' instead of 'localhost'.
    Since this is not very secure, you could also set the host to your external IP (if its not dynamic), or give that user only rights to your testdatabase.
    Thanks,
    Johan Velthuis

  • Problems with logical data service

    This is related to thread 837141 (Problems creating physical data service to relational table)
    I have been able to create the logical data service that uses the physical service (mentioned above).
    However when I try to create a library function to update (shown below)
    declare function lper:update($new as element(per:Persistance2)) as xs:boolean {*
    * let $changed :=*
    * for $n in $new*
    * let $old := lper:read($new/Project, $ew/Property)*
    * return*
    * fn-bea:replace-value(fn-bea:changed-element($old), "Value", $n/Value)*
    _let $return := {color:#ff0000}pper:update{color}($changed)_*
    * return fn:true()*
    WorkSpace Studio gives the following error (for the line underlined above, and the function in red)
    *{bea-err}FUNC002: Illegal use of side-effect procedure {ld:Physical/Persistance2}update with arity 1. Side-effect procedures cannot be invoked from a side-effect free context*
    Any idea why?

    functions, by definition, do not have side-effects. So calling something that had a side-effect (procedure) is not allowed.
    You need to create a library procedure.
    Your
    declare function lper:update($new as element(per:Persistance2)) as xs:boolean {*
    needs to be
    declare procedure lper:update($new as element(per:Persistance2)) as xs:boolean {*
    - mike
    Edited by: mikereiche on Dec 12, 2008 5:10 PM

  • Problems returning complex objects from a php data service

    either the data services tool is buggy or i am doing something wrong. here is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/halo"
         minWidth="1024" minHeight="768"
         xmlns:personservice="services.personservice.*"
         initialize="init()">
         <fx:Script>
              <![CDATA[
                   import mx.rpc.events.ResultEvent;
                   import mx.controls.Alert;
                   import mx.collections.ArrayCollection;
                   public var people:ArrayCollection;
                   private function init():void {
                        getPeopleInMyWorldResult.token = personService.getPeopleInMyWorld();
                   protected function getPeopleInMyWorldResult_resultHandler(event:ResultEvent):void {
                        people = new ArrayCollection(event.result as Array);
              ]]>
         </fx:Script>
         <fx:Declarations>
              <s:CallResponder id="getPeopleInMyWorldResult" result="getPeopleInMyWorldResult_resultHandler(event)"/>
              <personservice:PersonService id="personService"
                   destination="PersonService"
                   endpoint="http://localhost/photoapp/Test3-debug/gateway.php"
                   fault="Alert.show(event.fault.faultString)"
                   showBusyCursor="true"
                   source="PersonService"/>
         </fx:Declarations>
    </s:Application>
    <?php
    class Person {
         public $name;
         public $cars;
    class Car {
         public $year;
         public $make;
         public $model;
    class PersonService {
         public function getPeopleInMyWorld() {
              $person1 = new Person();
              $person1->name = "John Doe";
              $car1 = new Car();
              $car1->year = 2005;
              $car1->make = 'audi';
              $car1->model = 'A6 Quattro';
              $car2 = new Car();
              $car2->year = 1970;
              $car2->make = 'datsun';
              $car2->model = '510';
              $person1->cars = array($car1, $car2);
              $person2 = new Person();
              $person2->name = "Jane Doe";
              return array($person1, $person2);
    create a new "flex" project in FB Beta1 with a php server. Setup the application and php script as normal, then configure the return type for the getPeopleInMyWorld function. I created a new return type called "Person" and was quite please to see that FB automagically created a "Cars" class with the all the right properties.
    Unfortunately, if you run the code (try debug mode and put a breakpoint on the result handler) you'll notice that "john doe" has lost his cars and that you also get the silent (check console) error:
    TypeError: Error #1034: Type Coercion failed: cannot convert []@1226bc49 to mx.collections.ArrayCollection.
    any ideas??
    i can get this to work by using json, but it's extra work, the com.adobe.serializers.json.JSONDecoder has little documentation, and the method outlined above is just begging to work.
    so, how are the rest of you getting complex data back from your servers? json?? amfphp?? xml (but surely not)??
    also, since i'm here discussing data services, if any adobe ppl are about, please throw one extra voice behind the following feature requests:
    1) support for optional service call arguments (http://bugs.adobe.com/jira/browse/FB-19659)
    2) a button for automatically 'generating service calls' from within the data services panel.
    thanks,
    - e

    Thank you Gaurav for pointing me in the right direction. There was some debate in the blogs as to which data transferring method (amfphp, json, or xml) was best. See
    http://blogs.adobe.com/mikepotter/2006/07/php_and_flex_js.html
    and
    http://www.5etdemi.com/blog/archives/2006/12/clearing-the-fud-on-amfphps-speed-versus-json -and-xml/
    I used json yesterday
    php:  json_encode(array($p1, $p2));   // observation: you only have to encode once as opposed
                                          // to using amf on each array...
    FB:   private var jsonD:JSONDecoder = new JSONDecoder();
          var jsonString:String = {{{return result from service call}}}
          myPeople:ArrayCollection = jsonD.decode(jsonString, services.personservice.Person);
    Note that in FB you can use the services.personservice.Person class as an optional argument in the jsonD.decode function. This class can be automatically generated using FB's built-in data service's panel when you try to configure the return type (as I described above). The json data should unserialize correctly with Cars objects automagically created and everything (a huge time saver!!).
    It worked for me, though I'm not sure how deep the unserialization process is capable of going (objects within objects w/in objects, for example). Also I had some trouble with adobe's jsonDecoder; it had trouble eating (uhm parsing) hollow objects (i.e. objects with null properties), whereas the php_encode / php_decode handled these objects w/o fail.
    Anyway, will be reading up on amf. Tanx again Gaurav,
    - e

  • Unable to create records in database using PHP Data Service

    Hello, I've been stuck on this for a few days and search up and down for this on the net, no response I've found has worked, so I come to you...
    Here are the steps I've taken, I think it's pretty standard
    1. I have a macbook pro running osx 10.7.3
    2. I installed MAMP all default (I've acually reinstalled this because someone suggested this might fix it)
    3. Thru phpMyAdmin I created a database called my_test
    4. In that database I created a table, this is the export of that table: (I've also tried this with InnoDB which is the default)
    CREATE TABLE `customer` (
      `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
      `name` varchar(50) NOT NULL,
      `email` varchar(150) NOT NULL,
      PRIMARY KEY (`id`),
      UNIQUE KEY `id` (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
    5. I created a new Flx Project (Running Flash Builder 4.5.1 Premium)
         Project Name: PHPTest
         Application Type: Desktop (Although I've done the same thing with Web and got the same results)
         >> Next
         Application Server Type: PHP
         Web Root: /Applications/MAMP/htdocs/
         URL Root: http://localhost:8888/
         Clicked 'Validate Configuration' and that worked
         Output Folder: /Applications/MAMP/htdocs/PHPService (default by Flash Builder)
         >> Finished
    6. On the Data/Services tab on the bottom I click 'Connect to Data/Service...'
         Select 'PHP'
         >> Next
         Select 'Click here to generate a sample'
         Select 'Generate from database' radio button
         Username: root
         Password: root (default for MAMP)
         Host name: localhost
         Server port: 8889 (default for MAMP MySQL port, the HTTP port default is 8888 which in both cases seem to work but every video I've seen that uses MAMP on youtube uses 8889)
         Database: my_test
         Click 'Test Connection' (works)
         Table: customer
         Primary Key: id (this field is greyed out and Flash Builder selects 'id' which it figures out from the SQL table)
         >> Click OK
    7. Then if I don't have the Zend Framework folder in my /Applications/MAMP/htdocs/ folder it tells me its going to create that and I say alright. Then Flash Builder says stuff about how this is really only for testing and not production server ready and I say alright.
    8. Then it takes me back to the Form from Step 6 when I get the chance to select 'Click here to generate a sample'
         These fields are now filled with this data automaticly:
         PHP Class: /Applications/MAMP/htdocs/PHPTest/services/CustomerService.php
         Service name: CustomerService
         Service package: services.customerservice
         Data type package: valueObjects
         >> Click Next (shows all the functions that will be now availible)
         >> Click Finished (End of the forms and it opens Dreamweaver to the php file it created CustomerService.php which I have no need to edit so I close that down)
    9. Back in Flash Builder I switch to design view and drag a datagrid onto the big white area in the middle, whatever that is called.
    10. Then below in Data/Services tab on the bottom I click drag the function 'GetAllCustomer' on top of the datagrid.
         I say yes to rebound and click ok and the view of the datagrid is updated with the colums from the 'customer' table in mySQL.
    (Now let me say that when I hit save and compile this, if I actually had records in this table that I insert thru phpMyAdmin, this does show in the datagrid. So for the whole CRUD thing I am able to get the R which is Read)
    11. Now going back to the design view in Flash Builder I will create a form to create records in the table... (I guess this isn't really a step)
    12. In the Data/Service tab on the bottom I select 'createCustomer' function and then there is an icon called 'Generate Form' that looks like a white piece of paper with a gear on the bottom of it.
    13. This opens up a new form and since I don't have a crazy bunch of fields in my table I just click Finished (If you click next you can specify which fields you want to exclude from the form but this time I don't need to)
    14. This actually creates 2 forms if you look at the code, the second just shows the return type from when you click 'CreateCustomer' button on the first form. Because they overlap in design view I drag the form out of the way so you can see the input form, the return form, and the datagrid
    15. Then I save and compile...
    (Also if your actually reading this I didn't remove the id form field, I get the same result either way, but if you do remove the form field in the code/design you also have to update the button function to not deal with the id before it gets sent off to the php page since in this case the MySQL table is set to auto_increment the id, sorry this doesn't make much sence but this little area doesn't matter much either way)
    16. Now fill in whatever data you want for name and email, try differnt numbers in the id field like 0, nothing, 1, 1000 and click 'CreateCustomer'
    (For me nothing happens, no return is put in the return field, no error pops up and the datagrid is not updated with the new record, also going over to phpMyAdmin and checking out the table browse doesn't show any changes either, I know the button is calling the function because if I add a state change in that function it changes, it would seem that the line:
    createCustomerResult.token = customerService.createCustomer(customer2); doesn't do anything)
    So any idea what is wrong here, I'm convenced it's something stupid easy simple I just can't see it.

    In case you need more info, here is a code dump on a mxml project that has this problem:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx"
                           xmlns:customerservice="services.customerservice.*"
                           xmlns:valueObjects="valueObjects.*"
                           currentState="State1">
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.events.FlexEvent;
                protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                    getAllCustomerResult.token = customerService.getAllCustomer();
                protected function button_clickHandler(event:MouseEvent):void
                    var customer2:Customer = new Customer();
                    customer2.id = parseInt(idTextInput.text);
                    customer2.name = nameTextInput.text;
                    customer2.email = emailTextInput.text;
                    currentState = "Test";
                    createCustomerResult.token = customerService.createCustomer(customer2);
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="State1"/>
            <s:State name="Test"/>
        </s:states>
        <fx:Declarations>
            <s:CallResponder id="getAllCustomerResult"/>
            <customerservice:CustomerService id="customerService"
                                             fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                             showBusyCursor="true"/>
            <valueObjects:Customer id="customer"/>
            <s:CallResponder id="createCustomerResult"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:DataGrid id="dataGrid" includeIn="State1" x="330" y="10" width="392"
                    creationComplete="dataGrid_creationCompleteHandler(event)" requestedRowCount="4">
            <s:columns>
                <s:ArrayList>
                    <s:GridColumn dataField="id" headerText="id"></s:GridColumn>
                    <s:GridColumn dataField="name" headerText="name"></s:GridColumn>
                    <s:GridColumn dataField="email" headerText="email"></s:GridColumn>
                </s:ArrayList>
            </s:columns>
            <s:typicalItem>
                <fx:Object id="id1" email="email1" name="name1"></fx:Object>
            </s:typicalItem>
            <s:AsyncListView list="{getAllCustomerResult.lastResult}"/>
        </s:DataGrid>
        <s:Form includeIn="State1" defaultButton="{button}">
            <s:FormItem label="Id">
                <s:TextInput id="idTextInput" text="{customer.id}"/>
            </s:FormItem>
            <s:FormItem label="Name">
                <s:TextInput id="nameTextInput" text="{customer.name}"/>
            </s:FormItem>
            <s:FormItem label="Email">
                <s:TextInput id="emailTextInput" text="{customer.email}"/>
            </s:FormItem>
            <s:Button id="button" label="CreateCustomer" click="button_clickHandler(event)"/>
        </s:Form>
        <s:Form includeIn="State1" x="0" y="204">
            <s:FormItem label="CreateCustomer">
                <s:TextInput id="createCustomerTextInput" text="{createCustomerResult.lastResult as int}"/>
            </s:FormItem>
        </s:Form>
    </s:WindowedApplication>

  • Flash Builder 4 and PHP  Data/Services for beginners

    Hello,
    I'm new here, so I do not know if I posted my doubts in the right place.
    without much la la la go straight to the point.
    I am developing an application in flex / mysql / php / zend DataWizard and used the flex to create the data service.
    populei my dropdown with the desired data (cities) and populei my datagrid with their respective data (customer master), so far so good. That's when I came across a difficulty which already makes two weeks and try to solve anything. the little knowledge I have in programming know it's something silly, but I can not solve.
    Difficulty: I select a city in my dropdown and display all my customers registered in the same city in my datagrid. simple! I found some tutorials on the net talking about it, did exactly what her boss but unfortunately got no success (not populates the datagrid), may be doing algor be unable to realize. so it follows my code so they can help me. grateful!!
    FLEX CODE
    / / Populating DropDownList City
    protected function ddl_cidade_cadastro_solutions_creationCompleteHandler(event:FlexEvent):void
    getAllMunicipioResult.token = municipioService.getAllMunicipio();
    //Populating DataGrid
    protected function ddl_cidade_cadastro_solutions_changeHandler(event:IndexChangeEvent):void
    txt_recebe_cidade.text = ddl_cidade_cadastro_solutions.selectedItem.Cidade_PJ;
    getAllEmpresasResult.token = empresasService.getAllEmpresas(ddl_cidade_cadastro_solutions.selectedItem.Cidade_PJ);
    PHP CODE
    public function getAllEmpresas($q) {
    $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE 'Cod_Cidade_PJ' LIKE '%$q%'");
    $this->throwExceptionOnError();
    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();
    $rows = array();
    mysqli_stmt_bind_result($stmt, $row->Codigo, $row->CGC, $row->CEmpresa, $row->NomeFantasia, $row->RazaoSocial, $row->Endereco_PJ, $row->Bairro_PJ, $row->CEP_PJ, $row->Cod_Cidade_PJ, $row->Cidade_PJ, $row->Estado_PJ, $row->TelefoneDDD_PJ, $row->Telefone_PJ, $row->FaxDDD_PJ, $row->Fax_PJ, $row->Email_PJ, $row->RecEmail_PJ, $row->HomePage_PJ, $row->NumFunc, $row->CodPorte, $row->Porte, $row->CodRegiao, $row->Regiao, $row->CodCNAE, $row->CNAE, $row->Produto, $row->ExportaPais, $row->IndustriaSN, $row->AnuncianteSN, $row->RowNumber, $row->negrito);
    while (mysqli_stmt_fetch($stmt)) {
    $rows[] = $row;
    $row = new stdClass();
    mysqli_stmt_bind_result($stmt, $row->Codigo, $row->CGC, $row->CEmpresa, $row->NomeFantasia, $row->RazaoSocial, $row->Endereco_PJ, $row->Bairro_PJ, $row->CEP_PJ, $row->Cod_Cidade_PJ, $row->Cidade_PJ, $row->Estado_PJ, $row->TelefoneDDD_PJ, $row->Telefone_PJ, $row->FaxDDD_PJ, $row->Fax_PJ, $row->Email_PJ, $row->RecEmail_PJ, $row->HomePage_PJ, $row->NumFunc, $row->CodPorte, $row->Porte, $row->CodRegiao, $row->Regiao, $row->CodCNAE, $row->CNAE, $row->Produto, $row->ExportaPais, $row->IndustriaSN, $row->AnuncianteSN, $row->RowNumber, $row->negrito);
    mysqli_stmt_free_result($stmt);
    mysqli_close($this->connection);
    return $rows;

    Hi,
    The first issue will be the pathing differences between wamp/mamp/xampp, some use www as root others htdoc you need to setup the php services on your local machine rather than importing a project.
    The created services will have a connection array declared at the top of the code that points to the mysql server, in the project default debug folder you will have the config file that has the zend and webserver path
    top of service file
    ============
    var $username = "root";
    var $password = "";
    var $server = "localhost";
    var $port = "3306";
    var $databasename = "zend";
    var $tablename = "clients";
    var $connection;
    amfconfig.ini
    =========
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    webroot =C:/wamp/www
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework\library
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
    ;zend_path =
    [zendamf]
    amf.production = false
    amf.directories[]=Zender-debug/services
    In your main project folder you have a .model folder the file there is an *.fml file that contains your channel endpoints etc.
    David.

Maybe you are looking for

  • Problem in creating configuration bapi  BAPI_QUOTATION_CREATEFROMDATA2

    Hi  Gurus, I am creating quotation for config material using bapi BAPI_QUOTATION_CREATEFROMDATA2. Quotation is getting created without configuration. I am passing data to following bapi  tables  for configuration. QUOTATION_CFGS_REF STRUCTURE  BAPICU

  • "UNKNOWN FILE FORMAT" on N70

    Hi friends I've downloaded few games with with following file formats on my N70: JAR, RAR and JAD. When i try to open or install them I get an error message "Unknown File Format". What can do to resolve this or is there a software that i must install

  • I pad mini

    Is anyone having issues with the sound quality on a mini iPad? When using my Apple earbuds with this device, it seems that the sound isn't as good as my phone or my full size iPad.  Also, with movement of the mini iPad or wires, I am getting static a

  • WRTU54G-TM Internet / Blue-light & XP SP3 Issues

    So I've been wrestling with getting the WRTU54G-TM maintain a constant internet and "blue light" connection now for over a month.  I thought I had finally stabilized the situation (downloaded the set-up wizard from the Linksys site, as others recomme

  • Emailed Data into Numbers.

    I have a web store that sends order information to the purchaser and to me via email.  I'm trying to get that info into Numbers automatically so I don't have to spend hours (and make errors) getting items sold totals, etc.  Any way to do this? Thanks