我正试图在Netsuite的API SuiteTalk上创建一个请求,我发现自己陷入了一个简单的请求,即将一个文件(在我的fileCabinet中)附加到发票上,请参见下面的请求,然后是我得到的响应。
特别奇怪的是,这种格式也类似于我在SuiteAnswers上寻找答案时发现的格式。
<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>响应
<?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
<message name="attachRequest">
<part name="parameters" element="platformMsgs:attach"/>
</message>platformMsgs:
<complexType name="AttachRequest">
<sequence>
<element name="attachReference" type="platformCore:AttachReference" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<element name="attach" type="platformMsgs:AttachRequest"/>附加的platformCore:
<!-- ******************************************************************** -->
<!-- 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
<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:
<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>发布于 2022-01-13 21:36:31
我发现Netsuite不支持HMAC-SHA1 1,所以我切换到HMAC-SHA1 256,现在它正在工作,我也切换到了2021_2 WSDL。
对于邮递员上的SHA256签名,可以在互联网上找到重新来源。
<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>https://stackoverflow.com/questions/70468582
复制相似问题