Expand my Community achievements bar.

SOLVED

Flex to web service communication problem

Avatar

Former Community Member

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 : http://109.74.206.146:8080/jax_ws/quarkservice?wsdl ) 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 :

1. [RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL. If currently online, please verify the URI and/or format of the WSDL (http://109.74.206.146:8080/jax_ws/quarkservice?wsdl)"]    

2.   at mx.rpc.wsdl::WSDLLoader/faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\wsdl\WSDLLoader.as:98]    

3.   at flash.events::EventDispatcher/dispatchEventFunction()    

4.  at flash.events::EventDispatcher/dispatchEvent()    

5.    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:168]    

6.    at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:220]    

7.  at mx.rpc::Responder/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:49]    

8.     at mx.rpc::AsyncRequest/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]    

9.    at DirectHTTPMessageResponder/securityErrorHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:368]   

10.   at flash.events::EventDispatcher/dispatchEventFunction()   

11.  at flash.events::EventDispatcher/dispatchEvent()   

12.   at flash.net::URLLoader/redirectEvent()

[RPC Fault faultString="Security error accessing url" faultCode="Channel.Security.Error" faultDetail="Unable to load WSDL.

<br /> If currently online, please verify the URI and/or format of the WSDL (http://109.74.206.146:8080/jax_ws/quarkservice?wsdl)"] at

mx.rpc.wsdl::WSDLLoader/faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\wsdl\WSDLLoader.as:98]

at flash.events::EventDispatcher/dispatchEventFunction()

at flash.events::EventDispatcher/dispatchEvent() at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:168]

at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc \AbstractInvoker.as:220]

at mx.rpc::Responder/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:49]

at mx.rpc::AsyncRequest/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:103]

at DirectHTTPMessageResponder/securityErrorHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:368]

at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent()

at flash.net::URLLoader/redirectEvent()

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? Thanks

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

There is implicit trust when you run the application from Flex Builder. Outside of Flex Builder, if the call to the Web service is not proxied by LiveCycle Data Services, Flash Player security will not allow connection to the remote service.

Try adding a crossdomain.xml to the ROOT.war of your respective application server. Something like this...

<?xml version="1.0"?>

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

<cross-domain-policy>

   <site-control permitted-cross-domain-policies="all" />

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

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

</cross-domain-policy>

Steve

View solution in original post

3 Replies

Avatar

Former Community Member

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?

Avatar

Correct answer by
Former Community Member

There is implicit trust when you run the application from Flex Builder. Outside of Flex Builder, if the call to the Web service is not proxied by LiveCycle Data Services, Flash Player security will not allow connection to the remote service.

Try adding a crossdomain.xml to the ROOT.war of your respective application server. Something like this...

<?xml version="1.0"?>

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

<cross-domain-policy>

   <site-control permitted-cross-domain-policies="all" />

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

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

</cross-domain-policy>

Steve

Avatar

Former Community Member

Thank you Steve. I just did it. All the time, I have tried to add it into the 'root' of the application I was invoking. It was logical to me Then, I figure out using firebird debugger that crossdomain.xml file is requested, as a root application file : http://mydomain:8080/crossdomain.xml.

Then I put it into ROOT forled of my Tomcat. and it works

However, thanks again on your answer!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----