Skip to Content
0

diapi update failed from xml.

Sep 08, 2017 at 09:09 AM

39

avatar image
Former Member

i have a xml file which is receiver <PayLoad> segment generated from b1i telegraph.

i want to update corrspoding entry using this xml file by diapi with dotnet.

but it failed. following is my code.

anyone can give me suggestion ?

xml file:

<?xmlversion="1.0"encoding="UTF-16"?>
<BOM>
 <BO>
 <AdmInfo>
 <Object>22</Object>
 <Version>2</Version>
 </AdmInfo>
 <QueryParams>
 <DocEntry>5917</DocEntry>
 </QueryParams>
 <Documents>
 <row>
 <DocEntry>5917</DocEntry>
 <CardCode>S2422</CardCode>
 <NumAtCard>10285810</NumAtCard>
 <DocDueDate>20170905</DocDueDate>
 <Confirmed>tYES</Confirmed>
 <Comments>hello world</Comments>
 </row>
 </Documents>
 <Document_Lines>
 <row>
 <LineNum>0</LineNum>
 <ItemCode>4933</ItemCode>
 <Quantity>4710</Quantity>
 </row>
 </Document_Lines>
 </BO>
</BOM>

way 1:

for (int i = 0; i < Company.GetXMLelementCount(FilePath); i++)
                       {
                           var objectType = Company.GetXMLobjectType(FilePath, i);
                           var bo = (Documents)Company.GetBusinessObject(objectType);
                           bo.UpdateFromXML(FilePath);
                       }

way 2:

for (int i = 0; i < Company.GetXMLelementCount(FilePath); i++)
                        {
                            var bo = (Documents)Company.GetBusinessObjectFromXML(FilePath,i);
                            bo.Update();
                        }
10 |10000 characters needed characters left characters exceeded

Hi Eric,

What error did you catch?

Call your update with the following validation:

if (bo.Update() != 0)
{
    MessageBox.Show(Company.GetLastErrorDescription());
}

After this, share your error.

Hope it helps.

Kind Regards,

Diego Lother

0
Former Member

i certainly know how to catch the exception, but still thank you for your answer.

i guess this xml format cannot be processed with default update method of DIAPI.

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers