Flex访问部署在JBoss4.2上的WebService时报错
Web Service Error
code: Channel.Security.Error
detail: Destination: DefaultHTTP
message: Security error accessing url
rootCause: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2170"]
detail: Destination: DefaultHTTP
message: Security error accessing url
rootCause: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2170"]
需要给JBoss设置crossdomain.xml,将crossdomain.xml放到
jboss-4.2.3.GA\server\default\deploy\jboss-web.deployer\ROOT.war 目录中。
这样用 http://域名或IP:8080/crossdomain.xml 是可以访问到xml的
crossdomain.xml内容如下: 在FlashPlayer9和10中测试通过
<?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="*" to-ports="*" secure="false"/> <allow-http-request-headers-from domain="*" headers="*" secure="false" /> </cross-domain-policy>
重启服务器后,问题解决
参考
http://technicalmumbojumbo.wordpress.com/2009/02/03/developing-a-flex-webservice-client/
http://curtismorley.com/2007/09/01/flash-flex-tutorial-how-to-create-a-crossdomainxml-file/
http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html