I have not modified the remoting-config.xml file. It is still the same as when I installed WebORB.
The code I posted does not need any XML config settings as everything is set with the AMFChannel and channelSet instructions. --- In [email protected], "timgerr" <[EMAIL PROTECTED]> wrote: > > Thanks for the reply, can you tell me what the RemoteClass metadata > looks like, this is an entry in your > weborb\Weborb\WEB-INF\flex\remoting-config.xml??? > > Thanks for the help, I just want to learn. > > timgerr > > Note the RemoteClass metadata. This tells flex the location of the > class on the server that matches this class (In relation to the > Services directory). > > Finally we have the Flex application that makes calls to functions > within this service. > > > --- In [email protected], "valdhor" <stevedepp@> wrote: > > > > This seems to be a convoluted way to do this. > > > > I have created a simple example to show you how I use WebOrb. > > > > On my server I have the WebORB directory at the root level. In the > > Services directory I have a MyServices directory and in this directory I > > have a ValueObjects directory. For this example I have two files: > > > > ===================================================================== > > TestNamesInVO.php: > > <?php > > class TestNamesInVO > > { > > public $FirstName; > > public $LastName; > > > > public function __construct($FirstName, $LastName) > > { > > $this->FirstName = $FirstName; > > $this->LastName = $LastName; > > } > > } > > ?> > > ===================================================================== > > TestNamesOutVO.php: > > <?php > > class TestNamesOutVO > > { > > public $FullName; > > > > public function __construct($FullName) > > { > > $this->FullName = $FullName; > > } > > } > > ?> > > ===================================================================== > > > > The constructors are there just to make it easier to create a new > > object. They are optional. > > > > In the MyServices directory I have a TestService.php file. This contains > > all the functions available with this service. > > > > ===================================================================== > > TestService.php: > > <?php > > class TestService > > { > > function ShowMe() > > { > > return "Tom Jones"; > > } > > > > function ShowName($name) > > { > > return 'Hello ' . $name; > > } > > > > function ShowNames(TestNamesInVO $namesIn) > > { > > require_once("ValueObjects/TestNamesInVO.php"); > > require_once("ValueObjects/TestNamesOutVO.php"); > > > > $fullName = new TestNamesOutVO($namesIn->FirstName . " " . > > $namesIn->LastName); > > > > return $fullName; > > } > > } > > ?> > > ===================================================================== > > > > In flex I also have a ValueObjects folder underneath my src folder. This > > folder contains the corresponding ActionScript files for the value > > objects on the server: > > > > ===================================================================== > > TestNamesInVO.as: > > package ValueObjects > > { > > [RemoteClass(alias="MyServices.ValueObjects.TestNamesInVO")] > > [Bindable] > > public class TestNamesInVO > > { > > //instance variables > > private var _FirstName:String; > > private var _LastName:String; > > > > //accessor methods > > public function get FirstName():String {return _FirstName;} > > public function get LastName():String {return _LastName;} > > > > //mutator methods > > public function set FirstName(FirstName:String):void > {_FirstName > > = FirstName;} > > public function set LastName(LastName:String):void {_LastName = > > LastName;} > > } // end class > > }//end package > > ===================================================================== > > TestNamesOutVO.as: > > package ValueObjects > > { > > [RemoteClass(alias="MyServices.ValueObjects.TestNamesOutVO")] > > [Bindable] > > public class TestNamesOutVO > > { > > //instance variables > > private var _FullName:String; > > > > //accessor methods > > public function get FullName():String {return _FullName;} > > > > //mutator methods > > public function set FullName(FullName:String):void {_FullName = > > FullName;} > > } // end class > > }//end package > > ===================================================================== > > > > Note the RemoteClass metadata. This tells flex the location of the class > > on the server that matches this class (In relation to the Services > > directory). > > > > Finally we have the Flex application that makes calls to functions > > within this service. > > > > ===================================================================== > > WebORBExample.mxml: > > <?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.messaging.channels.AMFChannel; > > import mx.messaging.ChannelSet; > > import mx.rpc.events.FaultEvent; > > import mx.rpc.events.ResultEvent; > > import mx.rpc.remoting.RemoteObject; > > import mx.managers.CursorManager; > > import mx.controls.Alert; > > import ValueObjects.TestNamesInVO; > > import ValueObjects.TestNamesOutVO; > > > > private var channelSet:ChannelSet; > > private var amfChannel:AMFChannel; > > private var testService:RemoteObject; > > > > private function onCreationComplete():void > > { > > channelSet = new ChannelSet(); > > amfChannel = new AMFChannel("my-amf", > > "http://myserver/WebORB/weborb.php"); > > channelSet.addChannel(amfChannel); > > > > testService = new RemoteObject(); > > testService.channelSet = channelSet; > > testService.destination = "MyServices.TestService"; > > testService.requestTimeout = 15; > > > > testService.ShowMe.addEventListener(ResultEvent.RESULT, > > ShowMeHandler); > > > > testService.ShowName.addEventListener(ResultEvent.RESULT, > > ShowNameHandler); > > > > testService.ShowNames.addEventListener(ResultEvent.RESULT, > > ShowNamesHandler); > > testService.addEventListener(FaultEvent.FAULT, > > faultHandler); > > } > > > > > > private function runShowNames():void > > { > > var person:TestNamesInVO = new TestNamesInVO(); > > person.FirstName = "Tom"; > > person.LastName = "Jones"; > > testService.ShowNames(person); > > CursorManager.setBusyCursor(); > > } > > > > private function ShowMeHandler(event:ResultEvent):void > > { > > Alert.show(event.result.toString()); > > } > > > > private function ShowNameHandler(event:ResultEvent):void > > { > > Alert.show(event.result.toString()); > > } > > > > private function ShowNamesHandler(event:ResultEvent):void > > { > > CursorManager.removeBusyCursor(); > > var personReturned:TestNamesOutVO = event.result as > > TestNamesOutVO; > > Alert.show(personReturned.FullName); > > } > > > > private function faultHandler(fault:FaultEvent):void > > { > > CursorManager.removeBusyCursor(); > > switch(fault.fault.faultCode.toString()) > > { > > case "Client.Error.RequestTimeout": > > Alert.show("The server is not responding. > > Please check that you are connected and the server is running.", "Server > > Timeout"); > > break; > > default: > > Alert.show(fault.fault.faultString, > > fault.fault.faultCode.toString()); > > break; > > } > > } > > > > ]]> > > </mx:Script> > > <mx:HBox horizontalAlign="center"> > > <mx:Button label="ShowMe" click="{testService.ShowMe()}"/> > > <mx:Button label="ShowName" click="{testService.ShowName('Tom > > Jones')}"/> > > <mx:Button label="ShowNames" click="runShowNames()"/> > > </mx:HBox> > > </mx:Application> > > ===================================================================== > > > > If you have any more questions, please don't hesitate to ask. > > > > > > > > --- In [email protected], "timgerr" <tim.gallagher@> wrote: > > > > > > OK, so I have created this hello world service and then had WebOrb > > > create the code I see in the actionscript comments This: > > > > > > (If using Model-View-Controller) > > > - Modify the constructor of the class below to accept the controller > > > object > > > - Modify response handlers to pass return values to the controller > > > > > > (if not using MVC) > > > - Modify the constructor of the class below to accept your View object > > > - Modify response handlers to display the result directly in the View > > > > > > I am not useing MVC so I have to use the 2nd commented option. the > > > problem is I am not sure what to do, someone help me? > > > > > > Here is my PHP code: > > > <?php > > > class HelloWorld { > > > function ShowMe() > > > { > > > return "Tom Jones"; > > > } > > > function ShowName($name) > > > { > > > return 'Hello ' . $name; > > > } > > > } > > > ?> > > > So I have 2 methods, ShowMe and ShowName. > > > > > > Here is my as code: > > > package comp.HelloWorld > > > { > > > import mx.rpc.remoting.RemoteObject; > > > import mx.controls.Alert; > > > import mx.rpc.events.ResultEvent; > > > import mx.rpc.events.FaultEvent; > > > import mx.rpc.AsyncToken; > > > import mx.rpc.IResponder; > > > > > > import comp.HelloWorld.vo.*; > > > > > > public class HelloWorld > > > { > > > private var remoteObject:RemoteObject; > > > private var model:HelloWorldModel; > > > > > > public function HelloWorld( model:HelloWorldModel = null ) > > > { > > > remoteObject = new RemoteObject("GenericDestination"); > > > remoteObject.source = "comp.HelloWorld.HelloWorld"; > > > > > > remoteObject.ShowMe.addEventListener("result",ShowMeHandler); > > > remoteObject.ShowName.addEventListener("result",ShowNameHandler); > > > remoteObject.addEventListener("fault", onFault); > > > > > > if( model == null ) > > > model = new HelloWorldModel(); > > > > > > this.model = model; > > > > > > } > > > > > > public function setCredentials( userid:String, password:String > > > ):void > > > { > > > remoteObject.setCredentials( userid, password ); > > > } > > > > > > public function GetModel():HelloWorldModel > > > { > > > return this.model; > > > } > > > > > > public function ShowMe( responder:IResponder = null):void > > > { > > > var asyncToken:AsyncToken = remoteObject.ShowMe(); > > > > > > if( responder != null ) > > > asyncToken.addResponder( responder ); > > > } > > > > > > public function ShowName( name:String, responder:IResponder = > > > null):void > > > { > > > var asyncToken:AsyncToken = remoteObject.ShowName( name); > > > > > > if( responder != null ) > > > asyncToken.addResponder( responder ); > > > } > > > public virtual function ShowMeHandler(event:ResultEvent):void > > > { > > > var returnValue:Object = event.result as Object; > > > model.ShowMe = event.result as Object; > > > } > > > > > > public virtual function ShowNameHandler(event:ResultEvent):void > > > { > > > var returnValue:Object = event.result as Object; > > > model.ShowName = event.result as Object; > > > } > > > > > > public function onFault (event:FaultEvent):void > > > { > > > Alert.show(event.fault.faultString, "Error"); > > > } > > > } > > > > > > } > > > > > > I get an error on: import comp.HelloWorld.vo.* (not sure what this is > > > or how to create it) > > > > > > > > > And here is another chunck of code that I have to modify > > > > > > public virtual function ShowMeHandler(event:ResultEvent):void > > > { > > > var returnValue:Object = event.result as Object; > > > model.ShowMe = event.result as Object; > > > } > > > > > > public virtual function ShowNameHandler(event:ResultEvent):void > > > { > > > var returnValue:Object = event.result as Object; > > > model.ShowName = event.result as Object; > > > } > > > > > > I get an error: > > > (Severity and Description Path Resource Location Creation Time Id > > > 1119: Access of possibly undefined property ShowMe through a reference > > > with static type comp.HelloWorld:HelloWorldModel. > > > WeborbHelloworld/src/comp/HelloWorld HelloWorld.as line 95 > > > 1222790567712 8938) > > > > > > On these 2 lines of code: > > > model.ShowMe = event.result as Object; > > > model.ShowName = event.result as Object; > > > > > > I just want to return that stuff, what do I have to do in order to fix > > > the errors. > > > > > > Thanks, > > > timgerr > > > > > >

