I am trying to create a request on the Netsuite's API SuiteTalk and I find myself stuck on a simple request to attach a file ( in my fileCabinet ) to an Invoice, see below my request then the response I get.
What is particulary strange is that the format is also like the one I found on SuiteAnswers during my research for an answer.
<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>
RESPONSE
<?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>
EDIT: This the WSDL
<message name="attachRequest">
<part name="parameters" element="platformMsgs:attach"/>
</message>
The platformMsgs:
<complexType name="AttachRequest">
<sequence>
<element name="attachReference" type="platformCore:AttachReference" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<element name="attach" type="platformMsgs:AttachRequest"/>
The platformCore for attach:
<!-- ******************************************************************** -->
<!-- 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 -->
The 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"/>
The 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>