我正在发送正确的 XML(很确定,见下文),但同步失败并显示“QBXML 验证错误:[severity=FATAL_ERROR,message=cvc-complex-type.2.4.a: Invalid content was found started with element' ItemServiceRef'。应为“{EntityRef}”之一。,locator=[url=null,line=-1,column=-1,node=null,object=com.intuit.sb.datasync.writeback.qbxml.schema .ItemServiceRef@3409f69b,field=null]]"。我不知道 ItemServiceRef 是什么。这是我要发送的 XML:
<?xml version="1.0" encoding="utf-8"?>
<Add xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestId="126fcdcda65a4a15ab422a69a2f021b1" xsi:schemaLocation="http://www.intuit.com/sb/cdm/V2./RestDataFilter.xsd ">
<OfferingId>ipp</OfferingId>
<TimeActivity>
<TxnDate>2013-07-22</TxnDate>
<NameOf>Employee</NameOf>
<Employee>
<EmployeeId idDomain="NG">88025</EmployeeId>
</Employee>
<CustomerId idDomain="NG">1212626</CustomerId>
<ItemId idDomain="QB">1</ItemId>
<PayItemId idDomain="QB">10</PayItemId>
<BillableStatus>Billable</BillableStatus>
<Taxable>false</Taxable>
<HourlyRate>10.0</HourlyRate>
<Hours>1</Hours>
<Minutes>30</Minutes>
<Description>Some description</Description>
</TimeActivity>
</Add>
如果我将我的 xml 更改为此,那么一切正常:
<?xml version="1.0" encoding="utf-8"?>
<Add xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestId="126fcdcda65a4a15ab422a69a2f021b1" xsi:schemaLocation="http://www.intuit.com/sb/cdm/V2./RestDataFilter.xsd ">
<OfferingId>ipp</OfferingId>
<TimeActivity>
<TxnDate>2013-07-22</TxnDate>
<NameOf>Employee</NameOf>
<Employee>
<EmployeeId idDomain="QB">17</EmployeeId>
</Employee>
<CustomerId idDomain="QB">15</CustomerId>
<ItemId idDomain="QB">1</ItemId>
<PayItemId idDomain="QB">10</PayItemId>
<BillableStatus>Billable</BillableStatus>
<Taxable>false</Taxable>
<HourlyRate>10.0</HourlyRate>
<Hours>1</Hours>
<Minutes>30</Minutes>
<Description>Tutoring for Algebra</Description>
</TimeActivity>
</Add>
我所做的只是将我的 ID 更改为使用 QB 域 ID 而不是 NG 域 ID。我唯一遇到的问题是,当我通过 API 创建一个新对象时,Intuit 只返回我 NG 域 Id(因为它尚未创建 QB 域 Id)。所以 1,我必须获得 QB Id 的唯一方法是对我已经拥有 NG Id 的对象进行不必要的重新查询。2,如果我需要为尚未同步的客户/员工/供应商添加 TimeActivity ......我不能吗?