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

时间:2016-11-02 19:31:55

标签: netsuite suitetalk

在使用带有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 &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 个答案:

答案 0 :(得分:0)

此问题已通过以下方式解决:

1)删除令牌护照节点所有后续请求(pageIndex&gt; 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)在每个后续请求的第一个响应中保留并发送jsessionid和其他在标题(Set-Cookie)中返回的cookie