Expand my Community achievements bar.

SOLVED

Destination Problem

Avatar

Level 1
In my project I want to use a RemoteObject instance to
retrieve a Java object. I think I've got all the files in the right
places, but still I get this error:



[RPC Fault faultString="[MessagingError message='The
MessageAgent's destination must be set to send messages.']"
faultCode="InvokeFailed" faultDetail="Couldn't establish a
connection to ''"]

at mx.rpc::AbstractInvoker/
http://www.adobe.com/2006/flex/mx/internal::invoke()

at mx.rpc.remoting.mxml::Operation/
http://www.adobe.com/2006/flex/mx/internal::invoke()

at mx.rpc.remoting::Operation/send()

at Function/
http://adobe.com/AS3/2006/builtin::apply()

at mx.rpc.remoting.mxml::Operation/send()

at Function/
http://adobe.com/AS3/2006/builtin::apply()

at mx.rpc::AbstractService/
http://www.adobe.com/2006/actionscript/flash/proxy::callProperty()

at Medewerkers/request()

at Medewerkers/___Application1_creationComplete()

at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()



My RemoteObject code looks like this:




<mx:RemoteObject id="MedewerkerService"
source="com.atosorigin.services.MedewerkerService">

<mx:method name="getMedewerkers"
result="{resultHandler(event)}" />

</mx:RemoteObject>




The return object is an array of Medewerker, which I retrieve
like this:




public function resultHandler(event:ResultEvent):void {

medewerkers = event.result as ArrayCollection;

}




I use the following Services-config.xml:



<services-config>

<services>

<service-include file-path="remoting-config.xml" />

</services>

<channels>

<channel-definition id="my-graniteamf"
class="mx.messaging.channels.AMFChannel">

<endpoint uri="
http://{server.name}:{server.port}/{context.root}/graniteamf/amf"
class="flex.messaging.endpoints.AMFEndpoint" />

</channel-definition>

</channels>

</services-config>



With a remoting-config.xml:



<service id="remoting-service"
class="flex.messaging.services.RemotingService">

<adapters>

<adapter-definition id="java-object"
class="flex.messaging.services.remoting.adapters.JavaAdapter"
default="true" />

</adapters>

<default-channels>

<channel ref="my-graniteamf" />

</default-channels>

<destination id="pojo">

<channels>

<channel ref="my-graniteamf" />

</channels>

<properties>

<scope>session</scope>


<source>com.atosorigin.services.MedewerkerServicce</source>


</properties>

</destination>

</service>



Thank you :)
1 Accepted Solution

Avatar

Correct answer by
Level 1
It's <mx:Label
text="{service.operation.lastresult.desiredProperty}" /> :)

(Note the lack of parentheses at the operation part)

View solution in original post

4 Replies

Avatar

Level 1
To add more information:



If I specify the granite-amf channel as default channel, I"ll
get the following error, instead of the first:



[RPC Fault faultString="Send failed"
faultCode="Client.Error.MessageSend"
faultDetail="Channel.Connect.Failed error
NetConnection.Call.Failed: HTTP: Failed: url: '
http://localhost:8080/Medewerkers/graniteamf/amf'"



I'm deploying this all on a Tomcat 6 server and compiled the
MXML beforehand.

Avatar

Former Community Member
I'd suggest replacing server.name, server.port and
context.root with actual values and recompiling you app with
services-config.xml. See if that helps.

Avatar

Level 1
It was a context error, but thanks :) Now I have a response,
but somehow I can't access that response. I receive this:



[AMFMessageServlet] << Returning AMF0 response:

org.granite.messaging.amf.AMF0Message {

version = 3

headers = []

bodies = [

org.granite.messaging.amf.AMF0Body {

target = /3/onResult

serviceName = null

serviceMethodName = null

response =

type = AMF3_OBJECT

value = flex.messaging.messages.AcknowledgeMessage {

correlationId = 4BC2BDA6-7E93-BAFC-D023-0EC9A42F4544

destination = null

headers = {}

messageId = 071A0DFB-FAF1-4ED9-A8A4-8FFD5A316BBF

timestamp = 1194249004126

clientId = E9EB42DA-D843-4226-9A40-7C5E96B2425B

timeToLive = 0

body = com.atosorigin.domain.Medewerker@1b5d2b2

}

}

]

}



A Medewerker Object and this object has a property voornaam.
So, it should be accessed with the follow code right?:



[Bindable]

public var employee1:Medewerker;



<mx:Label text="{employee1.voornaam}" />



(Leaving out unnecessary code)

Avatar

Correct answer by
Level 1
It's <mx:Label
text="{service.operation.lastresult.desiredProperty}" /> :)

(Note the lack of parentheses at the operation part)