首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NETSUITE SuiteTalk : SOAP请求-附加

NETSUITE SuiteTalk : SOAP请求-附加
EN

Stack Overflow用户
提问于 2021-12-24 00:32:03
回答 1查看 409关注 0票数 0

我正试图在Netsuite的API SuiteTalk上创建一个请求,我发现自己陷入了一个简单的请求,即将一个文件(在我的fileCabinet中)附加到发票上,请参见下面的请求,然后是我得到的响应。

特别奇怪的是,这种格式也类似于我在SuiteAnswers上寻找答案时发现的格式。

代码语言:javascript
复制
<soapenv:Envelope 
        xmlns:xsd='http://www.w3.org/2001/XMLSchema'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
        xmlns:platformCore='urn:core_2019_2.platform.webservices.netsuite.com'
        xmlns:platformMsgs='urn:messages_2019_2.platform.webservices.netsuite.com'>
       <soapenv:Header>
            <tokenPassport>
                <account>{{ACCOUNT}}</account>
                <consumerKey>{{CONSUMER_KEY}}</consumerKey>
                <token>{{TOKEN_ID}}</token>
                <nonce>{{nonce}}</nonce>
                <timestamp>{{timestamp}}</timestamp>
                <signature algorithm="HMAC-SHA1">{{signature}}</signature>
            </tokenPassport>        
        </soapenv:Header>
       <soapenv:Body> 
            <attach xsi:type='platformMsgs:AttachRequest'>
                <attachReference xsi:type='platformCore:AttachBasicReference'>
                    <attachTo xsi:type='platformCore:RecordRef' internalId='1261476' type='invoice'></attachTo> 
                    <attachedRecord xsi:type='platformCore:RecordRef' internalId='413612' type='file'></attachedRecord>
                </attachReference>
            </attach>
       </soapenv:Body>
    </soapenv:Envelope>

响应

代码语言:javascript
复制
<?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:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server.userException</faultcode>
            <faultstring>The request could not be understood by the server due to malformed syntax.</faultstring>
            <detail>
                <platformFaults:invalidCredentialsFault xmlns:platformFaults="urn:faults_2019_2.platform.webservices.netsuite.com">
                    <platformFaults:code>USER_ERROR</platformFaults:code>
                    <platformFaults:message>The request could not be understood by the server due to malformed syntax.</platformFaults:message>
                </platformFaults:invalidCredentialsFault>
                <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">partners011</ns1:hostname>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

编辑:这是WSDL

代码语言:javascript
复制
<message name="attachRequest">
<part name="parameters" element="platformMsgs:attach"/>
</message>

platformMsgs:

代码语言:javascript
复制
<complexType name="AttachRequest">
<sequence>
<element name="attachReference" type="platformCore:AttachReference" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<element name="attach" type="platformMsgs:AttachRequest"/>

附加的platformCore:

代码语言:javascript
复制
<!--  ********************************************************************  -->
<!--  Attach  -->
<!--  ********************************************************************  -->
<complexType name="AttachReference" abstract="true">
<sequence>
<element name="attachTo" type="platformCore:BaseRef" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>    
<complexType name="AttachBasicReference">
<complexContent>
<extension base="platformCore:AttachReference">
<sequence>
<element name="attachedRecord" type="platformCore:BaseRef" minOccurs="1" maxOccurs="1"/>
</sequence>
</extension>
</complexContent>
</complexType>
<!-- attach/end -->    

platformCore for BaseRef

代码语言:javascript
复制
<complexType name="BaseRef" abstract="true">
<sequence>
<element name="name" type="xsd:string" minOccurs="0"/>
<!--  record name  -->
</sequence>
</complexType>
<element name="baseRef" type="platformCore:BaseRef"/>

platformCore for RecordRef:

代码语言:javascript
复制
<complexType name="RecordRef">
<complexContent>
<extension base="platformCore:BaseRef">
<attribute name="internalId" type="xsd:string"/>
<attribute name="externalId" type="xsd:string"/>
<attribute name="type" type="platformCoreTyp:RecordType"/>
<!--  primary record internalId  -->
<!--  record type  -->
</extension>
</complexContent>
</complexType>
EN

回答 1

Stack Overflow用户

发布于 2022-01-13 21:36:31

我发现Netsuite不支持HMAC-SHA1 1,所以我切换到HMAC-SHA1 256,现在它正在工作,我也切换到了2021_2 WSDL。

对于邮递员上的SHA256签名,可以在互联网上找到重新来源。

代码语言:javascript
复制
<soapenv:Envelope 
        xmlns:xsd='http://www.w3.org/2001/XMLSchema'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
        xmlns:platformCore='urn:core_2021_2.platform.webservices.netsuite.com'
        xmlns:platformMsgs='urn:messages_2021_2.platform.webservices.netsuite.com'>
       <soapenv:Header>
            <tokenPassport>
                <account>{{ACCOUNT}}</account>
                <consumerKey>{{CONSUMER_KEY}}</consumerKey>
                <token>{{TOKEN_ID}}</token>
                <nonce>{{nonce}}</nonce>
                <timestamp>{{timestamp}}</timestamp>
                <signature algorithm="HMAC-SHA256">{{signature}}</signature>
            </tokenPassport>        
        </soapenv:Header>
       <soapenv:Body> 
            <attach xsi:type='platformMsgs:AttachRequest'>
                <attachReference xsi:type='platformCore:AttachBasicReference'>
                    <attachTo xsi:type='platformCore:RecordRef' internalId='1261476' type='invoice'></attachTo> 
                    <attachedRecord xsi:type='platformCore:RecordRef' internalId='413612' type='file'></attachedRecord>
                </attachReference>
            </attach>
       </soapenv:Body>
    </soapenv:Envelope>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70468582

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档