0
votes

This is the error which i get when i try to access my webservice from the local machine.

"An error occurred while trying to make a request to URI 'http://reddyincv-001-site1.myasp.net/WebService1.asmx'. This could be due to 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. Please see the inner exception for more details."

I have 2 xml files clientaccesspolicy.xml

<?xml version="1.0" encoding="utf-8" ? >
 <access-policy>
 <cross-domain-access>
<policy>
  <allow-from>
    <domain url="*"></domain>
  </allow-from>
  <grant-to>
    <resource include-subpaths="true" path="/"></resource>
  </grant-to>
</policy>

and crossdomain.xml

  <?xml version="1.0" encoding="utf-8" ?> <!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="SOAPAction,Content-Type"/>
   </cross-domain-policy>

These files are in the root 'http://reddyincv-001-site1.myasp.net/clientaccesspolicy.xml n so on

1
Have you place files clientaccesspolicy.xml and crossdomain.xml in your Silverlight project.? - NullReferenceException

1 Answers

1
votes

In your ClientAccessPolicy.xml, alter the allow-from attribute to add the specific http-request-headers ... like the following:

<?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 include-subpaths="true" path="/"/>
        </grant-to>
      </policy>
    </cross-domain-access>
  </access-policy>