SOAP 请求中缺少必需的输入字段以激活全局自定义操作
Required input field missing in SOAP request to activate global custom action
我正在尝试在 dynamics 2015 中激活全局自定义操作,这将反过来激活在其上注册的插件。当我将参数标记为可选时,我可以激活它,然后激活我正在编写的插件。但是,当自定义操作输入参数设置为必需时,它会抛出一个错误,指出它未提供,即使我传递的键值对具有所需字段名称的键和实体逻辑名称的值。
使用一个必需的输入参数 (entityName) 设置自定义操作。尽管在发送时存在键值对,但它无法识别它并吐回未提供它。
正在发送的XML:
var requestXML = "";
requestXML += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
requestXML += " <s:Body>";
requestXML += "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
requestXML += "<request xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
requestXML += " <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
requestXML += " <a:KeyValuePairOfStringanyType>";
requestXML += " <b:key>entityName</b:key>";
requestXML += " <b:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + Xrm.Page.data.entity.getEntityName();
requestXML += " </b:value>";
requestXML += " </a:KeyValuePairOfStringanyType>";
requestXML += " </a:Parameters>";
requestXML += " <a:RequestId i:nil=\"true\" />";
requestXML += " <a:RequestName>new_StartCloning</a:RequestName>";
requestXML += " </request>";
requestXML += " </Execute>";
requestXML += " </s:Body>";
requestXML += "</s:Envelope>";
var req = new XMLHttpRequest();
req.open("POST", util.getBaseUrl() + "/XRMServices/2011/Organization.svc/web", false)
req.setRequestHeader("Accept", "application/xml, text/xml, */*");
req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
var response = req.send(requestXML);
返回错误信息:
s:ClientRequired field 'entityName' is missing-2147220989Required
field 'entityName' is
missing2015-08-05T20:55:26.0627226Z-2147220970System.ArgumentException:
Required field 'entityName' is missing2015-08-05T20:55:26.0627226Z
感谢阅读到这里哈哈。
<a:KeyValuePairOfStringanyType>
应该是
<a:KeyValuePairOfstringanyType>
我正在尝试在 dynamics 2015 中激活全局自定义操作,这将反过来激活在其上注册的插件。当我将参数标记为可选时,我可以激活它,然后激活我正在编写的插件。但是,当自定义操作输入参数设置为必需时,它会抛出一个错误,指出它未提供,即使我传递的键值对具有所需字段名称的键和实体逻辑名称的值。
使用一个必需的输入参数 (entityName) 设置自定义操作。尽管在发送时存在键值对,但它无法识别它并吐回未提供它。
正在发送的XML:
var requestXML = "";
requestXML += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">";
requestXML += " <s:Body>";
requestXML += "<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">";
requestXML += "<request xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">";
requestXML += " <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">";
requestXML += " <a:KeyValuePairOfStringanyType>";
requestXML += " <b:key>entityName</b:key>";
requestXML += " <b:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + Xrm.Page.data.entity.getEntityName();
requestXML += " </b:value>";
requestXML += " </a:KeyValuePairOfStringanyType>";
requestXML += " </a:Parameters>";
requestXML += " <a:RequestId i:nil=\"true\" />";
requestXML += " <a:RequestName>new_StartCloning</a:RequestName>";
requestXML += " </request>";
requestXML += " </Execute>";
requestXML += " </s:Body>";
requestXML += "</s:Envelope>";
var req = new XMLHttpRequest();
req.open("POST", util.getBaseUrl() + "/XRMServices/2011/Organization.svc/web", false)
req.setRequestHeader("Accept", "application/xml, text/xml, */*");
req.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
req.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
var response = req.send(requestXML);
返回错误信息:
s:ClientRequired field 'entityName' is missing-2147220989Required field 'entityName' is missing2015-08-05T20:55:26.0627226Z-2147220970System.ArgumentException: Required field 'entityName' is missing2015-08-05T20:55:26.0627226Z
感谢阅读到这里哈哈。
<a:KeyValuePairOfStringanyType>
应该是
<a:KeyValuePairOfstringanyType>