Thursday, January 06, 2011

Attempting to access a service in a cross-domain way without a proper cross-domain policy in place......

Error: Attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute.
I resolved this issue by placing "ClientAccessPolicy.xml" into Web service location "C:/inetpup/MyService" folder.
Go ahead and create one "ClientAccessPolicy.xml" file with following content and save into your service location folder in "C:/inetpup/
<?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>

In some cases you may have place one more file "crossdomain.xml"

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

No comments: