Error when parsing the provided XML text stream

Raymond Dacillo
Raymond Dacillo Member Posts: 12
edited February 2020 in Accounts Hosted
{
"FileName":"Q:\Mycompanyfile.QBW",
"Operation":"<?xml version="1.0\""?><?qbxml version=\""6.1\""?><QBXML><QBXMLMsgsRq onError=\""stopOnError\"">
<ItemInventoryAddRq>
<ItemInventoryAdd>
<Name>test name</Name>
<FullName>test code</FullName>
<IsActive>true</IsActive>
<SalesPrice>100</SalesPrice>
<PurchaseCost>200</PurchaseCost>
<QuantityOnHand>300</QuantityOnHand>
<SalesDesc>description</SalesDesc>
</ItemInventoryAdd>
</ItemInventoryAddRq>
</QBXMLMsgsRq>
</QBXML>"",
""UserName"":""username"",
""Password"":""password"",
""CountryVersion"":""2015.R2.AU""
}
When I request this to api it always return to this. 
{
    ""Message"": ""Error connecting to Reckon Accounts. Reckon Accounts found an error when parsing the provided XML text stream.""
}

But when I tried to other endpoints like CustomerAddRq its success.

and also another question. If I only supplied the required field is that okay?

Thanks"

Comments

  • PhuongDo
    PhuongDo Reckon Developer Partner Posts: 314 ✭✭✭
    edited February 2020
    Hi Raymond, Welcome to reckon sdk world :) I’m not in front of my pc but if you said the customer add request works with the exact same params( company path, username, password and version) then there is only one thing left. It is the order of all the field tags, ie.Name, IsActive, etc.. You need to make sure they follow the exact order from the xml onscreen reference help page. Otherwise, you will get the error that you see right now. Few more things specifically with your example: - You don’t need to assign full name or is active - You miss Income Account and Expense Account as they are required. Sorry can’t go into detail without my laptop. But feel free to drop me an email if you need some further assistance. It is phuong@cactussoftware.com.au. Thanks, Phuong


    Phuong Do / Reckon Developer Partner

    phuong@cactussoftware.com.au


  • Raymond Dacillo
    Raymond Dacillo Member Posts: 12
    edited February 2020
    Hi Phuong Do,

    Thanks for the response. Just a question as per checking in SDK version 6.0 the two field you mention is an optional
    - Income Account
    - Expense Account (Actually I didn't see this)
    By the way these two fields are not needed on my side. So what will be the value for this? and also I tried the exact order in the request. By still I getting that error.

    Thanks so much for the help,

    Raymond

  • PhuongDo
    PhuongDo Reckon Developer Partner Posts: 314 ✭✭✭
    edited February 2020
    Hi Raymond,

    Sorry, it is COGSAccount, even it seems to be optional from the doc, but you need to define them when adding an item. So you will need to use a valid Account from Reckon. 

    For eg, IncomeAccountRef will have something like:
    <IncomeAccountRef>
       <FullName>[Name of the Income account in Reckon]</FullName>
    </IncomeAccountRef>

    I have a look at the order, it needs to be:

    Name
    SalesDesc
    SalesPrice
    IncomeAccountRef
    COGSAccountRef
    QuantityOnHand

    If what you try still doesn't work, please share your XML.

    Thanks,

    Phuong


    Phuong Do / Reckon Developer Partner

    phuong@cactussoftware.com.au


  • Raymond Dacillo
    Raymond Dacillo Member Posts: 12
    edited February 2020
    Hi Phuong Do,

    I tried the order that you said. Here's the XML format that I requested.

    {
    "FileName":"Q:\Mycompanyfile.QBW",
    "Operation":"<?xml version="1.0\""?><?qbxml version=\""6.1\""?><QBXML><QBXMLMsgsRq onError=\""stopOnError\"">
    <ItemInventoryAddRq>
         <ItemInventoryAdd>
             <Name>test name</Name>
             <SalesDesc>description</SalesDesc>
             <SalesPrice>100</SalesPrice>
             <IncomeAccountRef>
                 <ListID>80000053-1210287107</ListID>
                 <FullName>Sales:Windows</FullName>
             </IncomeAccountRef>
             <PurchaseCost>200</PurchaseCost>
             <COGSAccountRef>
                 <ListID>80000052-1210286986</ListID>
                 <FullName>Purchases / GOGS:Windows</FullName>
             </COGSAccountRef>
             <QuantityOnHand>300</QuantityOnHand>
        </ItemInventoryAdd>
    </ItemInventoryAddRq>
    </QBXMLMsgsRq>
    </QBXML>"",
    ""UserName"":""username"",
    ""Password"":""password"",
    ""CountryVersion"":""2015.R2.AU""
    }

    By the way how do I know in their doc if the field is needed to be define even it said optional?

    Thanks again,

    Raymond"
  • PhuongDo
    PhuongDo Reckon Developer Partner Posts: 314 ✭✭✭
    edited February 2020
    Normally all the fields are correctly stated as optional. But one way you can test is to create something directly in Reckon Hosted. If it said you need to select an account, then it is a required field.

    Re your message, I haven't got a chance to try it but please make sure the countryversion is correct. ie. if it is a Reckon Hosted AU version, the correct version should be 2019.R2.AU now.

    And when you assign any entity, only need to provide ListID or FullName, no need to have both of them.


    Phuong Do / Reckon Developer Partner

    phuong@cactussoftware.com.au


  • Raymond Dacillo
    Raymond Dacillo Member Posts: 12
    edited February 2020
    Oh okay, Thanks for that. Now I know what to do when I encounter that error again. By the way I already find out what causes an error. "AssetAccountRef" is also a required field.

    Thanks to you it helps me a lot. :)