4 Replies Latest reply on Nov 7, 2007 7:35 AM by Ilantir

    Destination Problem

      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)}" />

      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:

      <service-include file-path="remoting-config.xml" />
      <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" />

      With a remoting-config.xml:

      <service id="remoting-service" class="flex.messaging.services.RemotingService">
      <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true" />
      <channel ref="my-graniteamf" />
      <destination id="pojo">
      <channel ref="my-graniteamf" />

      Thank you :)
        • 1. Destination Problem
          Ilantir 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.
          • 2. Re: Destination Problem
            Mete Atamel Level 1
            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.
            • 3. Re: Destination Problem
              Ilantir 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?:

              public var employee1:Medewerker;

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

              (Leaving out unnecessary code)
              • 4. Re: Destination Problem
                Ilantir Level 1
                It's <mx:Label text="{service.operation.lastresult.desiredProperty}" /> :)
                (Note the lack of parentheses at the operation part)