Welcome Guest Search | Active Topics | Members | Log In | Register

Newbie issues Options · View
nathanp812
Posted: Thursday, October 20, 2011 3:31:20 AM
Rank: Newbie Coder
Groups: Member

Joined: 10/20/2011
Posts: 5
Points: 12
Location: Australia
Hi there,

I downloaded WebORB today and am trying to evaluate the product in conjunction with the Amethyst plugin for vs2010.
I have run into an issue that I hope someone can provide some assistance with.

Firstly I installed WebORB into a web site and configured it as per the installation documentation.
Everything seemed to work perfectly, from the WebORB console I am able to successfully invoke and test a small echo service that returns a string.

I used the Amethyst plugin to generate client side proxies for my Flex 4.5 application project, however any time I try and perform the same call to the service it always returns null.
I have been over the tutorials multiple times and cannot seem to work out what the issue could be.

Here is the Flex client code I am using to invoke the service:

Code:


import mx.events.*;
import flash.events.*;

import ARISFlexService.FormGuideService;
import ARISFlexService.FormGuideServiceModel;

[Bindable]
private var model:FormGuideServiceModel= new FormGuideServiceModel();
private var serviceProxy:FormGuideService= new FormGuideService(model);


[Amethyst(designer)]
private function button1_click (event:flash.events.MouseEvent):void {
    
    serviceProxy.Echo("test");
    var s = model.EchoResult; 
}




The logs seem to indicate the operation should have worked:

[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:Received request for http://localhost:6943/horsetorque2010fix/weborb.aspx from ::1
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:Request is in session 1u4njauergv1iaf3mzdmxabp
[Thread-17] WEBORB INSTRUMENTATION:20/10/2011 9:18 PM:Request parsing time in ms - 0
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:Dispatching request processing to V3 Dispatcher
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:loading type: ARISFlexService.FormGuideService
[Thread-17] WEBORB INSTRUMENTATION:20/10/2011 9:18 PM:clr method invocation time (in ms) - 0 method - Echo
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:Object Handler handler successfully invoked method Echo on the service ARISFlexService.FormGuideService
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:V3 Dispatcher successfully handled request processing
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:Starting response serialization
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:got headers 0
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:got bodies 1
[Thread-17] WEBORB INFO:20/10/2011 9:18 PM:AMFMessageWriter.write - message version: 3 header length: 0
[Thread-17] WEBORB INSTRUMENTATION:20/10/2011 9:18 PM:Response serialization time in ms - 0
[Thread-17] WEBORB INSTRUMENTATION:20/10/2011 9:18 PM:Total request processing time in ms - 2

Whilst I have a lot of experience with .NET related technologies I am pretty new to Flex, Amethyst and WebORB, so perhaps the Flex code I am using to invoke the service is incorrect?

Any assistance would be much appreciated. :)
jwhitley
Posted: Thursday, October 20, 2011 8:35:26 AM
Rank: Apprentice Coder
Groups: Member

Joined: 8/14/2011
Posts: 48
Points: 138
I too am still a newbie... but it looks like your code is expecting a returned result synchronously - ie. as soon as the call to serviceProxy.Echo("test"); is made you are expecting to be able to access the result in model.EchoResult.

I have stopped using the built in code as I find it easier to write my own, but always need to add an event listener to get the results from remoting requests as they are all asynchronous, ie model.EchoResult has not been updated at the time you try and assign it to var s.

EDIT: Forgot to mention you have also not given var s a type (eg var s:String )
nathanp812
Posted: Thursday, October 20, 2011 4:11:47 PM
Rank: Newbie Coder
Groups: Member

Joined: 10/20/2011
Posts: 5
Points: 12
Location: Australia
Thanks for the information.
The proxy that is generated actually as an asynchronous result listener built in however it looks like my flex UI code is finishing before the result hits the listener inside the service proxy.
I put in a few breakpoints to confirm this and at least the data is being returned.....Eventually.

So I need to work out how to add a listener to the serviceProxy.Echo method on the UI side of things so that I can read back the model.EchoResult when the invocation finishes.

I see a second variable inside the serviceProxy.Echo method of type IResponder....Any ideas whether that would do the trick?

[Edit] I worked this out by adding an event listener in the UI and invoking the event from within the service proxy.
Mark Piller
Posted: Friday, October 21, 2011 2:34:00 PM

Rank: Administration
Groups: Administration

Joined: 8/21/2006
Posts: 1,607
Points: 4,082
Location: Frisco, TX
Alternatively you can pass an instance of IResponder into the Echo method. Your IResponder will receive the callbacks when the result arrives back from the server.

Regards,
Mark

Mark Piller
Midnight Coders, Inc.
twitter: midnightcoder
blog: blog.themidnightcoders.com
website: www.themidnightcoders.com
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.183 seconds.