Trouble executing "some" auto generated php remote services...?

Hi,
I was using the flash builder 4 premium trial with the 4.0 sdk, recently I bought the CS5 web premium suite. It includes flash builder 4.0.1 standard with 4.1 sdk.
1. create a new flex project (as in the welcome tutorial)
2. create a sample PHP service using my db infos (let it install Zend_AMF for me)
3. place a datagrid in the desing mode,
4. drop the the "getAll()" method on it
5. tweek some columns,
6. it works, I see the service call and answer with service capture (an external AMF service monitor).
the 2 problems that appear now (which were not existing in the 4.0 trial version I had)
1) add a new item
protected var newItem:dbItem;
protected function addBtn_clickHandler(event:MouseEvent):void
newItem = new dbItem();
newItem.attribute = 'someValue';
this.addDbItem(newItem:dbItem);
protected function addDbItem(item:dbItem:void
createDbItemResult.token = dbItemService.createDbItem(item);
<s:Button label="new item" id="addBtn" click="addBtn_clickHandler(event)"/>
When I click the button, absolutely NOTHING happens, no error, no service call, nothing at all.
2) refresh the datagrid's dataprovider
I followed the tutorial on how to bind an ArrayCollection to the dataGrid instead of binding it to "service.lastresult"
populate the ArrayCollection with the service result handler with event.result as ArrayCollection... everything works like before. whe the datagrid is created, it calls the "dataGrid_creationCompleteHandler".
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
this.getAllDbItem();
protected function refreshBtn_clickHandler(event:MouseEvent):void
this.getAllDbItem();
protected function getAllDbItemResult_resultHandler(event:ResultEvent):void
DbItems = event.result as ArrayCollection;
<s:Button label="refresh" id="refreshBtn" click="refreshBtn_clickHandler(event)"/>
this works!, the refresh button also works, BUT... it only refreshes item which have not bee edited within the app... if I change some item value with a form, (still using skills from the tutorial) :
- the data in the datagrid ARE UPDATED.
- the service.update(item) method DOES NOT EXECUTE (like the create above)
- if I update the DB manualy, ONLY the NON UPDATED rows refresh...
Any idea?
Thank you! I'm stuck here for hours and hours now :-(
the full MXML 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/mx" minWidth="955" minHeight="600" xmlns:moniteurservice="services.moniteurservice.*" xmlns:valueObjects="valueObjects.*">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
protected var moniteurs:ArrayCollection = new ArrayCollection();
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
getAllMoniteurResult.token = moniteurService.getAllMoniteur();
protected function button_clickHandler(event:MouseEvent):void
moniteur.statut = statutTextInput.text;
moniteur.nom = nomTextInput.text;
moniteur.prenom = prenomTextInput.text;
moniteur.tel = telTextInput.text;
moniteur.mobile = mobileTextInput.text;
moniteur.email = emailTextInput.text;
moniteur.adresse = adresseTextInput.text;
moniteur.npa = npaTextInput.text;
moniteur.lieu = lieuTextInput.text;
moniteur.pays = paysTextInput.text;
this.updateMoniteur(moniteur);
protected function updateMoniteur(item:Moniteur):void
updateMoniteurResult.token = moniteurService.updateMoniteur(item);
protected function button1_clickHandler(event:MouseEvent):void
getAllMoniteurResult.token = moniteurService.getAllMoniteur();
protected function getAllMoniteurResult_resultHandler(event:ResultEvent):void
moniteurs = event.result as ArrayCollection;
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getAllMoniteurResult" result="getAllMoniteurResult_resultHandler(event)"/>
<moniteurservice:MoniteurService id="moniteurService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<valueObjects:Moniteur id="moniteur"/>
<s:CallResponder id="updateMoniteurResult"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Binding source="dataGrid.selectedItem as Moniteur" destination="moniteur"/>
<mx:DataGrid x="25" y="24" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)"
dataProvider="{moniteurs}">
<mx:columns>
<mx:DataGridColumn headerText="id" dataField="id"/>
<mx:DataGridColumn headerText="statut" dataField="statut"/>
<mx:DataGridColumn headerText="nom" dataField="nom"/>
<mx:DataGridColumn headerText="prenom" dataField="prenom"/>
<mx:DataGridColumn headerText="tel" dataField="tel"/>
<mx:DataGridColumn headerText="mobile" dataField="mobile"/>
<mx:DataGridColumn headerText="email" dataField="email"/>
<mx:DataGridColumn headerText="adresse" dataField="adresse"/>
<mx:DataGridColumn headerText="npa" dataField="npa"/>
<mx:DataGridColumn headerText="lieu" dataField="lieu"/>
<mx:DataGridColumn headerText="pays" dataField="pays"/>
</mx:columns>
</mx:DataGrid>
<mx:Form defaultButton="{button}" x="25" y="174">
<mx:FormItem label="Statut">
<s:TextInput id="statutTextInput" text="{moniteur.statut}"/>
</mx:FormItem>
<mx:FormItem label="Nom">
<s:TextInput id="nomTextInput" text="{moniteur.nom}"/>
</mx:FormItem>
<mx:FormItem label="Prenom">
<s:TextInput id="prenomTextInput" text="{moniteur.prenom}"/>
</mx:FormItem>
<mx:FormItem label="Tel">
<s:TextInput id="telTextInput" text="{moniteur.tel}"/>
</mx:FormItem>
<mx:FormItem label="Mobile">
<s:TextInput id="mobileTextInput" text="{moniteur.mobile}"/>
</mx:FormItem>
<mx:FormItem label="Email">
<s:TextInput id="emailTextInput" text="{moniteur.email}"/>
</mx:FormItem>
<mx:FormItem label="Adresse">
<s:TextInput id="adresseTextInput" text="{moniteur.adresse}"/>
</mx:FormItem>
<mx:FormItem label="Npa">
<s:TextInput id="npaTextInput" text="{moniteur.npa}"/>
</mx:FormItem>
<mx:FormItem label="Lieu">
<s:TextInput id="lieuTextInput" text="{moniteur.lieu}"/>
</mx:FormItem>
<mx:FormItem label="Pays">
<s:TextInput id="paysTextInput" text="{moniteur.pays}"/>
</mx:FormItem>
<s:Button id="button" label="Submit" click="button_clickHandler(event)"/>
</mx:Form>
<s:Button x="322" y="200" label="Button" click="button1_clickHandler(event)"/>
</s:Application>
the full PHP service code:
<?php
*  README for sample service
*  This generated sample service contains functions that illustrate typical service operations.
*  Use these functions as a starting point for creating your own service implementation. Modify the
*  function signatures, references to the database, and implementation according to your needs.
*  Delete the functions that you do not use.
*  Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh
*  the service. Then drag service operations onto user interface components in Design View. For
*  example, drag the getAllItems() operation onto a DataGrid.
*  This code is for prototyping only.
*  Authenticate the user prior to allowing them to call these methods. You can find more
*  information at http://www.adobe.com/go/flex_security
class MoniteurService {
var $username = "root";
var $password = "mikedev";
var $server = "localhost";
var $port = "8889";
var $databasename = "test_db";
var $tablename = "moniteur";
var $connection;
* The constructor initializes the connection to database. Everytime a request is
* received by Zend AMF, an instance of the service class is created and then the
* requested method is invoked.
public function __construct() {
   $this->connection = mysqli_connect(
   $this->server, 
   $this->username, 
   $this->password,
   $this->databasename,
   $this->port
$this->throwExceptionOnError($this->connection);
* Returns all the rows from the table.
* Add authroization or any logical checks for secure access to your data
* @return array
public function getAllMoniteur() {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->statut, $row->nom, $row->prenom, $row->tel, $row->mobile, $row->email, $row->adresse, $row->npa, $row->lieu, $row->pays);
    while (mysqli_stmt_fetch($stmt)) {
      $rows[] = $row;
      $row = new stdClass();
      mysqli_stmt_bind_result($stmt, $row->id, $row->statut, $row->nom, $row->prenom, $row->tel, $row->mobile, $row->email, $row->adresse, $row->npa, $row->lieu, $row->pays);
mysqli_stmt_free_result($stmt);
    mysqli_close($this->connection);
    return $rows;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function getMoniteurByID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->id, $row->statut, $row->nom, $row->prenom, $row->tel, $row->mobile, $row->email, $row->adresse, $row->npa, $row->lieu, $row->pays);
if(mysqli_stmt_fetch($stmt)) {
      return $row;
} else {
      return null;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function createMoniteur($item) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (id, statut, nom, prenom, tel, mobile, email, adresse, npa, lieu, pays) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'issssssssss', $item->id, $item->statut, $item->nom, $item->prenom, $item->tel, $item->mobile, $item->email, $item->adresse, $item->npa, $item->lieu, $item->pays);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = $item->id;
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
* Updates the passed item in the table.
* Add authorization or any logical checks for secure access to your data
* @param stdClass $item
* @return void
public function updateMoniteur($item) {
$stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET statut=?, nom=?, prenom=?, tel=?, mobile=?, email=?, adresse=?, npa=?, lieu=?, pays=? WHERE id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ssssssssssi', $item->statut, $item->nom, $item->prenom, $item->tel, $item->mobile, $item->email, $item->adresse, $item->npa, $item->lieu, $item->pays, $item->id);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Deletes the item corresponding to the passed primary key value from
* the table.
* Add authorization or any logical checks for secure access to your data
* @return void
public function deleteMoniteur($itemID) {
$stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE id = ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Returns the number of rows in the table.
* Add authorization or any logical checks for secure access to your data
public function count() {
$stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $rec_count);
$this->throwExceptionOnError();
mysqli_stmt_fetch($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rec_count;
* Returns $numItems rows starting from the $startIndex row from the
* table.
* Add authorization or any logical checks for secure access to your data
* @return array
public function getMoniteur_paged($startIndex, $numItems) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->statut, $row->nom, $row->prenom, $row->tel, $row->mobile, $row->email, $row->adresse, $row->npa, $row->lieu, $row->pays);
    while (mysqli_stmt_fetch($stmt)) {
      $rows[] = $row;
      $row = new stdClass();
      mysqli_stmt_bind_result($stmt, $row->id, $row->statut, $row->nom, $row->prenom, $row->tel, $row->mobile, $row->email, $row->adresse, $row->npa, $row->lieu, $row->pays);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Utility function to throw an exception if an error occurs
* while running a mysql command.
private function throwExceptionOnError($link = null) {
if($link == null) {
$link = $this->connection;
if(mysqli_error($link)) {
$msg = mysqli_errno($link) . ": " . mysqli_error($link);
throw new Exception('MySQL Error - '. $msg);
?>

>
>  the service.update(item) method DOES NOT EXECUTE (like the create above)
>
I think you are not using the "commit" on the service. By default the Data services are "managed".
Data management features allow you to synchronize adding, updating, and deleting of records in a database. Changes you make in the client application are not written to the server until a "commit" method is called. You can call a revert method to roll back changes made in the client application.
So wherever you update or create add "commit" to the service after adding/updating. for eg.
protected function addDbItem(item:dbItem:void
     createDbItemResult.token = dbItemService.createDbItem(item);
     dbItemService.commit();
I think the following article might be of interest to you:
http://help.adobe.com/en_US/Flex/4.0/FlexTutorials/WSbde04e3d3e6474c4292a0331216558354b-80 00.html#WSbde04e3d3e6474c4-10020e8112165e18e29-8000

Similar Messages

  • Error generating PHP sample service

    Hi all,
    Running WinXP, FB4b2 (downloaded 210210), WAMP 2; Apache v2.2.11, PHP v5.2.9-2, MySQL 5.1.33.
    FB4 installed fine, only exception being the Zend framework prompted me to download the latest version of Zend once FB4 had installed an older version - I left it be, preferring to go with FB4's choice of framework.
    After creating a basic table in phpmyadmin and stepping through 'Connect to Data/Service', FB4 hangs for about 3-4 minutes (my system is fairy mean), and finally spits out "Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\ZendFramework\library\Zend\Db\Adapter\Pdo\Abstract.php on line 147".
    MySQL table dump:
    FB4v2 error log, PHP log, my WAMP phpinfo file all attached but sorry couldn't find the log referred to by Shikha in post 21, "Step 2" @ http://forums.adobe.com/message/2009071#2009071.
    All help appreciated, keen to get this sucker up and running so I can explore - I'm all enthused after the Adobe REFRESH Roadshow in Auckland
    - danjah

    Hi Sudhirm,
    Thanks for your reply, I gave that a shot, initially boosting it to 120 as suggested. I got the same error after 120 passed, the FB4 error duly noted that the length of time had expired (it said 120 instead of the old 30). So I then tried at 360. I also went to bed
    When I woke up in the morning, the error was thusly:
    Server error SQLSTATE[HY000] [2013] Lost connection to  MySQL server at 'reading initial communication packet', system error: 0
    Any further thoughts? I thought maybe on the off-chance that my quals were awry, I tried every flavour of username/login to access my mysql db (reason being I didn't have u/p set up, but do now), but it's definately 'admin' and 'password'.
    - danjah
    [[Edit]]
    After further testing, and running through these steps on another machine (XPSP2, WAMP2, FB4b2), I got the same results; first the timeouts, and then the error after increasing the max execution var to 360. I really, really don't want to use my time debugging database tables or php configurations - I just want to get busy with some cool stuff. So if anyone has a wicked link that can help give me a crash course in debugging this stuff quickly, or any suggestions, I'm offering a free beer if you travel to Wellington
    [[Edit]]
    Not providing a port number in the mysqli call allows connection, I'm guessing my mysql program is not listening to port 80?

  • Numbers-Auto Generating a numbered list in a column of cells

    Having trouble creating an auto-generating numbered list in a single column. In text inspector I choose bullets>numbers>start at 1. The first cell is filled in with a "1", but when I hit return or down arrow the 1 disappears. If I go back and type a "1" again, two "1's" appear in the same cell. I'm trying to make a table with 250 rows. Not sure what I'm missing, as I'm new to iWork.

    Numbers can fill a column or row of cells with a pattern. Type the first two numbers in the first two cells, select both cells, then click on the small circle at the lower right of the second cells & drag down to fill however many cells you want. You can see in this picture that it works for other patterns, not just consecutive numbers. I've also used it to fill across month names or dates.

  • Problem in using Auto-generated Table in Program

    Hi experts,
    I'm using some auto-generated table in my program. But the Problem is program is not activated due to non-existance of any type of table or structure or view of that Table type in the development server. i.e. table name in development is FMFMOADE12200014 and same in Production is FMFMOAPE14000018.
    How can I solve this problem to active the program and transport it?
    Thnaks in advance.
    Goutam

    Hi Friend  ,
    If  an Auto-generated tables  inside your program ,then you should not use that table directly  as internal table type .
    In that case you have used the Dynamic structure  in your program .
    tips is  you should check first the table is there in the  database  through your  programing using the standard function module for checking the table exsisting , then use the field symbols  for dynmaic creating of program  strucuture  ,including field creation  to tat strcuture  . this  will  make your  program more  lines in that  case you can  write  subroutine  for  creating the  fields  and adding  inside the dynamice strucure  .
    simple example  please see this link  :  [http://www.sap-img.com/ab030.htm]
    becasuse  we do have the  same  auto-generating table  concept  in Finance  base  on the Operating cencern  out table  name  & fields  inside  will be changing  ,Our  program has to support world wide Rollouts . so we used  dynamic structuring  inside Our program .
    Regards,

  • 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.

  • Auto generated service PR from maint, order

    Dear Experts,
    As you know while processing external services using control key PM03, a service PR will be generated for the service selected from the agreement or contract & from there we will create PO.
    Here in my case while creating PO from auto generated PR it is not carrying the condition type ( Discount entered the contract).Instead of that it gives the option to enter the condition type in the drop down list.Then we can select the condition type as discount & process the order.
    where as for the same service from the same agreement,if we create the PO from the manually created PR (not the auto generated from maintenance order) it carries the condition type of agreement (discount) to PO & the discounted price will be displayed automatically.
    Why it is not happening to auto generated PR? is there any particular settings are available? is there any notes available?
    Please help me out to come out of this problem.
    Thanks & best regards,
    Praveen

    Dear,
    I am extremely sorry for this issue. there was some problem with the program & rectified the same.
    Thanks & Best regards,
    Praveen

  • Code generated in FB 4 for php zend service

    I am trying the data generation stuff for php in FB 4
    I used to use amfphp and my class would look like this
    <?php
    error_reporting(E_ALL);
    require('DB_CONSTANTS.php');
    class AudioService{
        var $connection;
        function AudioService(){
            $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS);
            mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());
        function checkResetPasswordKey($key){
            if (!eregi("^[0-9a-zA-Z]{50}$",$key)) {
                throw new Exception('Bad key');
            /* Verify that user is in database */
            $q = "SELECT * FROM tbusers WHERE forgotPassKey = '$key' AND
    now() < forgotPassExpiry";
            $result = mysql_query($q, $this->connection);
            if (!$result) {
                $message  = 'Invalid query: ' . mysql_error() . "\n";
                $message .= 'Whole query: ' . $query;
                throw new Exception($message);
            if ((mysql_numrows($result) < 1)) {
                //throw new Exception('Your ');
            return $result ;
    ?>
    however in the code generated like FB 4 it looks like this, I wanted to know what advantages this has over my method.
    Thanks
    <?php
    class service {
        /*var $username = "nik";
        var $password = "tat0W";*/
        var $username = "root";
        var $password = "";
        var $server = "localhost";
        var $port = "";
        var $databasename = "nikk";
        var $tablename = "contactlist";
        var $connection;
        public function __construct() {
              $this->connection = mysqli_connect(
                                      $this->server, 
                                      $this->username, 
                                      $this->password,
                                       $this->databasename
            $this->throwExceptionOnError($this->connection);
         * Returns all the rows from the table.
         * Add authroization or any logical checks for secure access to your data
         * @return array
        public function getAllTbrawcontactlist() {
            $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename");       
            $this->throwExceptionOnError();
            mysqli_stmt_execute($stmt);
            $this->throwExceptionOnError();
            $rows = array();
            mysqli_stmt_bind_result($stmt, $row->id, $row->email, $row->dateCreated, $row->wantsEmails);
            while (mysqli_stmt_fetch($stmt)) {
              $rows[] = $row;
              $row = new stdClass();
              mysqli_stmt_bind_result($stmt, $row->id, $row->email, $row->dateCreated, $row->wantsEmails);
            mysqli_stmt_free_result($stmt);
            mysqli_close($this->connection);
            return $rows;
        private function throwExceptionOnError($link = null) {
             if($link == null) {
                $link = $this->connection;
            if(mysqli_error($link)) {
                $msg = mysqli_errno($link) . ": " . mysqli_error($link);
                throw new Exception('MySQL Error - '. $msg);
    ?>

    I am by no means an expert; furthermore, I do not know PHP, I use ColdFusion. But what I am about to say applies just the same.
    "however in the code generated like FB 4 it looks like this, I wanted to know what advantages this has over my method".
    Advantages? None, and probably some disadvantages. I have qualms about this "data-centric" paradigm. Just to do some fun testing, I created two little projects:
    Using the data-centric features of FB 4,
    http://www.timos.com/FB4/CartoonTestREL/CartoonTest.html;
    Resulting SWF size: 65 KB.
    Using a service I coded, a cusom component based on mx:UIComponent,
    http://www.timos.com/FB4/ToonTestREL/ToonTest.html;
    Resulting SWF size: 54 KB.
    These both have View Source enabled, so you can see the differences.
    Anytime you use a program to generate code, that code will almost always be much larger than if you code by hand.
    Look at the diference between the generated value objects and my single AS class. I have not run the profiler, so I don't know how many milliseconds' difference there is between how fast these run, but I suspect #2 is faster.
    You can go from here.
    Best regards,
    Carlos

  • Need to auto-generate SDK for REST web service.

    My company has developed a REST API for some web services, and we'd like to provide users with a Java SDK for consuming those services.
    Our services are described by an XSD schema. On the backend, we are using JAXB to create Java classes corresponding to the schema. We create the request objects based on the parameters in the REST url, and JAXB converts our response objects from Java to XML.
    We'd like to provide our users with similar Java classes on the client side. They should be able to create the object corresponding to the request, fill in various parameters, and submit it to our web service. The SDK should automatically convert the object into a REST URL, hit the URL with a Get, read the XML response, and convert that response into Java objects.
    It seems like we should be able to auto-generate such an SDK based on our schema.
    It seems like there are several tools for doing this for SOAP web services. For example, Apache Axis has Java2WSDL and WSDL2Java.
    Can anyone recommend tools for creating client-side libraries for consuming RESTful web services? Does anyone have advice on products to avoid?

    Replying to my own post here. The WADL2Java project on java.dev seems to be more like what I need. The only user-experience I've seen on the 'net is in this forum post:
    http://forum.java.sun.com/thread.jspa?threadID=5239123&tstart=0
    Anyone else used it?

  • EJB3 Web service - auto generate artifacts when deployed?

    Hello. I apologize in advance if this question was asked already, but I was unable to find an answer.
    Is there a way to tell WebLogic 10 to auto generate all of the required artifacts for a webservice (when deployed) instead of having to manually run the jwsc ant task on each web service class file?
    Thanks,
    Mike

    It is now working
    Regenerating everything form scratch made the stuff working
    From my experience:
    - the function you call in the web service should be available in remote and local interface
    - ArrayList or [] both works. The classes returned inside the List should implement Serializable
    - you do not have anything to change in the VI or any SAP file

  • How to change Auto-generated web service's URL

    Hi,
    is it possible to change/edit the auto-generated url of a web services created with the wizard in SE80 transaction?
    Example:
    Now the wizard generates a URL as following:
    http://<host name>:8080/sap/bc/srt/wsdl/bndg_4BC67655E5155680E10000000A7B0410/wsdl11/allinone/standard/document?sap-client=001
    where the alfa-numeric code 4BC67655E5155680E10000000A7B0410 changes every time I create the service. at the same time and for the reason above, I have to change the LOGICAL DESTINATION with "visual administrator" application to consume the service in SAP Netweaver environment.
    Thanks in advance.
    Luca

    Hi Luca,
    Please refer the below link . it is described that URLs and its Namespaces  . Please check whether its useful.
    [http://help.sap.com/saphelp_nw70/helpdata/EN/8c/780741375cf16fe10000000a1550b0/frameset.htm] .

  • How to Create a Auto Generated number with some preceding text in Sharepoint 2010

    I am trying to create a auto generated number field in Sharepoint 2010 list item. My requirement is to have the following format number generated when new request is created in Sharepoint using form. Auto generated Ticket ID should be in the following format
    "IR13000" "IR13001" "IR13002"....... Please let me know how to get this done. I tried to use combination of default ID and Characters but its not working for new requests, its only reflecting for existing uploaded requests. I
    am trying this for taking up Ticket requests by filling up some fields in the form. Any quick help is much appreciated.
    Thanx

    Here are the steps:
    1 - Open your SharePoint site in SP Designer 2010.
    2 - Click Workflows and add a List workflow. Associate this workflow on the list where you want the Random Text to be generated.
    3 - Inside the workflow editor, select the Action "Update list item"
    4 -  Select 'Current Item'.
    5 - Click Add.. and select the field which needs to be updated with the Random Text. Make sure this column is not of type "Calculated" type, otherwise you won't see it in the list of the fields within the workflow.
    6 - Click "..." button in the next textbox which will open String Builder dialog box.
    7 - Type IR and then click 'Add or Change Lookup and select ID column from "Field from source". Hit OK.
    8 - It should look like IR[%Current Item:ID%]
    9 - Hit OK.
    10 - Save and publish the workflow. (Please note that currently this workflow is not set to auto run on creating new items. That's because we want to test it at this point of time).
    11 - Go to your list in SharePoint and create a new item. After creating, select the item and click Workflows and then run this workflow.
    12 - You should be able to see the text "IR1" in the designated column.
    13 - Once you see that it's working, go to SPD and set the workflow to run automatically on creation of the new item. Save and publish and then return to your list in SharePoint.
    14 - Create a new item there and you should see the Random value in the column.
    15 - You will also see the column in the New form. In order to remove it, go to List settings > content types > Item content type > and select Hidden for this column so that it doesn't showup in any form.
    Try it and let me know how it goes.
    Thanks,
    Ashish

  • Completely different AMF request packets for same remote service call from Flex to PHP using ZendAMF

    I was trying to debug why one of the remote-services in our Flex application was failing randomly. What I found was interesting. Completely different AMF request packets were sent for same remote service call from Flex to PHP.
    When the service call succeeds the AMF request packet looks like the following:
    POST /video/flex/bin-debug/gateway.php HTTP/1.1
    Host: localhost
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Cookie: PHPSESSID=j6u30i8uu6c3cvp8f4kipcpf05
    Referer: http://localhost/video/flex/bin-debug/main.swf/[[DYNAMIC]]/5
    Content-type: application/x-amf
    C    ontent-length: 305
    Flex Message (flex.messaging.messages.RemotingMessage)     operation = getMemberFromEvent    clientId = 2F997CD0-7D08-8D09-1A9B-0000422676C8    destination = MembereventService    messageId = B46AB58D-2241-83F0-41E4-9FE745565492    timestamp = 0    timeToLive = 0    body =     [      280    ]    hdr(DSId) = nil
    And when the service fails the AMF request packet looks like this:
    ServiceRequest: getMemberFromEvent; RemoteService; getMemberFromEvent
    (mx.messaging.messages::RemotingMessage)#0
      body = (Array)#1
        [0] 250
      clientId = "1AA4FAAB-AEA5-8109-4B0D-000002B3A9A1"
      destination = "MembereventService"
      headers = (Object)#2
        DSEndpoint = (null)
        DSId = "nil"
      messageId = "2F92E6C0-FE92-A09B-B150-9FE2F28D9738"
      operation = "getMemberFromEvent"
      source = "MembereventService"
      timestamp = 0
      timeToLive = 0
    Also, following is the error message on Flex when the service fails:
    {Fault code=Channel.Call.Failed, Fault string=error, Fault detail=NetConnection.Call.Failed: HTTP: Failed, Destination=MembereventService}
    We are using Swiz as the micro-architecture for Flex development and Zend AMF for remoting between Flex and PHP.
    Any ideas what is wrong here, what is causing Flex to send different request packets for the same service & what I can do to fix it?

    Hi, I know that your post is almost 5 years ago, but have you found the solution to this issue?
    Thanks.

  • Where is the jaxrpc-ri.xml file when auto-generating web services?

    Is it possible to modify the targetNamespace property and endpoints directly from the SUN ONE studio 5 IDE??
    We have upgraded from using the JWSDP and are using the studio tools to auto-generate the server artifacts, only we cannot modify the endpoints to match our old JWSDP jaxrpc-ri.xml file. I have no desire to auto-generate then manually edit all the *Serializer.java files.
    Cheers,
    Ben

    Ben,
    it should be somewhere in your jwsdp_base or jwsdp subdirectory in your user directory. The user directory is called studio5se_user unless you have decided to use something different.
    Regards Jirka

  • HOW TO GET AUTO GENERATED PRIMARY ID KEY BACK FROM AN INSERT STATEMENT IN .

    Just recently I ran into a problem with what seems to be a deficiency in the Oracle Database. When trying to return an auto-generated key as is done in Microsoft's SQL database, it seems Oracle for whatever reason didn't add this capability, the key couldn't be passed back to the .Net call. After tinkering with the .Net software and talking with the Oracle techs, a decent work around to the problem (presented here) comes fairly close. Two things have to be done first before this will work. A sequence has to be created on the Oracle DB. Also a trigger has to be created against the table the keys are going to be returned from.
    The class works by passing to the function 'update_datasets_return' a DataSet with as many tables as you want. The function spins through the tables and put the keys in each row inserted. It's assumed the first row will either be the primary key or some numeric value. This can be changed by modifying the: dt.Columns(0).ColumnName
    Notice the word Inserted. On Updates and Deletes the key value is ignored because it's already present. The routine just updates the database as usual.
    So in other words you could send a table to the function with rows inserted, deleted, or updated and it will take care of them all. One routine for all.
    ' ======================================================================
    ' Created by SEF and Oracle SR: 5607364.993 This is a complete Redo
    ' of the initial concept. SEF...
    ' Sample of sequence and trigger at bottom.
    ' Uses the ODP.NET data provider.
    ' update_datasets_return: Goes thru each table in the dataset and
    ' updates, deletes, or inserts as needed.
    ' If inserting, a 'sequence counter' and a 'trigger'
    ' using the 'before insert' must be present. The sequence
    ' counter is set to auto increment by 1 starting at 1.
    ' The trigger is specific to the table.
    ' Create the trigger and sequence in the database or run the samples
    ' below in PL/SQL. Be sure the logon with a user that has enough rights.
    ' Routine assumes the first column is going to hold the sequence
    ' number. Actually any column could be used. Just change the
    ' dt.Columns(0).ColumnName to whatever you want or leave as default.
    ' The da_RowUpdated sub is where the 'sequence number' gets returned
    ' on each row that is inserted into a table. Routine is ignored on
    ' deletes and updates. SEF...
    ' =======================================================================
    Imports System
    Imports System.Data
    Imports Oracle.DataAccess.Client
    Imports Oracle.DataAccess.Types
    Public Class OracleUpdate
    Private Shared m_conn As OracleConnection
    Private Shared da As New OracleDataAdapter
    Private Shared dt As DataTable
    Private Shared conn As New OracleConnection
    Private Shared dr As DataRow
    Private Shared astep As Long
    Private Shared rwIndex As Integer = 0
    Private Shared tblIndex As Integer = 0
    Public Shared Function update_datasets_return(ByVal constr As String, ByVal ds As DataSet) As DataSet ''ByRef ds As DataSet)
    Dim selectstmt As String
    m_conn = New OracleConnection(constr)
    Try
    m_conn.Open()
    Catch ex As Exception
    Throw New ArgumentException(" Error: connection lost." & ex.Message)
    End Try
    For Each dt In ds.Tables
    ''Uncomment the code only if auto numbering
    ''is NOT turned on for the table being updated. SEF...
    ''rwIndex = 0
    ''For Each dr In dt.Rows
    '' Try
    '' Select Case dr.RowState
    '' Case DataRowState.Added
    '' astep += 1
    '' ' =======================================================
    '' ' This "Try Catch" section created only if auto numbering
    '' ' is NOT turned on for the table being updated. SEF...
    '' ' It's a crude attempt at creating a unique number.
    '' ' A more serious approach would be to use a GUID.
    '' ' Use only if you decide not to have a sequence and a
    '' ' trigger for the table.
    '' ' =======================================================
    '' Try
    '' 'ds.Tables(tblIndex).Rows(rwIndex).Item(0) = astep
    '' Catch
    '' ' ignore the error corrected integer identity so don't randomize it
    '' End Try
    '' dr.Item("createdDate") = Now
    '' dr.Item("changedDate") = Now
    '' Case DataRowState.Modified
    '' dr.Item("changedDate") = Now
    '' End Select
    '' Catch ex As Exception
    '' conn.Close()
    '' conn.Dispose()
    '' Throw New ArgumentException(" Error: update_datasets " & ex.Message)
    '' End Try
    '' rwIndex += 1
    ''Next
    selectstmt = "SELECT * From " & dt.TableName & " Where " & dt.Columns(0).ColumnName & " = " & 0
    da = New OracleDataAdapter(selectstmt, m_conn)
    Dim bldr As OracleCommandBuilder = New OracleCommandBuilder(da)
    AddHandler da.RowUpdated, New Oracle.DataAccess.Client.OracleRowUpdatedEventHandler(AddressOf da_RowUpdated)
    Dim insCmd As OracleCommand = Nothing
    Try
    insCmd = CType(bldr.GetInsertCommand(), OracleCommand)
    Catch ex As Exception
    Throw New Exception("")
    End Try
    insCmd.CommandText += " returning " + dt.Columns(0).ColumnName + " into :seqno"
    insCmd.Parameters.Add(New OracleParameter("seqno", OracleDbType.Int16, _
    4, ParameterDirection.Output, False, CType(0, System.Byte), CType(0, _
    System.Byte), dt.Columns(0).ColumnName, DataRowVersion.Current, Nothing))
    da.InsertCommand = insCmd
    Try
    ' ===========================
    da.Update(ds, dt.TableName)
    ' ===========================
    Catch ex As Exception
    Throw New ArgumentException(" Error: update_datasets_return " & ex.Message)
    End Try
    Next
    m_conn.Close()
    m_conn.Dispose()
    Return ds
    End Function
    Friend Shared Sub da_RowUpdated(ByVal sender As Object, ByVal e As OracleRowUpdatedEventArgs)
    If e.StatementType = StatementType.Insert Then
    e.Row(0) = Int64.Parse(e.Command.Parameters("seqno").Value.ToString())
    End If
    End Sub
    ' ================================================================================
    ' Notes:
    ' =================== How To -- Sample section for PL/SQL ==================================
    ' myTrigger, myTable, mySequence, and myColumn are values you need to supply.
    ' Note: A trigger needs to be created for each table.
    ' A sequence needs to be created only once and referenced each time
    ' in the trigger(s). Or you could create a new sequence each time you
    ' create a trigger. Sort of a waste of effort.
    ' Explanation:
    ' myTrigger = The name you are giving this trigger.
    ' If a trigger with same name already
    ' exist, it will be overwritten.
    ' myTable = Table you want to add the sequence numbers to.
    ' mySequence = Sequence counter you created. Whatever name you called it.
    ' myColumn = The column to update with the sequence number.
    ' =================================================================================
    ' -- Run in PL/SQL or create at DB. --
    ' create or replace trigger myTrigger
    ' before insert on myTable for each row
    ' begin
    ' select mySequence.nextval into :new.myColumn from dual ;
    ' end;
    ' -- Run in PL/SQL or create at DB. --
    ' create sequence mySequence
    ' MINVALUE 1
    ' START WITH 1
    ' INCREMENT BY 1
    ' NOCACHE; can be set to CACHE but sequence may contain gaps.
    ' Explanation of CACHE from: http://www.techonthenet.com/oracle/sequences.php
    ' With respect to a sequence, the CACHE option specifies how many sequence
    ' values will be stored in memory for faster access. The downside of creating
    ' a sequence with a CACHE is that if a system failure occurs, all cached
    ' sequence values that have not be used, will be "lost". This results in
    ' a "gap" in the assigned sequence values. When the system comes back up,
    ' Oracle will CACHE new numbers from where it left off in the sequence,
    ' ignoring the so called "lost" sequence values.
    ' Note: To recover the lost sequence values, you can always execute an
    ' ALTER SEQUENCE command to reset the counter to the correct value.
    ' NOCACHE means that none of the sequence values are stored in memory.
    ' This option may sacrifice some performance, however, you should not encounter
    ' a gap in the assigned sequence values.
    End Class
    C#:
    using System;
    using System.Data;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    public class OracleUpdater2
    private static OracleConnection m_conn;
    private static OracleDataAdapter da = new OracleDataAdapter();
    private static OracleConnection conn = new OracleConnection();
    public static DataTable load_it(string constr, string strqry, string tblName)
    // =====================================================================
    // constr = User Id=myUser;Password=myPass";Data Source=myDataSource
    // strqry = Select * from something?
    // tblName = The table name to fill.
    // =====================================================================
    conn = new OracleConnection(constr);
    conn.Open();
    da = new OracleDataAdapter(strqry, conn);
    OracleCommandBuilder bldr = new OracleCommandBuilder(da);
    DataTable dt = new DataTable(tblName);
    da.Fill(dt);
    conn.Dispose();
    return dt;
    public static DataSet update_datasets_return(string constr, DataSet ds)
    //'ByRef ds As DataSet)
    string selectstmt = null;
    m_conn = new OracleConnection(constr);
    try
    m_conn.Open();
    catch (Exception ex)
    throw new ArgumentException(" Error: connection lost." + ex.Message);
    foreach (DataTable dt in ds.Tables)
    selectstmt = "SELECT * From " + dt.TableName + " Where " +
    dt.Columns[0].ColumnName + " = " + 0;
    da = new OracleDataAdapter(selectstmt, m_conn);
    OracleCommandBuilder bldr = new OracleCommandBuilder(da);
    da.RowUpdated += new
    Oracle.DataAccess.Client.OracleRowUpdatedEventHandler(da_RowUpdated);
    OracleCommand insCmd = null;
    try
    insCmd = (OracleCommand)(bldr.GetInsertCommand());
    catch (Exception ex)
    throw new Exception("" + ex.Message);
    insCmd.CommandText += " returning " + dt.Columns[0].ColumnName + " into
    :seqno";
    insCmd.Parameters.Add(new OracleParameter("seqno", OracleDbType.Int16, 4,
    ParameterDirection.Output, false, System.Convert.ToByte(0),
    System.Convert.ToByte(0), dt.Columns[0].ColumnName, DataRowVersion.Current,
    null));
    da.InsertCommand = insCmd;
    try
    // ===========================
    da.Update(ds, dt.TableName);
    // ===========================
    catch (Exception ex)
    throw new ArgumentException(" Error: update_datasets_return " +
    ex.Message);
    m_conn.Close();
    m_conn.Dispose();
    return ds;
    If you need a working program of how this works, let me know.

    Oh my god, it is too long! You definitely check out types, casting and especially ODP.Net (it does everything for you)... etc. They can help you to simplify your code. I do not have enough time to copy paste it to Studio and understand and solve your issue, so I got title of your message as your main question.
    In Oracle, you can create an autonumber field by using sequences object. This is really useful when you need to create a unique number to act as a primary key.
    Basically you can create a sequence simply typing;
    CREATE SEQUENCE MY_SEQUENCE;
    now you have a sequence called "MY_SEQUENCE"... Then, I advice you select a number from sequence;
    select MY_SEQUENCE.nextval from dual;
    I said I advice actually kinda must, although it called sequence, I cannot be sequential. Do not even try to predict the value. You can be sure that it is unique number so you can use it.
    Then insert you record and use that number part of your primary key. I think that's it. Have fun.

  • 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.

Maybe you are looking for

  • Credit control area to sales area

    hi sd gurus can we have credit control are setup to sales area,when it is already setup in company code,,,,.. thanks regards vivek

  • Sap Tutor Installation error "target installation not found"

    Hi All I am getting an error when ever i am installaing SAP tutor full in WIN2K3 saying that "Target Installation Not Found" But when i am installing on windows XP there was no problem. Please suggets Sudhakar A

  • Yahoo email account synchronisation on mac mini

    Hi I have been struggling to get my yahoo email account on my mac mini I can get the email on my iPad it did work on my mac mini. But now it does not... any ideas.?.. Thanks

  • Adjustment in close fiscal year

    Hi Friends, We close the 2009 fiscal year now we need to pass some adjustements in that fiscal year. Please tell me what is the proccess thanks, Chitra

  • Vista SP 2 made AE much - I repeat MUCH faster!

    When purchasing AE just a couple of months ago, I was somewhat disappointed abot its sluggishness. Lots of moaning, and puff coming out of my PC's mobo fans (I am exaggerating a little here). Loading a project took ages, it seemed. And while it funct