Naveen Venkatraj
Naveen Venkatraj

Reputation: 31

How to create sales order in Netsuite using SOAP API with TBA credentials?

I have spent more time on creating Sales order in Netsuite using SOAP API with SOAP API. I have tried the following payload and getting error message as Invalid SOAPAction header: get

<?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>
        <ns1:preferences  xmlns:ns1="urn:messages_2017_2.platform.webservices.netsuite.com">
            <ns1:warningAsError>false</ns1:warningAsError>
            <ns1:ignoreReadOnlyFields>true</ns1:ignoreReadOnlyFields>
        </ns1:preferences>
        <ns2:tokenPassport soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:ns2="urn:messages_2017_2.platform.webservices.netsuite.com">
            <ns3:account xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{account}}</ns3:account>
            <ns3:consumerKey xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{consumerKey}}</ns3:consumerKey>
            <ns3:token xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{tokenId}}</ns3:token>
            <ns3:nonce xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{nonce}}</ns3:nonce>
            <ns3:signature algorithm="HMAC-SHA256" xmlns:ns3="urn:core_2017_2.platform.webservices.netsuite.com">{{signature}}</ns3:signature>
        </ns2:tokenPassport>
    </soapenv:Header>
    <soapenv:Body>
        <add xmlns="urn:messages_2017_2.platform.webservices.netsuite.com">
            <record xsi:type="ns4:SalesOrder" xmlns:ns4="urn:sales_2017_2.transactions.webservices.netsuite.com">
                <ns4:entity internalId="1655 customer" xsi:type="ns5:RecordRef"
      xmlns:ns5="urn:core_2017_2.platform.webservices.netsuite.com">
                    <ns5:name xsi:type="xsd:string">LAZADA-SG1</ns5:name>
                </ns4:entity>
                <ns4:tranDate xsi:type="xsd:dateTime">2017-12-14T18:16:44.000Z</ns4:tranDate>
                <ns4:shipAddressList internalId="84" xsi:type="ns6:RecordRef"
      xmlns:ns6="urn:core_2017_2.platform.webservices.netsuite.com"/>
                <ns4:itemList replaceAll="true" xsi:type="ns4:SalesOrderItemList">
                    <ns4:item xsi:type="ns4:SalesOrderItem">
                        <ns4:item internalId="387 inventoryItem" xsi:type="ns7:RecordRef"
            xmlns:ns7="urn:core_2017_2.platform.webservices.netsuite.com"/>
                        <ns4:quantity xsi:type="xsd:double">2.0</ns4:quantity>
                    </ns4:item>
                </ns4:itemList>
            </record>
        </add>
    </soapenv:Body>
</soapenv:Envelope>

Also, I have tried different versions.

Can someone help to share the sample SOAP XML payload to create Sales order in netsuite?

Upvotes: 2

Views: 1967

Answers (1)

Naveen Venkatraj
Naveen Venkatraj

Reputation: 31

It's working Here I have got the payload to POST the sales order successfully in Netsuite with basic details

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Header>
    <preferences xmlns="urn:messages_2020_1.platform.webservices.netsuite.com">
            <warningAsError>false</warningAsError>
            <ignoreReadOnlyFields>true</ignoreReadOnlyFields>
        </preferences>
        <tokenPassport xsi:type="TokenPassport">
            <account>{{account}}</account>
            <consumerKey>{{consumerKey}}</consumerKey>
            <token>{{tokenId}}</token>
            <nonce>{{nonce}}</nonce>
            <timestamp>{{timestamp}}</timestamp>
            <signature algorithm="HMAC-SHA256">{{signature}}=</signature>
        </tokenPassport>
    </soap:Header>
    <soap:Body>
            <add>
                <record xsi:type="tranSales:SalesOrder" xmlns:tranSales="urn:sales_2020_1.transactions.webservices.netsuite.com">
                    <entity internalId="1655"/>
                    <itemList>
                        <item>
                            <item internalId="387"/>
                            <quantity>3</quantity>
                            <amount>45.3</amount>
                        </item>
                    </itemList>
                </record>
            </add>
    </soap:Body>
</soap:Envelope>

Upvotes: 1

Related Questions