Creating a SOAP Web Services PHP Project
For each project you need to perform the following steps:
-
Copy the PHPToolkit directory to the directory in your IDE where your project resides.
-
Edit the NSconfig.php file, substituting your own account details.
-
If SOAP logging is required, create a folder called nslog inside the PHPToolkit folder. See Logging SOAP Requests and Responses Using the PHP Toolkit for more details.
-
Each solution needs to include the NetSuiteService.php file by adding the following line to the main source file:
require_once '../PHPToolkit/NetSuiteService.php';
This step will prompt most IDEs to parse the NetSuiteService.php file for auto completion information.
-
Instantiate a service:
$service = new NetSuiteService();
Each time you upgrade your NetSuite endpoint, for example from WSDL version 2023.2 to 2024.2, you will also need upgrade the NetSuiteService.php class library to take advantage of any new features.
In 2016.1, token-based authentication support was added to the PHPToolkit.
The following guidelines should be followed when using token-based authentication with PHPToolkit:
-
Each request requires a unique TokenPassport
-
NetSuite does not generate TokenPassports. You must provide your own implementation of iTokenPassportGenerator
-
You configure NetSuite to use your iTokenPassportGenerator by calling the setTokenGenerator:
$generator = new MyTokenPassportGenerator(); $service->setTokenGenerator($generator);
For more information about token-based authentication, see Token-based Authentication (TBA).