• : 1-877-596-8218
  • : sales@aecc.ca
# # #

NS SuiteTalk Part 3 – Setup Login to NS Using Web Service.

After setting the SOAP header and necessary initializations, the next step is to login to NetSuite.

Here we are demonstrating the session level login using credentials. One can also put the user credentials inside the header of each SOAP request. This way there is no need to invoke session management and login operation.

We need to create a passport and put the following variables into this object

1) Login email address
2) Login password
3) Internal ID of role in NS
4) NetSuite account ID

To find the NetSuite Account ID, one can type:


In the console to find the account ID and even the current role login to the NetSuite
The following codes demonstrate how to login to netSuite

//Populate passport object with all login information
Passport passport = new Passport();
RecordRef role = new RecordRef();

//Get login information from config
//login to NetSuite
Status status = port.login(passport).getStatus();

You can check the login status from the status variable.
After codes finish executing, don’t forget to logout from NetSuite, this can be done by simply on line of code:

Status status = port.logout().getStatus();