Cross-domain WS calls - I tried everything RRS feed

  • Question

  • Please help, I am really desperate. For the last week I tried everything to get my cross-domain web service calls to work. I've read everything I could find about the problem, but still without a success.


    My scenario:

    I have Cache web services on a server. They are to be called thru HTTPS with WS-Security ("TransportWithMessageCredential" binding option). These are already developed and tested with other (.NET windows forms) application. Please note that using "Transport" binding option always ends up with the same error.

    I developer SilverLight 3 application to communicate with these services.


    Please note, that I:

    1. Have created both clientaccesspolicy.xml and crossdomain.xml files and placed them to the root of the server.
    2. Am testing my SilverLight application from ASP.NET web application (http://localhost:xxxx/...).
    3. Have tried changing collection type from ObservableCollection to List in service reference settings.
    4. Tried sniffing with Web Development Helper - both clientaccesspolicy.xml and crossdomain.xml are correctly returned from server (SilverLight does not request crossdomain.xml in case clientaccesspolicy.xml is in place). No further request to server is made after requesting these files.


    My ServiceReferences.ClientConfig file:

                    <binding name="WSE4NPSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                        <security mode="TransportWithMessageCredential" />
                <endpoint address="https://e4vyv.DOMAIN.sk/csp/e4np/E4NP.WS.WSE4NP.cls"
                    binding="basicHttpBinding" bindingConfiguration="WSE4NPSoap"
                    contract="Server.WSE4NPSoap" name="WSE4NPSoap" />


    My clientaccesspolicy.xml file:

    <?xml version="1.0" encoding="utf-8"?>
                <allow-from http-request-headers="SOAPAction">
                    <domain uri="*"/>
                    <resource path="/" include-subpaths="true"/>


    My crossdomain.xml file:

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


    My code calling web service method:

    ChannelFactory<WSE4NPSoap> channelFactory = new ChannelFactory<WSE4NPSoap>("*");
    channelFactory.Credentials.UserName.UserName = "USERNAME";
    channelFactory.Credentials.UserName.Password = "PASSWORD";
    WSE4NPSoap ws = channelFactory.CreateChannel();
    GetPlayListRequestBody requestBody = new GetPlayListRequestBody(this.settings.PlayerId, null);
    GetPlayListRequest request = new GetPlayListRequest(requestBody);
    IAsyncResult asyncResult = ws.BeginGetPlayList(request, null, null);
    GetPlayListResponse response = ws.EndGetPlayList(asyncResult);


    At runtime I get this error:

    An error occurred while trying to make a request to URI 'https://e4vyv.DOMAIN.sk/csp/e4np/E4NP.WS.WSE4NP.cls'. 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.


    Thank you very much for any help.

    Thursday, September 24, 2009 4:21 AM


  • Am testing my SilverLight application from ASP.NET web application (http://localhost:xxxx/...).

    There is a cross-schema issue here, HTTP-hosted silverlight cannot access any resource hosted in HTTPS. Please check this article


    You need host your silverlight in https as well.


    Monday, September 28, 2009 4:07 AM

All replies