Using SOAP Web Services for Inbound Processing

Inbound e-document processing supports SOAP web services, which offer advantages in interoperability, flexibility and security in sending information over the internet. By enabling the web service features in NetSuite, you can receive XML files sent through web service and then capture information in XML for subsequent creation of e-documents. You can set up vendor or employee records to authorize them as web service senders. As authorized web service senders, these entities can send single or multiple XML files in one web service request.

Setting Up Inbound E-Document SOAP Web Services

  1. Go to Setup > Company > Enable Features.

    1. On the SuiteCloud subtab, under SuiteTalk (Web Services), check SOAP Web Services.

    2. Under Manage Authentication, check Token-Based Authentication.

    3. On the Web Presence subtab, under Access, check Vendor Access.

    4. Click Save.

      For more information, see SuiteCloud Features and Commerce Features.

  2. Create an integration record to generate authentication keys. Go to Setup > Integration > Integration Management > Manage Integrations > New. For more information, see Creating an Integration Record.

    1. Enter or select values in the Name and Description fields. Retain the default value in the State field, which is Enabled.

    2. On the Authentication subtab, check Token-based Authentication. The User Credentials box is checked by default, retain this.

    3. Click Save.

      The Consumer Key and Consumer Secret are generated and displayed on the integration record. Copy the Consumer Key and Consumer Secret to send to the vendors or parties that you want to authorize as web service senders.

  3. If you upgraded the Electronic Invoicing SuiteApp from a previous version, make sure that the custom role, Inbound E-Document Web Service Role, is included in the target audience of the E-Document Inbound UE script deployment. But if the SuiteApp is a new installation, you do not have to perform these steps.

    1. Go to Customization > Scripting > Scripts.

    2. Click the Deployments link of the E-Document Inbound UE script and edit the record.

    3. On the Audience subtab, under Roles, select Inbound E-Document Web Service Role to add it to the list of roles.

    4. Click Save.

  4. Assign the Inbound e-Document Web Services Role to the vendor or employee whom you want to authorize to be the sender of XML files through web service.

    1. Edit the vendor or customer record that you authorized as web service sender.

    2. On the vendor or customer record E-Document subtab, enter appropriate values in the Web Service ID and Web Service Sender fields.

      For the Web Service ID, you can assign any unique identifier of the vendor or the customer, like the tax ID. For the Web Service Sender, you can choose from the list a vendor or an employee, whom a vendor or employee designated to send e-documents of its behalf.

    3. Click Save.

      For more information, see Assigning Roles to an Employee and step 6 under the Access section in Creating a Vendor Record.

  5. Create access tokens for each vendor or employee that you authorized as web service sender.

    1. Go to Setup > Users/Roles > User Management > Access Tokens > New.

    2. In the Application Name field, select the integration record that you created in step 2, which will be associated with the access token you will create.

    3. In the User field, select the vendor or employee whom you assigned the Inbound e-Document Web Service Role.

    4. In the Role field, select Inbound e-Document Web Service Role. The Token Name is automatically assigned a value.

    5. Click Save.

      The Token ID and Token Secret are generated and displayed on the Access Token page. Copy the values for the Token ID and Token Secret before going to another page.

      Important:

      For security reasons, the values for the Token ID and Token Secret are only displayed on the initial setup page. They cannot be retrieved from the system. If you did not take note or copied the Token ID and Token Secret values, you will need to create a new token.

      For more information, see Getting Started with Token-based Authentication.

  6. Send or convey the following web service connection and authentication details to authorized web service senders:

    • Consumer Key

    • Consumer Secret

    • Token ID

    • Token Secret

    • Account ID

      Go to Setup > Company Information. In the Account ID field, obtain the value that you need to send.

    • Inbound E-Document Web Service RESTlet External URL

      Go to Customization > Scripting > Scripts. View the Inbound E-Document Web Service RL, RESTlet. On the Deployments subtab, click Inbound E-Document Web Service RL. The External URL is displayed.

    • The vendor or customer Web Service ID.

After setting up SOAP web services for inbound processing, you are ready to receive XML e-documents from SOAP web services. For more information, see Receiving E-Document XML Files from Web Service.

Web Service Sender Setup Tasks

The authorized web service sender can either be a vendor or an employee. Web service senders must also perform setup tasks before they can send e-document files through web service.

First, a web service sender must obtain the web service connection and authentication details from you. Then, they must meet the following requirements in constructing the web service request.

Requirements

Web Service Details

OAuth 1.0 Authentication

Use the authentication details from the NetSuite user:

  • Consumer Key

  • Consumer Secret

  • Token ID

  • Token Secret

  • Realm (Account ID)

OAuth Data

Content-type header

Application/json

Request Method

POST

Web Service Request Body

JSON Object

Sample code for sending a single XML file with transaction type as Bill in one request:

                    {
    "identifier": "vendor1",
    "fileName": "vendor1.xml",
    "content":  "<XML>content</XML>"
    "tranType": "Bill"
} 

                  

Sample code for sending a single XML file with transaction type as BillCredit in one request:

                    {
    "identifier": "vendor1",
    "fileName": "vendor1.xml",
    "content":  "<XML>content</XML>"
    "tranType": "BillCredit"
} 

                  

Sample code for sending a single XML file with transaction type as SalesOrder in one request:

                    {
    "identifier": "customer1",
    "fileName": "purchase_order.xml",
    "content":  "<XML>content</XML>"
    "tranType": "SalesOrder"
} 

                  

If multiple XML files must be sent in one web service request, the format must be an of JSON objects.

Sample code for sending multiple XML files in one request:

                    [{
    "identifier": "vendor1",
    "fileName": "vendor1-1.xml",
    "content": "<XML>content</XML>"
},
{
    "identifier": "vendor1",
    "fileName": "vendor1-2.xml",
    "content": "<XML>content</XML>"
},
{
    "identifier": "vendor2",
    "fileName": "vendor2.xml",
    "content": "<XML>content</XML>"
},
{
    "identifier": "customer1",
    "fileName": "purchase_order.xml",
    "content": "<XML>content</XML>",
    "tranType": "SalesOrder"
}] 

                  
Note:

If tranType parameter is not included, it will create an inbound e-document with transaction type as Bill. This param is case sensitive, and accepts either Bill, BillCredit, or Sales Order.

Important:

There is a limit of 10MB per string used as RESTlet input or output. For more information, see RESTlet Governance and Security.

Related Topics

General Notices