使用基于令牌的身份验证获取交易摘要数据的第二页时出错

Error fetching second page of transaction summary data using Token-based authentication

我最近 运行 在使用 getPostingT运行sactionSummary 网络服务操作时使用 TBA 集成记录请求多页 t运行saction 摘要记录时遇到问题。

我发现第一个请求始终成功,但后续对连续页面的请求将失败并出现以下错误:

For pages > 1, search parameters must match the original search exactly

我遵循了 SuiteAnswer 33416 中标有“getPostingT运行sactionSummary returns 的建议 错误:对于页面 > 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>

请求第二页:

需要明确的是,第一次和第二次请求之间的唯一变化是随机数、时间戳、签名和 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 &gt; 1, search parameters must match the original search exactly</platformCore:message>
                    </platformCore:statusDetail>
                </platformCore:status>
            </platformCore:getPostingTransactionSummaryResult>
        </getPostingTransactionSummaryResponse>
    </soapenv:Body>
</soapenv:Envelope>

这个错误让我提示第一个请求没有正确缓存在 netsuite 端。对于第二个请求,我也尝试了令牌护照中的各种字段排列,但均无济于事。

感谢任何帮助。

此问题已解决:

1) 删除令牌护照节点所有后续请求 (pageIndex > 1)

<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>
    </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>

2) 在 headers (Set-Cookie) 的每个后续请求的第一个响应中保存并发送 jsessionid 和其他返回的 cookie