0

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.

Andrew Butenko
  • 5,048
  • 1
  • 14
  • 13
  • (What is "dot_GetEnterpriseProducts" ?) If you invoke the same call in browser is data correct ? – Alex Jul 16 '15 at 10:00
  • dot_GetEnterpriseProducts is Action (if you familiar with Dynamics CRM). Data looks the same if I both call webservice from HTML/JS or .Net app so seems that the result is incorrectly serialized. Looking for a way to override standard serialization. – Andrew Butenko Jul 16 '15 at 10:40
  • 1
    I concur that the asmx seems to be the culprit, unfortunately I don't know enough about asmx to provide a meaningful answer (other than "build viewmodels for the data and (de)serialize it yourself" which I'd anyway keep as a last-est resort...) – Alex Jul 16 '15 at 10:44
  • @Alex you were 100% right. Thanks for a hint! – Andrew Butenko Jul 17 '15 at 07:11

1 Answers1

0

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.

Andrew Butenko
  • 5,048
  • 1
  • 14
  • 13