1 flex httpservice Error
[RPC fault faultstring = "Security Error accessing URL" faultcode = "channel. Security. error" faultdetail = "Destination: defaulthttp"]
At MX. RPC: abstractinvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler () [C:/autobuild/3.2.0/frameworks/projects/rpc/src/MX/rpc/abstractinvoker. As: 220]
At MX. RPC: responder/fault () [C:/autobuild/3.2.0/frameworks/projects/rpc/src/MX/rpc/responder. As: 53]
At MX. RPC: asyncrequest/fault () [C:/autobuild/3.2.0/frameworks/projects/rpc/src/MX/rpc/asyncrequest. As: 103]
At directhttpmessageresponder/securityerrorhandler () [C:/autobuild/3.2.0/frameworks/projects/rpc/src/MX/messaging/channels/directhttpchannel. As: 389]
At flash. Events: eventdispatcher/dispatcheventfunction ()
At flash. Events: eventdispatcher/dispatchevent ()
At flash.net: urlloader/redirectevent ()
About the format of the policy file (you can find it in Flash Player Security in Flash CS3 -- "control permission overview)
1. Policy files for Web Applications
The following example shows a policy file that allows access to SWF files from * .iflashigame.com and 192.0.34.166.
<? XML version = "1.0"?> <Cross-domain-Policy> <allow-access-from domain = "* .iflashigame.com"/> <allow-access-from domain = "192.0.34.166"/> </Cross-Domain- policy> note:
By default, the policy file must be named crossdomain. xml and located in the root directory of the server. However, you can call security. loadpolicyfile () to check whether the SWF file is another name or is in another directory. The cross-origin policy file is only applicable to the directory from which the file is loaded and Its subdirectories. Therefore, the policy file in the root directory applies to the entire server, but the policy file loaded from any subdirectory only applies to this directory and Its subdirectories.
The policy file only affects access to a specific server. For example, a policy file located in https://www.adobe.com: 8080/crossdomain. xml only applies to data loading calls on www.adobe.com over HTTPS on port 8080.
2. socket-specific policy files
<Cross-domain-Policy> <allow-access-from domain = "*" to-ports = "507"/> <allow-access-from domain = "* .example.com" -ports = "507,516"/> <allow-access-from domain = "* .example2.com" to-ports = "516-523"/> <allow-access-from domain =" www.example2.com"
To-ports = "507,516-523"/> <allow-access-from domain = "www.example3.com" to-ports = "*"/> </Cross-Domain-Policy> the policy file specifies the domains that hosts are allowed to use the port links.
Symptom:
The following error occurs during cross-origin access:
[Faultevent fault = [RPC fault faultstring = "Security Error accessing URL" faultcode = "channel. security. error "faultdetail =" Destination: defaulthttp "] messageid =" 30264797-440f-313e-3d8a-b7add000093b5 "type =" fault "Bubbles = false cancelable = true eventphase = 2]
Solution:
<? XML version = "1.0"?> <! Doctype cross-domain-Policy System "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<Cross-domain-Policy> <site-control permitted-Cross-Domain-policies = "all"/> <allow-access-from domain = "*" secure = "true" /> <allow-http-request-headers-from domain = "*" headers = "*"/> </Cross-Domain-Policy>
When the SWF file is accessed across domains, the following error is reported:
[RPC fault faultstring = "Security Error accessing URL" faultcode = "channel. Security. error" faultdetail = "Destination: defaulthttp"]
At MX. RPC: abstractinvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler ()
At MX. RPC: responder/fault ()
At MX. RPC: asyncrequest/fault ()
At directhttpmessageresponder/securityerrorhandler ()
At flash. Events: eventdispatcher/dispatcheventfunction ()
At flash. Events: eventdispatcher/dispatchevent ()
At flash.net: urlloader/redirectevent ()
The solution is to create a file named crossdomain. xml under the root directory of the website where WebService (or httpservice) is located. The content is as follows:
<? XML version = "1.0"?>
<Cross-domain-Policy>
<Allow-access-from domain = "*"/>
<Allow-http-request-headers-from domain = "*" headers = "*"/>
</Cross-Domain-Policy>
The * symbol can be set according to your actual needs to allow access to the domain name. For example, to only allow access to the page from chenfeisoft.com, you can set it as follows:
<Cross-domain-Policy>
<Allow-access-from domain = "* .chenfeisoft.com"/>
<Allow-http-request-headers-from domain = "* .chenfeisoft.com" headers = "*"/>
</Cross-Domain-Policy>
If the WebService you want to call is not on a server that you can control, you can also use JavaScript to write a local proxy for access, such as proxy. asp.
<% @ Language = "jscript" codePage = "65001" %>
<%
With (response ){
Charset = "UTF-8 ";
Buffer = true;
Expires =-10;
}
Function proxy (URL ){
This. url = URL;
This. Write = function (){
If (URL. Length = 0 | url = undefined)
Error ("URL cannot be blank ");
VaR x = new activexobject ("Microsoft. XMLHTTP ");
X. Open ("get", this. url, false );
X. Send ();
Response. Write (X. responsetext );
X = NULL;
}
Function error (Message ){
Response. Write (Message );
Response. End ();
}
}
VaR proxy = new proxy (string (request. querystring ));
Proxy. Write ();
%>
Can I use www.yourdonmain.com/proxy.asp? Visit http://www.destination.com/service.xml
Reprinted: http://blog.csdn.net/feitianfjl/article/details/5838330
[RPC fault faultstring = "Security Error accessing URL"
Faultcode = "channel. Security. error" faultdetail = "Destination: defaulthttp"]
At MX. RPC: abstractinvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler () [E: \ Dev \ hero_private \ frameworks \ projects \ RPC \ SRC \ MX \ RPC \ abstractinvoker. As: 345]
At MX. RPC: responder/fault () [E: \ Dev \ hero_private \ frameworks \ projects \ RPC \ SRC \ MX \ RPC \ responder. As: 68]
At MX. RPC: asyncrequest/fault () [E: \ Dev \ hero_private \ frameworks \ projects \ RPC \ SRC \ MX \ RPC \ asyncrequest. As: 113]
At directhttpmessagerespondER/securityerrorhandler () [E: \ Dev \ hero_private \ frameworks \ projects \ RPC \ SRC \ MX \ messaging \ channels \ directhttpchannel. As: 437]
At flash. Events: eventdispatcher/dispatcheventfunction ()
At flash. Events: eventdispatcher/dispatchevent ()
At flash.net: urlloader/redirectevent ()
Old, learn Old!
I recently studied Flex + MySQL + PhP communication. The above error was encountered during the test today. It turns out to be a domain problem,
No wonder an error is reported when you configure the default PHP address to run the data source in flex. The information on the internet is called XML, and there are other methods, but it's just a demo that doesn't have to be so complicated.
Open the flex4.5 running configuration and modify the URL path to IP (non-127.0.0.1 and localhost)
Reprinted: http://blog.sina.com.cn/s/blog_735cd12d0100u1fn.html
In actual processing, if the policy file is still in error status, you need to carefully check whether the request address is valid. For example, whether the request address is missing www or the address is reset.