在项目开发过程中,如果前台使用Silvrlight开发,调用Java开发Webservice。在部署Webservice的时候要注意,策略文件要正确放置,才能起到效果。
1、常见的Tomcat部署,要将策略文件放置到 ./webapps/ROOT/ 文件夹下。
2、如果使用nginx做负载均衡,要将策略文件放置到 html 文件夹下。
附带策略文件:clientaccesspolicy.xml
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>