This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Flex and the fly likes Flex to web service communication problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Flex
Bookmark "Flex to web service communication problem" Watch "Flex to web service communication problem" New topic

Flex to web service communication problem

Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
Hi, just as title state, I have problem during web service --> Flex communication.
I am using WebService ActionScript class, to make a connection to it, but I got some odd behavior.
When I try to access remote web service (particulary : ) from my Flex Builder IDE, everything is fine. Even more, when I goes to my project folder and click ProjectName.swf file, without any server running on my pc, the file is executed, communication with web service is faultless performed, and response is retrieved.
However, when I try to export as a build release, and to engage it to my localhost Tomcat, or if i try to copy ProjectName.swf to any another location on my had drive, from the project place, where is stored, I got :

So, the same file engaged from the FlexBuilder or directly invoked from the project's folder, where it reside, works perfectly.
When I try to invoke it from ANY OTHER location, including deployment on my local Tomcat (or even simply from my desktop), I got the exception above.
So, does anyone know what is the problem?
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
Hi. I thought that was only when I access the web service, outside localhost, but also error occurs when I try to access also the Servlet, outside the localhost ( my faultHandler is invoked, when I try that).
I do not get it, what is a problem, since I can access everything from my Flex Builder, but cannot anything outside of it?
Goran Markovic
Ranch Hand

Joined: Sep 26, 2008
Posts: 399
Hi. Just to provide a solution, if anyone else encounters the same problem.
The crossdomain.xml file, with a following content :

should be stored on application server, where from the service/servlet is provided by. In the case of Tomcat, this file SHOULD NOT be stored, into the root of the application, which we are invoking (I though it should stay there, logically) but it stays inside ROOT folder (cute, isn't it ).
In the case of another application servers, like JBoss, I believe (not test), that this file (crossdomain.xml), should stay inside 'default' folder (as a default configuration instance of JBoss), but I haven't test yet.
I agree. Here's the link:
subject: Flex to web service communication problem
jQuery in Action, 3rd edition