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

时间:2019-04-17 08:40:07

标签: xml http integration tally

我想使用XML通过HTTP集成第三方应用程序与tally。当我尝试通过HTTP将分类帐导入理货时,显示“未知请求,无法处理

相同的XML格式,当我使用“ Tally网关”中的“导入数据”手动导入到Tally中时,它会正确导入,并创建分类帐。

我是否缺少任何HTTP标头? 目前,我已将“ Content-Type”设置为“ text / xml”;我也尝试过“ text / xml; charset = utf-16”;

使用相同的标题,当我以相同的方式尝试时,还有其他提示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>

我希望输出是一个XML,其中说创建了分类帐,但实际输出是Unknown Request,无法处理

4 个答案:

答案 0 :(得分:2)

看到这个很晚,但是如果您仍然需要答案。对您的XML进行以下更改-

按如下所示设置标题-

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

下一步,在 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>

注意-您需要创建XML属性 ACTION 并分配值 CREATE 。这与您通过其Tally在其Tally中创建新分类帐时非常相似-转到“帐户信息>分类帐>创建”,并且如果要更改分类帐,然后设置 ACTION =“ ALTER

答案 1 :(得分:0)

<RequestDesc>, <RequestData>标签仅用于导出  对于导入,它是<Desc> ,<Data>

答案 2 :(得分:0)

也许我来不及回答这个问题。即使是我也遇到了这个问题,但是最终我发现了这个问题是由于XML文件的字符编码引起的。 我所做的如下:

转到SaveAs>选择-AllFiles> yourfilename.xml

(下面将是一个字符编码下拉菜单-仅 ANSI或UTF-8

这解决了我的问题,我能够发布XML文件。

希望有帮助。

答案 3 :(得分:0)

这是根据最新版本(即Tally ERP 9 Series A 6.6

)更新/更改分类帐所需的最低XML
<ENVELOPE>
  <HEADER>
    <VERSION>1</VERSION>
    <TALLYREQUEST>IMPORT</TALLYREQUEST>
  </HEADER>

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

请注意,现在将分类帐名称作为XML属性提及 <LEDGER NAME="D1" ACTION="ALTER">

Tally import screen for master