0

我有更改服务器,现在我遇到了 fechxml 问题,所有其他 SOAP 服务都在 100% 工作,比如更新、创建、删除、期望获取,我不知道或不知道发生这种情况的原因。

消息错误:

@"Server was unable to process request.
       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at ws.CrmService.CrmService.Fetch(String fetchXml) in c:\CRMServer\ws\ws\Web References\CrmService\Reference.cs:line 180
       at wsService.Crm2013test(String nomechave) in c:\CRMServer\ws\ws\test\test2013.cs:line 416"

参考.cs 文件:

[System.Web.Services.Protocols.SoapHeaderAttribute("CorrelationTokenValue")]
[System.Web.Services.Protocols.SoapHeaderAttribute("CrmAuthenticationTokenValue")]
[System.Web.Services.Protocols.SoapHeaderAttribute("CallerOriginTokenValue")]         [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/crm/2007/WebServices/Fetch",
 RequestNamespace="http://schemas.microsoft.com/crm/2007/WebServices",
 ResponseNamespace="http://schemas.microsoft.com/crm/2007/WebServices",
 Use=System.Web.Services.Description.SoapBindingUse.Literal,
 ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string Fetch(string fetchXml) {
    object[] results = this.Invoke("Fetch", new object[] {fetchXml});
    return ((string)(results[0]));
}

测试2013文件:

 public PrxActivityResult Crm2013test(string nomechave)

{
    PrxActivityResult res = new PrxActivityResult();
    Tb_Log_Create("WS.Crm2013test", "Entrada", "Codigo; valor:" + nomechave, "Anónimo");


    try
    {

        OrganizationServiceProxy organizationProxy = CrmServiceManager.GetOrganisationServiceProxy();
        CrmService service = CrmServiceManager.GetCrmService();

        Microsoft.Xrm.Sdk.Query.ConditionExpression condition = new Microsoft.Xrm.Sdk.Query.ConditionExpression("name", Microsoft.Xrm.Sdk.Query.ConditionOperator.Like, new string[] { nomechave });

        Microsoft.Xrm.Sdk.Query.FilterExpression filter = new Microsoft.Xrm.Sdk.Query.FilterExpression();
        filter.AddCondition(condition);
        filter.FilterOperator = Microsoft.Xrm.Sdk.Query.LogicalOperator.And;

        Microsoft.Xrm.Sdk.Query.QueryExpression query = new Microsoft.Xrm.Sdk.Query.QueryExpression();
        query.EntityName = "account";
        query.ColumnSet = new Microsoft.Xrm.Sdk.Query.ColumnSet(true);
       // query.Criteria = filter;

        EntityCollection ec = organizationProxy.RetrieveMultiple(query);

        string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
            <entity name='account'>
            <attribute name='name'/>
            <attribute name='telephone1'/>
            </entity></fetch>";

        string ret = service.Fetch(fetchXml);
        res.XmlContent = ret;

        }


    catch (Exception ex)
    {
    }
    return res;
}

有人知道是什么吗?太感谢了

4

1 回答 1

1

不知道是否还有其他内容,但您</Entity>在 fetch XML 中缺少结束标记。

编辑

想知道为什么要滚动您自己的 Fetch SOAP。

应该只是做这样的事情:

string fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
    <entity name='account'>
    <attribute name='name'/>
    <attribute name='telephone1'/>
</fetch>";

EntityCollection ec = organizationProxy.RetrieveMultiple(new FetchExpression(fetchXml));

此外,OrganizationServiceProxyimplementsIDisposible和因此应包含在 using 语句中

于 2013-09-25T18:23:10.953 回答