Skip to main content
Known Participant
August 14, 2009
Question

Flex + Coldfusion (no local) doesn't work

  • August 14, 2009
  • 3 replies
  • 3519 views

Hi,

i have a big problem with flex and connecting to a Coldfusion 8 Server (Not local)

ErrorMessage:

TypeError: Error #1034: Type Coercion failed: cannot convert Object@84b46f1 to mx.messaging.messages.ErrorMessage.

It "pops up" if i try to use the method of the remoteObject.

Does anybody know, what this mean?

Greets, Nico

This topic has been closed for replies.

3 replies

Cyril Hanquez
Participating Frequently
September 25, 2009

Usually I prefer to redefine the Channel when my application starts then I just have to chaege one value when I switch from one server to another. I'm doing something like that:

<mx:Script>
<![CDATA[
import mx.messaging.channels.AMFChannel;
import mx.messaging.Channel;
import mx.messaging.ChannelSet;

[Bindable]
public var endpointUri:String = "http://<myServer>/flex2gateway/";
[Bindable]
public var myChannelSet:ChannelSet;


public function init():void {  
      myChannelSet = new ChannelSet();     
      var customChannel:Channel = new SecureAMFChannel("my-cfamf", endpointUri);
      myChannelSet.addChannel(customChannel); 
}

]]>
</mx:Script>


<mx:RemoteObject id="ro"
                             destination="ColdFusion"
                             channelSet="{myChannelSet}"
                             source="<path_to_your_cfc>"
                             showBusyCursor="true">

              ...


</mx:RemoteObject>

What is important to check:

- name/port of the server:

you need to first know what is your main server and you can "test" the flex2gateway by doing http://myserver/flex2gateway: you should get a blank page. A URL like http://test.myserver.com usually means that the gateway is on myserver.com and not on test.myserver.com !

- https:

in that case use SecureAMFChannel instead.

- path to your cfc

reverse notation from the server root: http://test.myserver.com/cfc/mycomp.cfc can give the following path test.cfc.mycomp

Hope it will help and post code sample if it does not.

ilssac
Inspiring
September 2, 2009

What do you want your work flow to be?

I am not very good at setting up Flex IDE.  But once I have struggled through it, I never have to touch it again until I change computers or something like that.

I have almost always set up to work with ColdFusion running on my local work machine.  Developer coldfusion is free and easy to set up so I have never had trouble using it.

But as far as I know, if you do not care about connecting to the local server, you just need to connect to the correct XML file on the remote server.  And I am not completly sure that is required.

maeldanusAuthor
Known Participant
September 8, 2009

Like i said before, i have no problems to connect to my localhost. The problem is a live environment.  :/

Inspiring
September 8, 2009

I had the same error message connecting to the "live" server... i was able to solve the problem by checking to see if it is using different port than my localhost ( 8500 is the default for local i think... ).  check the end point URI and make sure everything matches up the live server. Also, check that the cfc mappings are mapped properly if you use them.

maeldanusAuthor
Known Participant
August 17, 2009

Nobody knows?

It's realy sad that i can test my app just local on my machine.

What i have to do, that my App runs on a "normal" Server? (There is already Coldfusion 8 installed)

I didn't understand that thing with the flex2gateway correct, i think.

maeldanusAuthor
Known Participant
September 2, 2009

Nobody can help me? I can't believe, that you are just develop for your localmachine...

So what i have to do/copy oder whatever, to connect from Flex to a live Coldfusion environment???????????

If i have www.test.domain.com nad that links to my root Directoy - What must i enter in the "services-xml.xml" ?

<endpoint uri="http://test.domain.com/" class="flex.messaging.endpoints.AMFEndpoint"/>

What exactly is this "flex2gateway" Or more important, how i use it correctly ?

Please help me :|

greets, nico