I'm trying to get to grips with WebORB for PHP and Flex and making a
mess of it (so far). Currently I have edited the example files to
grab today's date , via PHP, from the server. It's a simple start to
get my head around WebORB / Flex as a means to an end. Here's the
wreckage so far:
1) Modified the \WebORB\WEB-INF\flex\remoting-config.xml file to include
<destination id="MySQLcommsDestination">
<properties>
<source>MySQLServices</source>
</properties>
</destination>
2) In the /services folder I have the file MySQLServices.php file
contaning:
<?php
class MySQLServices
{
public function getSystemDate()
{
public $systemDate;
public $todaysDate;
$sysDate = new systemDate();
$sysDate->todaysDate = date("l, jS F Y");
return $sysDate;
}
}
?>
3) My flex application is as follows:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.rpc.remoting.*;
import mx.controls.*;
import mx.rpc.events.*
private var remoteObject:RemoteObject;
public function onCreationComplete():void
{
remoteObject = new RemoteObject();
remoteObject.destination = "MySQLcommsDestination";
remoteObject.getSystemDate.addEventListener("result", onResult);
remoteObject.addEventListener("fault", onFault);
getInfo();
}
public static function onFault(event:FaultEvent):void
{
Alert.show(event.fault.faultString, 'Error');
}
private function onResult(event:ResultEvent):void
{
var currentSystemDate:Object = event.result;
currentUserText.text = currentSystemDate.todaysDate;
invokeButton.enabled = true;
}
private function getInfo():void
{
invokeButton.enabled = false;
remoteObject.getSystemDate();
}
]]>
</mx:Script>
<mx:Panel x="10" y="10" width="329" height="189" layout="absolute"
title="Info Service Example">
<mx:Label x="10" y="10" text="Current user:"/>
<mx:TextInput x="113" y="8" width="186" editable="false"
id="currentUserText"/>
<mx:Button id="invokeButton" x="166" y="116" label="Get Computer Info"
click="getInfo()" />
</mx:Panel>
</mx:Application>
but I've done something really stupid somewhere as I get a 'channel
disconnected' error, instead of seeing today's date in the
'currentUserText' control.
Any advice most welcome. Thanks.