我最近在使用带有 TBA 的集成记录在使用 getPostingTransactionSummary Web 服务操作时请求多页事务摘要记录时遇到了问题。
我发现第一个请求始终是成功的,但是对连续页面的后续请求将失败,并出现以下错误:
对于大于 1 的页面,搜索参数必须与原始搜索完全匹配
我遵循了 SuiteAnswer 33416 中标记为“getPostingTransactionSummary 返回错误:对于页面 > 1,搜索参数必须与原始搜索完全匹配”的建议。然后,我确保我们首先请求第一页,确保没有更改任何字段或过滤器参数,并立即请求第二页。
用于生成签名的机制似乎是正确的,因为对第一页的任何 Web 服务端点的所有调用总是成功的。
以下表示用于重现的请求序列(模拟真实数据):
第一页请求:
<x:Envelope xmlns:x="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn2="urn:messages_2015_2.platform.webservices.netsuite.com" xmlns:urn="urn:core_2015_2.platform.webservices.netsuite.com">
<x:Header>
<urn:tokenPassport>
<urn1:account>1234567</urn1:account>
<urn1:consumerKey>12345</urn1:consumerKey>
<urn1:token>1234</urn1:token>
<urn1:nonce>62005285</urn1:nonce>
<urn1:timestamp>1478114023</urn1:timestamp>
<urn1:signature algorithm="HMAC-SHA256">NIhrCvTi2SpGfhxbxO8N09WQ7mvXw7oJICiEewCtm1M=</urn1:signature>
</urn:tokenPassport>
</x:Header>
<x:Body>
<urn2:getPostingTransactionSummary>
<urn2:fields>
<urn:period>true</urn:period>
<urn:account>true</urn:account>
<urn:location>true</urn:location>
<urn:subsidiary>true</urn:subsidiary>
</urn2:fields>
<urn2:filters>
<urn:period>
<urn:recordRef internalId="1"/>
<urn:recordRef internalId="2"/>
<urn:recordRef internalId="3"/>
</urn:period>
<urn:account>
<urn:recordRef internalId="985" type="account"></urn:recordRef>
</urn:account>
</urn2:filters>
<urn2:pageIndex>1</urn2:pageIndex>
</urn2:getPostingTransactionSummary>
</x:Body>
</x:Envelope>
第一页响应:
<?xml version="1.0" encoding="UTF-8"?>
<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_2015_2.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_1234</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<getPostingTransactionSummaryResponse xmlns="urn:messages_2015_2.platform.webservices.netsuite.com">
<platformCore:getPostingTransactionSummaryResult xmlns:platformCore="urn:core_2015_2.platform.webservices.netsuite.com">
<platformCore:status isSuccess="true"/>
<platformCore:totalRecords>2150</platformCore:totalRecords>
<platformCore:pageSize>1000</platformCore:pageSize>
<platformCore:totalPages>3</platformCore:totalPages>
<platformCore:pageIndex>1</platformCore:pageIndex>
<platformCore:postingTransactionSummaryList>
<platformCore:postingTransactionSummary>
<platformCore:period internalId="1"/>
<platformCore:account internalId="985"/>
<platformCore:subsidiary internalId="1"/>
<platformCore:amount>100</platformCore:amount>
</platformCore:postingTransactionSummary>
<platformCore:postingTransactionSummary>
<platformCore:period internalId="1"/>
<platformCore:account internalId="985"/>
<platformCore:location internalId="3"/>
<platformCore:subsidiary internalId="2"/>
<platformCore:amount>100</platformCore:amount>
</platformCore:postingTransactionSummary>
.... MORE RECORDS HERE
</platformCore:postingTransactionSummaryList>
</platformCore:getPostingTransactionSummaryResult>
</getPostingTransactionSummaryResponse>
</soapenv:Body>
</soapenv:Envelope>
第二页请求:
需要明确的是,第一个和第二个请求之间的唯一变化是 nonce、timestamp、signature 和 pageIndex。
<x:Envelope xmlns:x="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn2="urn:messages_2015_2.platform.webservices.netsuite.com" xmlns:urn="urn:core_2015_2.platform.webservices.netsuite.com">
<x:Header>
<urn:tokenPassport>
<urn1:account>1234567</urn1:account>
<urn1:consumerKey>12345</urn1:consumerKey>
<urn1:token>1234</urn1:token>
<urn1:nonce>64687129</urn1:nonce>
<urn1:timestamp>1478114087</urn1:timestamp>
<urn1:signature algorithm="HMAC-SHA256">HWQ/O4MSz5L6/TRu0GhtxU37yXIHdhSqvznbG92Salg=</urn1:signature>
</urn:tokenPassport>
</x:Header>
<x:Body>
<urn2:getPostingTransactionSummary>
<urn2:fields>
<urn:period>true</urn:period>
<urn:account>true</urn:account>
<urn:location>true</urn:location>
<urn:subsidiary>true</urn:subsidiary>
</urn2:fields>
<urn2:filters>
<urn:period>
<urn:recordRef internalId="1"/>
<urn:recordRef internalId="2"/>
<urn:recordRef internalId="3"/>
</urn:period>
<urn:account>
<urn:recordRef internalId="985" type="account"></urn:recordRef>
</urn:account>
</urn2:filters>
<urn2:pageIndex>2</urn2:pageIndex>
</urn2:getPostingTransactionSummary>
</x:Body>
</x:Envelope>
第二页的响应:
<?xml version="1.0" encoding="UTF-8"?>
<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_2015_2.platform.webservices.netsuite.com">
<platformMsgs:nsId>WEBSERVICES_1234</platformMsgs:nsId>
</platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
<getPostingTransactionSummaryResponse xmlns="urn:messages_2015_2.platform.webservices.netsuite.com">
<platformCore:getPostingTransactionSummaryResult xmlns:platformCore="urn:core_2015_2.platform.webservices.netsuite.com">
<platformCore:status isSuccess="false">
<platformCore:statusDetail type="ERROR">
<platformCore:code>USER_ERROR</platformCore:code>
<platformCore:message>For pages > 1, search parameters must match the original search exactly</platformCore:message>
</platformCore:statusDetail>
</platformCore:status>
</platformCore:getPostingTransactionSummaryResult>
</getPostingTransactionSummaryResponse>
</soapenv:Body>
</soapenv:Envelope>
该错误导致我建议第一个请求未正确缓存在 netsuite 端。对于第二个请求,我还尝试了令牌护照中字段的各种排列,但均无济于事。
任何帮助表示赞赏。