This article describes how to read the Tally Server Response after a XML request is sent using the Send() function. To begin with, let us see the C language declaration of the Send() function.
C language declaration of the Send() function
int __stdcall Send(message);
Remarks:-
- The send function returns an Integer value (Zero for success, otherwise the error-code).
- If the return value is Zero, it implies that the XML request has been successfully sent to the Tally server.
Analysing the Tally Server Response
As mentioned above, if the Send() function returns 0 (Zero), it implies that the XML Request has been successfully sent to the Tally Server. The XML requested can be either reading or writing data to the Tally' database. Example of XML Request:-
- Export (read) any report data (Trial balance, Ledger etc.)
- Import (write) any master or voucher data to Tally's database
- If you had requested for any Report, the Tally Server response will contain the Report data.
- If you had requested for writing data to Tally's database, the Tally Server response will contain details whether a new records is created; or altered or deleted.
C language declaration of ResponseText() function
LPSTR __stdcall ResponseText(void);
You can either display the response message in a Message-Box or parse it using XML DOM. Use the following VB code to parse the response message and check if any errors are there or not.
Sample VB code
Set ChildNodes = XMLDOM.SelectNodes("/RESPONSE/LINEERROR")
if (ChildNodes.Length > 0) then
MsgBox "Tally write error"
else
MsgBox "Success"
end if
For more information about using XML DOM, please refer the topic "Using XML DOM" in "RTSlink - An Insight" document which can be downloaded from www.rtslink.com/downloads.html
Shweta Computers
www.rtslink.com