Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Webservice consumer: works on FlexBuilder fails on Tomcat

Avatar

Level 1
Hello guys!



I have just started messing around with Flex, and I thought
that a good practice would be trying to connect to one of the web
services that my company offers developing a simple client on Flex.



I used Flex Builder and found it really easy: With only a few
lines of code a really nice GUI... impressive!



So now lets show it to my colleagues...but UPS!



I place the application under my local Tomcat and instead of
retrieving data I get:



[FaultEvent fault=[RPC Fault faultString="Security error
accessing url" faultCode="Channel.Security.Error"
faultDetail="Destination: DefaultHTTP"] messageId=null type="fault"
bubbles=true cancelable=true eventPhase=2]



After a lot of research I cannot make it work... I have read
about crossdomain.xml, I have copied this file into my
tomcat\webapps\ROOT folder allowing all domains:



<?xml version="1.0"?>

<!DOCTYPE cross-domain-policy SYSTEM "
http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

<allow-access-from domain="*" />

<allow-http-request-headers-from domain="*" headers="*"
/>

</cross-domain-policy>



Because this crossdomain.xml should be on the server were my
Flex client is placed, isn't it? I have read some articles, and
they say that this XML has to be placed on the server which offers
the web service. I think this cannot be possible, in that case I
have to ask to my IT department to upload that file, and they for
sure aren't going to allow that.



Could you please help me? Why is the client working under
Flex Builder and not when I deploy it on my Tomcat? And when I says
deploy I mean that I have copied what Flex Builder generates on
"bin-release" folder into the Tomcat's webapps folder.



Thanks for your help in advance!
1 Reply

Avatar

Level 2
the cross-domain file has to be placed on the web service
server.



you can use blazeds or lcds to proxy your ws calls. this
tutorial should help,
http://learn.adobe.com/wiki/display/Flex/Creating+a+BlazeDS+web+service+application+in+Flex+Builder