Setting IsActive for Employee through qbXML

穿精又带淫゛_ 提交于 2019-12-20 03:54:13

问题


I keep the following error when adding or modifying Employees with QbXml: QuickBooks found an error when parsing the provided XML text stream.

I have tried true/false (which is the values that it returned), yes/no, and 1/0; none of which seem to work.

Is it possible to set the IsActive field for employees? Am I missing something?

Thanks!


Exception thrown was:

{System.Runtime.InteropServices.COMException (0x80040400): QuickBooks found an error when parsing the provided XML text stream.
   at Interop.QBXMLRP2.IRequestProcessor4.ProcessRequest(String ticket, String inputRequest)
   at PayrolImport.Program.Main(String[] args) in Program.cs:line 251
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()}

XML

<?xml version="1.0"?>
<?qbxml version="12.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <EmployeeModRq>
      <EmployeeMod>
        <ListID>8000007D-1367847338</ListID>
        <EditSequence>1367850617</EditSequence>
        <FirstName>first name</FirstName>
        <MiddleName>middle name</MiddleName>
        <LastName>last name</LastName>
        <IsActive>true</IsActive>
        <Email></Email>
        <AccountNumber>1</AccountNumber>
      </EmployeeMod>
    </EmployeeModRq>
  </QBXMLMsgsRq>
</QBXML>

回答1:


The order of XML elements in qbXML matters.

So if the QuickBooks OSR documentation shows that the order of XML elements should be this:

<ListID >IDTYPE</ListID> <!-- required -->
<EditSequence >STRTYPE</EditSequence> <!-- required -->
<IsActive >BOOLTYPE</IsActive> <!-- optional -->
... lots of other stuff here ... 

And you send this:

<ListID>8000007D-1367847338</ListID>
<EditSequence>1367850617</EditSequence>
... lots of other stuff here ... 
<IsActive>true</IsActive>

Then you'll get that error back:

(0x80040400): QuickBooks found an error when parsing the provided XML text stream.

That error is essentially QuickBooks trying to tell you that you have some error in your XML document.

If you send the nodes in the correct order it will work OK:

<ListID>8000007D-1367847338</ListID>
<EditSequence>1367850617</EditSequence>
<IsActive>true</IsActive>
<FirstName>first name</FirstName>
<MiddleName>middle name</MiddleName>
<LastName>last name</LastName>

As a side note, if you use the "XML Validator" tool included with the QuickBooks SDK, it will tell you exactly what is wrong with any XML message you feed to it.

Hope that helps!



来源:https://stackoverflow.com/questions/16400294/setting-isactive-for-employee-through-qbxml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!