Expand my Community achievements bar.

RemoteObject has Channel connect failure

Avatar

Level 1
I have a very simple remote object in my .mxml:



<mx:RemoteObject id="FlexReportUtilRO"
destination="FlexReportUtilRO"

source="com.interwoven.opendeploy.ui.FlexReportUtil">

<mx:method name="getEntries"
result="resultHandler(event)"/>

</mx:RemoteObject>



<mx:Button label="Get Report"
click="FlexReportUtilRO.getEntries()"

x="314" y="10"/>



And this is my remoting-services.xml:



<destination id="FlexReportUtilRO">

<properties>

<source>com.test.FlexReportUtil</source>

<scope>application</scope>

</properties>

</destination>



But when I press the button, I get some sort of channel
connect failure:



[RPC Fault faultString="Send failed"
faultCode="Client.Error.MessageSend"
faultDetail="Channel.Connect.Failed error
NetConnection.Call.Failed: HTTP: Failed"]

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

at mx.rpc::Responder/fault().....



What else do I need to do to get RemoteObject working?



Thanks!



10 Replies

Avatar

Level 3
Hi,



The fault indicates that the client wasn't able to connect to
the server. Can you provide the channel-definition from your
services-config.xml file for the channel that your FlexReportUtilRO
remote object destination is using? Also, does the web.xml file for
your webapp contain a servlet definition for the FDS
MessageBrokerServlet?



The endpoint URI for that channel needs to be reachable so
you can also try hitting it in a browser to verify it works.



Thanks,

Seth

Avatar

Level 1
Thanks for your help Seth.



I have not added anything new to services-config.xml, so I'm
using the default channel "my-amf".



From services-config.xml:

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

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

<properties>

<polling-enabled>false</polling-enabled>

</properties>

</channel-definition>



I also did not add anything to web.xml, but there is already
a messagebroker servlet there:




<servlet-name>MessageBrokerServlet</servlet-name>


<display-name>MessageBrokerServlet</display-name>


<servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>

<init-param>


<param-name>services.configuration.file</param-name>


<param-value>/WEB-INF/flex/services-config.xml</param-value>

</init-param>

<init-param>

<param-name>flex.write.path</param-name>

<param-value>/WEB-INF/flex</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

Avatar

Level 3
Are you using the web tier compiler (requesting yourApp.mxml
in a browser triggers compilation) or compiling at the command line
or in FlexBuilder? If you're not using the webtier compiler you'll
need to do one of the following; substituting myAppContextRoot with
the proper value:



1. Hardcode the proper context root into your channel's
endpoint URI in the services-config.xml file rather than using the
{context.root} token. For example: <endpoint uri="
http://{server.name}:{server.port}/myAppContextRoot/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint"/>



2. Use the following mxmlc option:
-compiler.context-root=myAppContextRoot



Best,

Seth

Avatar

Level 1
I'm running this from FlexBuilder. I click on the run button
and a new browser pops up with
http://localhost:8080/flex/reporting/reporting.html
with the button I made. Then I press the button, and the channel
error shows up.



Just as a test, I put this in the browser:




http://localhost:8080/flex/messagebroker/amf




The browser is blank, no error message (or any message). Is
that expected?











Avatar

Level 3
Give the options I listed in my previous post a try.



As for your browser test of the endpoint URI, a blank browser
page is good. It indicates that the MessageBrokerServlet is
registered and listening for requests. A server error (500) would
have indicated that the server wasn't listenering for requests at
that URL. So the server's fine and you just need to get the correct
context root into the compiled swf.



The reason context root can cause a problem is that it isn't
substitutable on the client at runtime the way that server name and
port are.



Best,

Seth

Avatar

Level 1
That was it. Thank you Seth!



When I created the DataServices project in FlexBuilder, I had
specified the root URL to be
http://localhost:8080/flex,
and I assumed the hostname, port, and contextroot would be
extracted from there.



Next time I know...



Thanks for being so patient!

Avatar

Level 3
Glad to hear you're up and running :)



Seth

Avatar

Level 2
I have the same problem and i tried to change contextroot in
services-config.xml, but it didn't work. I would like to know do I
need to change server name and port as well ? thanks.

Avatar

Level 3
You shouldn't need to change server name or port as the swf
can figure those out at runtime. How are you compiling your swf and
viewing it? Are you running locally or attempting to make network
calls to a remote server? What's the exact error you're seeing?



Best,

Seth

Avatar

Level 2
I am running locally. I found that it was my configuration
problem. Now, I've got it working. Thanks a lot for the
reply.