ASMX webservice不会序列化部分对象

时间:2015-07-16 07:53:18

标签: .net asmx dynamics-crm-2015

我开发了与门户网站JS一起使用的ASMX代理Web服务。 Web服务所做的就是调用其他Web服务并将数据返回给调用者。这样做是为了撤销跨域JS调用。

以下是我的网络服务的代码:

    [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"];
    }

当我调试代码时,我看到返回的结果是正确的并包含有效数据。但是当由于某种原因从JS完成调用时,部分数据消失了。以下是我在电话会议后得到的内容:

Result from fiddler

如果可以帮助我调用CRM 2015端点来获取数据。

1 个答案:

答案 0 :(得分:0)

正确答案 - 不要使用旧式的ASMX Web服务。一旦我用WCF端点替换ASMX webservice,一切都有效。序列化在那里工作正常。

相关问题