views:

63

answers:

2

Hello, I create a Flex application that works with a browser using a database with the MySQL server that I can create, modify and delete data from a database.

The problem I encounter now is that I want to see my program with Adobe AIR (virtual machine). At the display that does not pose a problem. The problem is that air can not reach the database server is located in the MySQ. the error message displayed is as follows:

"Error : client.Error.MessageSend - Channel.connect.failed error NetConnection.Call.Failled : HTTP: Status 404:url:'http://xxx.swf/xxx/messagebroker/amf' - Send failed"

Thank you kindly explain to me why I obtain this error? and why do I get to work with the browser but not with AIR? and do work well with AIR application "Client - Server"?

I await your answers or comments with pleasure

A: 

It would be best to have some service on the server-side to serve as a facade to database operations. Thus:

  • you will work with a limited interface from your flex client
  • you won't need to store DB credentials on the client (this is security flaw - anyone can connect to your database and drop anything)
  • you won't need special firewall permissions (or mysql port configurations) for your clients - most servers don't allow external parties to connect to port 3306

You can use BlazeDS for that, or you can create your own solution, if the case is simple enough (I actually didn't like the way BlazeDS handles stuff when I had to make this choice a while ago)

The exception you are getting is actually in the AMF broker messaging rather than any of the other technologies. Check whether the URL shown in the message really returns 404.

Bozho
How to check this (post 404) ?
Koko
in your browser
Bozho
Bozho, what were the things from BlazeDS that you did not liked?
Cornel Creanga
@Cornel Creanga - it was 2 years ago, but as far as I recall, I had to create the hibernate mappings twice - once in blazeds and once in the standard mappings.
Bozho
A: 

If you are getting a 404 error then your BlazeDS servlet is not running. Make sure you didn't get any errors when you started Tomcat.

James Ward
Before using the browser (IE - http://localhost:8080/xxx) interface, I started Tomcat and the result works perfectly! The display data from the database as well as actions on the database (add, edit, delete)!Same approach as the interface with AIR (without browser) and it gives me this error message mentioned at the start!Why?
Koko
I just noticed that there is a .swf in your url. That is probably not right. Since this is an AIR application you need to give Flex full URLs to the server. You can do this in the service-config.xml file by replacing the server and port tokens with your actual values. But a better solution is to have a config file for your app that is loaded on startup and then sets the endpoint URLs dynamically.
James Ward
Thank you very much for your help ... I have other question : do you know if their possible to have an automatic connection from Adobe Air to MySQL ?
Koko
There is a library for that but it's not a recommended approach.
James Ward
Can you tell me the name of the library ? thanks
Koko
http://code.google.com/p/assql/
James Ward
Can you help me for to find more information about your suggestion : "solution is to have a config file for your app that is loaded on startup and then sets the endpoint URLs dynamically" ... Thanks
Koko
Here is a good guide on externalizaing config in Flex: http://coenraets.org/blog/2009/03/externalizing-service-configuration-using-blazeds-and-lcds/
James Ward