Search code examples
.netasmxdynamics-crm-2015

ASMX webservice doesn't serialize part of objects


I develop ASMX proxy webservice that is used with JS from a portal. All that webservice is doing is calling other webservice and returns data to a caller. This is done to revoke cross-domain JS calls.

Here is the code of my webservice:

    [WebMethod]
    public EntityCollection GetEnterpriseProducts(string entityName, string id)
    {
        OrganizationRequest request = new OrganizationRequest()
        {
            RequestName = "dot_GetEnterpriseProducts"
        };
        request["EntityType"] = entityName;
        request["EntityId"] = id;

        var response = GetService().Execute(request);

        return (EntityCollection)response.Results["Products"];
    }

When I debug code I see that returned result is correct and contains valid data. But when call is done from JS for some reason part of data disappears. Here is what I get after the call:

Result from fiddler

If that could help I call CRM 2015 endpoint to get the data.


Solution

  • The correct answer - don't use old-style dying ASMX webservices. Everything worked once I replaces ASMX webservice with WCF endpoint. Serialization works fine there.