【问题标题】:SuiteTalk SOAP API TransactionSearchBasic with type journalEntry fails类型为 journalEntry 的 SuiteTalk SOAP API TransactionSearchBasic 失败
【发布时间】:2021-12-02 13:39:19
【问题描述】:

我尝试使用 SuiteTalk SOAP API 获取我帐户中的所有日记条目。 但它失败了消息

字段类型的枚举值 对此无效 搜索。

请求和响应如下:

==================== Beginning of Request ====================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <ns1:searchPreferences xmlns:ns1="urn:messages_2021_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
      <ns1:pageSize>20</ns1:pageSize>
    </ns1:searchPreferences>
    <ns2:tokenPassport xmlns:ns2="urn:messages_2021_1.platform.webservices.netsuite.com" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0">
      <ns3:account xmlns:ns3="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns3:account>
      <ns4:consumerKey xmlns:ns4="urn:core_2021_1.platform.webservices.netsuite.com">#####3</ns4:consumerKey>
      <ns5:token xmlns:ns5="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns5:token>
      <ns6:nonce xmlns:ns6="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns6:nonce>
      <ns7:timestamp xmlns:ns7="urn:core_2021_1.platform.webservices.netsuite.com">#####</ns7:timestamp>
      <ns8:signature xmlns:ns8="urn:core_2021_1.platform.webservices.netsuite.com" algorithm="HMAC-SHA256">#####</ns8:signature>
    </ns2:tokenPassport>
  </soapenv:Header>
  <soapenv:Body>
    <search xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
      <searchRecord xmlns:ns9="urn:common_2021_1.platform.webservices.netsuite.com" xsi:type="ns9:TransactionSearchBasic">
        <ns9:type xmlns:ns10="urn:core_2021_1.platform.webservices.netsuite.com" operator="anyOf" xsi:type="ns10:SearchEnumMultiSelectField">
          <ns10:searchValue xsi:type="xsd:string">journalEntry</ns10:searchValue>
        </ns9:type>
      </searchRecord>
    </search>
  </soapenv:Body>
</soapenv:Envelope>
==================== End of Request ====================


==================== Beginning of Response ====================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <platformMsgs:documentInfo xmlns:platformMsgs="urn:messages_2021_1.platform.webservices.netsuite.com">
      <platformMsgs:nsId>#####</platformMsgs:nsId>
    </platformMsgs:documentInfo>
  </soapenv:Header>
  <soapenv:Body>
    <searchResponse xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
      <platformCore:searchResult xmlns:platformCore="urn:core_2021_1.platform.webservices.netsuite.com">
        <platformCore:status isSuccess="true">
          <platformCore:statusDetail type="WARN">
            <platformCore:code>WARNING</platformCore:code>
            <platformCore:message>The field type's enum value &lt;journalEntry&gt; is invalid for this search.</platformCore:message>
          </platformCore:statusDetail>
        </platformCore:status>
        <platformCore:totalRecords>0</platformCore:totalRecords>
        <platformCore:totalPages>0</platformCore:totalPages>
        <platformCore:searchId>#####a</platformCore:searchId>
        <platformCore:recordList/>
      </platformCore:searchResult>
    </searchResponse>
  </soapenv:Body>
</soapenv:Envelope>
==================== End of Response ====================

角色的权限如下:

【问题讨论】:

    标签: soap netsuite suitetalk


    【解决方案1】:

    搜索类型字符串应为“_journal”:

    <search xmlns="urn:messages_2021_1.platform.webservices.netsuite.com">
      <searchRecord xmlns:ns9="urn:common_2021_1.platform.webservices.netsuite.com" xsi:type="ns9:TransactionSearchBasic">
        <ns9:type xmlns:ns10="urn:core_2021_1.platform.webservices.netsuite.com" operator="anyOf" xsi:type="ns10:SearchEnumMultiSelectField">
          <ns10:searchValue xsi:type="xsd:string">_journal</ns10:searchValue>
        </ns9:type>
      </searchRecord>
    </search>
    

    https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/schema/enum/transactiontype.html?mode=packagehttps://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2021_1/schema/search/transactionsearchbasic.html?mode=package

    您应该始终使用模式浏览器来查找这些内容,因为它们在不同用途之间可能会有所不同。

    根据生成 SOAP 消息的方式,获取字符串的方式会有所不同。如果使用 C#、Visual Studio 和从 WSDL 创建的代理类,则应该有一个枚举可以为您提供正确的字符串值。

    编辑: 具体来说,这些值存储在一个名为 RecordType 的公共枚举中。在 C# 中,RecordType.JournalEntry(整数值为 94)会将“_journal”放在 SOAP 消息中。

    【讨论】:

    • 我正在使用从 content.netsuite.com/download/NSJavaClient2021-2.zip 下载的 Java 代理,但我没有找到“_journal”的等效记录类型,但仅适用于“journalEntry”
    • 嗨@SobanSoundararajan:在RecordRef 中设置类型属性时,您是使用公共枚举RecordType.journalEntry 还是仅使用字符串“journalEntry”?前者应该在 SOAP 消息中为您提供正确的结果(即“_journal”),而后者不会。如果你不使用公共枚举,但想用字符串设置属性,你必须使用“_journal”。
    • 正在使用 RecordType.journalEntry
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-30
    • 1970-01-01
    • 2021-02-22
    • 2017-01-31
    相关资源
    最近更新 更多