简体   繁体   English

Tally 与 XML 和 HTTP 集成:分类帐创建失败

[英]Tally Integration with XML and HTTP : Ledger creation failure

I would like to integrate a third party application with tally over HTTP using XML.我想使用 XML 通过 HTTP 将第三方应用程序与计数集成。 When I try to import a ledger into tally through HTTP, it says Unknown Request, cannot be processed当我尝试通过 HTTP 将分类帐导入理货时,它显示未知请求,无法处理

Same XML format, when I import into tally manually using "Import Data" from "Gateway of Tally", it imports without errors and the ledger is created.相同的 XML 格式,当我使用“理货网关”中的“导入数据”手动导入理货时,它无误地导入并创建了分类帐。

Am I missing any HTTP headers?我是否缺少任何 HTTP 标头? Currently, I have "Content-Type" set to "text/xml";目前,我将“Content-Type”设置为“text/xml”; i also tried with "text/xml;charset=utf-16";我也尝试过“text/xml;charset=utf-16”;

With the same headers, there are other tally XML requests working when I tried in the same way使用相同的标头,当我以相同的方式尝试时,还有其他计数 XML 请求在工作

 <!-- language: xml -->
    <?xml version="1.0" encoding="UTF-8"?>
<ENVELOPE>
  <HEADER>
    <TALLYREQUEST>Import Data</TALLYREQUEST>
  </HEADER>
  <BODY>
    <IMPORTDATA>
      <REQUESTDESC>
        <STATICVARIABLES>
          <SVCURRENTCOMPANY>Test</SVCURRENTCOMPANY>
        </STATICVARIABLES>
      </REQUESTDESC>
      <REQUESTDATA>
        <TALLYMESSAGE xmlns:UDF="TallyUDF">
          <LEDGER NAME="name2" RESERVEDNAME="">
            <ADDRESS.LIST TYPE="String">
              <ADDRESS>line1, line2</ADDRESS>
              <ADDRESS>city</ADDRESS>
            </ADDRESS.LIST>
            <LEDSTATENAME>Goa</LEDSTATENAME>
            <PINCODE>403001</PINCODE>
            <MAILINGNAME.LIST TYPE="String">
              <MAILINGNAME>name2</MAILINGNAME>
            </MAILINGNAME.LIST>
            <CURRENCYNAME>₹</CURRENCYNAME>
            <EMAIL>testvira@email.com</EMAIL>
            <WEBSITE />
            <INCOMETAXNUMBER>LSWI2278DF</INCOMETAXNUMBER>
            <COUNTRYNAME>India</COUNTRYNAME>
            <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
            <PARENT>Sundry Debtors - Viras</PARENT>
            <NARRATION />
            <COUNTRYOFRESIDENCE>India</COUNTRYOFRESIDENCE>
            <EMAILCC>mysteryman@email.com</EMAILCC>
            <LEDGERPHONE>458923</LEDGERPHONE>
            <LEDGERCONTACT>Mystery Man</LEDGERCONTACT>
            <LEDGERMOBILE>6598765987</LEDGERMOBILE>
            <PARTYGSTIN>ASDF234kl56</PARTYGSTIN>
            <GSTNATUREOFSUPPLY>SEZ</GSTNATUREOFSUPPLY>
            <LANGUAGENAME.LIST>
              <NAME.LIST TYPE="String">
                <NAME>name2</NAME>
                <NAME>new name2</NAME>
              </NAME.LIST>
              <LANGUAGEID>1033</LANGUAGEID>
            </LANGUAGENAME.LIST>
            <PAYMENTDETAILS.LIST>
              <IFSCODE>ifsc code</IFSCODE>
              <BANKNAME>ScamNo1</BANKNAME>
              <ACCOUNTNUMBER>123456789</ACCOUNTNUMBER>
              <PAYMENTFAVOURING>name2</PAYMENTFAVOURING>
              <TRANSACTIONNAME>E-Payment</TRANSACTIONNAME>
              <SETASDEFAULT>No</SETASDEFAULT>
              <DEFAULTTRANSACTIONTYPE>Inter Bank Transfer</DEFAULTTRANSACTIONTYPE>
              <BENEFICIARYCODEDETAILS.LIST />
            </PAYMENTDETAILS.LIST>
            <LEDMULTIADDRESSLIST.LIST>
              <ADDRESS.LIST TYPE="String">
                <ADDRESS>Door No 1</ADDRESS>
                <ADDRESS>Road No 1</ADDRESS>
                <ADDRESS>Semmedu</ADDRESS>
              </ADDRESS.LIST>
              <EMAIL />
              <STATE>Tamil Nadu</STATE>
              <PINCODE>641114</PINCODE>
              <INCOMETAXNUMBER>LSWI2278DF</INCOMETAXNUMBER>
              <COUNTRYNAME>India</COUNTRYNAME>
              <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
              <ADDRESSNAME>City Office</ADDRESSNAME>
              <PARTYGSTIN>ASDF234kl56</PARTYGSTIN>
              <CONTACTPERSON>maverick</CONTACTPERSON>
              <ISOTHTERRITORYASSESSEE>No</ISOTHTERRITORYASSESSEE>
            </LEDMULTIADDRESSLIST.LIST>
            <LEDMULTIADDRESSLIST.LIST>
              <ADDRESS.LIST TYPE="String">
                <ADDRESS>Door No 1</ADDRESS>
                <ADDRESS>Road No 1</ADDRESS>
                <ADDRESS>Semmedu</ADDRESS>
              </ADDRESS.LIST>
              <EMAIL />
              <STATE>Tamil Nadu</STATE>
              <PINCODE>641114</PINCODE>
              <INCOMETAXNUMBER>LSWI2278DF</INCOMETAXNUMBER>
              <COUNTRYNAME>India</COUNTRYNAME>
              <GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>
              <ADDRESSNAME>Godown</ADDRESSNAME>
              <PARTYGSTIN>ASDF234kl56</PARTYGSTIN>
              <CONTACTPERSON>maverick</CONTACTPERSON>
              <ISOTHTERRITORYASSESSEE>No</ISOTHTERRITORYASSESSEE>
            </LEDMULTIADDRESSLIST.LIST>
          </LEDGER>
        </TALLYMESSAGE>
      </REQUESTDATA>
    </IMPORTDATA>
  </BODY>
</ENVELOPE>

I expect the output to be an XML which says ledger created but the actual output is Unknown Request, cannot be processed我希望输出是一个 XML,表示已创建分类帐,但实际输出是未知请求,无法处理

Quite late at seeing this, but if you still need an answer.很晚才看到这个,但如果你仍然需要答案。 Make the following changes to your XML -对您的 XML 进行以下更改 -

Make your Header as follows -使您的标题如下 -

  <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>IMPORT</TALLYREQUEST>
    <TYPE>DATA</TYPE>
    <ID>ALL MASTERS</ID>
  </HEADER>

Next within the Body Tag, remove the RequestDesc and RequestData tags and change the structure to -接下来在Body标签中,删除 RequestDesc 和 RequestData 标签并将结构更改为 -

  <BODY>
    <DESC>
      <STATICVARIABLES>
        <SVCURRENTCOMPANY>Test</SVCURRENTCOMPANY>
      </STATICVARIABLES>
    </DESC>
    <DATA>
      <TALLYMESSAGE>
        <LEDGER ACTION="CREATE">
           <NAME>name2</NAME>
           //OTHER LEDGER DETAILS GO HERE (same as you did with no changes)
        </LEDGER>
      </TALLYMESSAGE>
    <DATA>
  </BODY>

NOTE - You need to create the XML Attribute ACTION and assign the value CREATE .注意- 您需要创建 XML 属性ACTION并分配值CREATE This is exactly similar to when you create a new ledger in Tally through their GUI - which is going to "Accounts Info > Ledgers > Create" and similarly if you want to alter a ledger then set the ACTION="ALTER "这与您通过他们的 GUI 在 Tally 中创建一个新分类帐时完全相似——它将转到“帐户信息 > 分类帐 > 创建”,类似地,如果你想更改分类帐,则设置ACTION="ALTER "

<RequestDesc>, <RequestData> tags are only for export for import, it is <Desc>,<Data> <RequestDesc>, <RequestData>标签只为导出导入,是<Desc>,<Data>

Maybe I am too late to answer this question.也许我来不及回答这个问题。 Even I had this problem, but finally I found out that problem was due to the character encoding of the XML file.即使我也有这个问题,但最后我发现问题是由于 XML 文件的字符编码引起的。 What I did is as follows:我所做的如下:

Goto SaveAs > Select- AllFiles > yourfilename.xml转到 SaveAs > Select-AllFiles > yourfilename.xml

(Below will be a character encoding dropdown choose- ANSI or UTF-8 only ) (下面将是一个字符编码下拉列表选择 - 仅ANSI 或 UTF-8

This resolved my problem and I was able to POST the XML file.这解决了我的问题,我能够发布 XML 文件。

Hope it helps.希望能帮助到你。

Here's the minimum XML required for updating/altering ledger as per latest version ie Tally ERP 9 Series A 6.6这是根据最新版本更新/更改分类帐所需的最低 XML,即Tally ERP 9 Series A 6.6

<ENVELOPE>
  <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>IMPORT</TALLYREQUEST>
  </HEADER>

  <BODY>
    <DATA>
      <TALLYMESSAGE>
        <LEDGER NAME="D1" ACTION="ALTER">
          <!-- Fields -->
        </LEDGER>
      </TALLYMESSAGE>
    <DATA>
  </BODY>
</ENVELOPE>

Note that Ledger name is now mentioned as XML attribute <LEDGER NAME="D1" ACTION="ALTER">请注意,分类帐名称现在作为 XML 属性<LEDGER NAME="D1" ACTION="ALTER">

主理货导入屏幕

I replaced & with & amp;我将 & 替换为 &amp;

and now it is not showing error Unknown Request现在它没有显示错误未知请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM