我正在通过SOAPUI对CRM 2016组织进行SOAP调用。以下是工作电话:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<request i:type="a:CreateRequest" 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>Target</b:key>
<b:value i:type="a:Entity">
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>subject</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">SOAP UI Task</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>description</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">This is a test task created by SOAP UI.</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>regardingobjectid</b:key>
<b:value i:type="a:EntityReference">
<a:Id>10A25151-5331-E711-80D0-000C2995F954</a:Id>
<a:LogicalName>test_salesorder</a:LogicalName>
<a:Name i:nil="true" />
</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>test_tasktype</b:key>
<b:value i:type="a:OptionSetValue">
<a:Value>970390000</a:Value>
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true" />
<a:FormattedValues />
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>test_ordertask</a:LogicalName>
<a:RelatedEntities />
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil="true" />
<a:RequestName>Create</a:RequestName>
</request>
</Execute>
更改
<a:EntityState i:nil="true" />
to
<a:EntityState nil="true" />
给了我一个Formatter异常,我不确定为什么在没有命名空间的情况下让它出现异常?是否必须提供前缀/命名空间?
WSDL https://www.dropbox.com/s/1v7o7ol38jhd434/WSDL.txt?dl=0
答案 0 :(得分:3)
在这种情况下,它是强制性的。属性就像元素一样可以有命名空间。您必须为nillable元素设置的默认属性具有命名空间,因此需要进行设置。如果不是,则这不符合XML Schema Definition并且不会验证。
nil属性在XML Schema实例命名空间中定义, http://www.w3.org/2001/XMLSchema-instance(通常与。{ 前缀xsi),仅适用于XML实例文档,而不适用于XML 架构文件。 XML中xsi:nil属性的值为true element显式指定元素没有内容,是否 子元素或正文。