0

我正在尝试使用 Microsoft Dynamics SOAP 请求:

XRMServices/2011/Organization.svc/web

提出以下要求:

<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">
<request i:type=\"a:retrieveOptionSetRequest\" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts\">
    <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">
        <a:KeyValuePairOfstringanyType>
            <b:key>Name</b:key>
            <b:value i:type=\"c:string\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\">new_industry</b:value>
        </a:KeyValuePairOfstringanyType>
    </a:Parameters>
    <a:RequestId i:nil=\"true\" />
</request>
</Execute>

但是,作为一个新手,我得到的只是“错误的请求”!任何帮助将不胜感激!

谢谢

4

1 回答 1

0

您的请求存在一些问题。首先,请求是“RetrieveOptionSetRequest”而不是“retrieveOptionSetRequest”(它会告诉你这不存在!)

其次,您的请求行中缺少“\”

<request i:type=\"a:retrieveOptionSetRequest\" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts\">

应该

<request i:type=\"a:RetrieveOptionSetRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">

如果您解决了这两个问题,那么您会发现您仍然无法获得所需的结果。从 Pedro Azevedo 提到的网站可以看出,您需要包含 MetadataId 和 RetrieveAsIfPublished 参数,否则您不会得到结果(响应会让您意识到这一点)。您需要在请求中包含 RequestName。

您的最终请求应如下所示

<Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">
<request i:type=\"a:RetrieveOptionSetRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\">
    <a:Parameters xmlns:b=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">
        <a:KeyValuePairOfstringanyType>
            <b:key>MetadataId</b:key>
            <b:value i:type=\"c:guid\" xmlns:c=\"http://schemas.microsoft.com/2003/10/Serialization/\">00000000-0000-0000-0000-000000000000</b:value>
        </a:KeyValuePairOfstringanyType>
        <a:KeyValuePairOfstringanyType>
            <b:key>Name</b:key>
            <b:value i:type=\"c:string\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\">new_industry</b:value>
        </a:KeyValuePairOfstringanyType>
        <a:KeyValuePairOfstringanyType>
            <b:key>RetrieveAsIfPublished</b:key>
            <b:value i:type=\"c:boolean\" xmlns:c=\"http://www.w3.org/2001/XMLSchema\">false</b:value>
        </a:KeyValuePairOfstringanyType>
    </a:Parameters>
    <a:RequestId i:nil=\"true\" />
    <a:RequestName>RetrieveOptionSet</a:RequestName>
</request>
</Execute>
于 2013-07-15T00:52:55.667 回答