Author: Aman Kumar & Harshal Borade
Introduction
NetSuite is a cloud-based business management software that allows companies to manage all critical business processes with a single tool. It is one of the world’s finest SaaS-based ERPs available in the industry. NetSuite is used by enterprises for ERP, Inventory management, HRMS, CRM, PSA, hosting and managing e-commerce stores, retail and management solutions, and more.
MuleSoft NetSuite connector utilizes SuiteTalk which is a SOAP-based web services integration tool for integrating different systems with NetSuite.
MuleSoft has released a new version of Anypoint Connector for NetSuite (v11). There are significant upgrades in the latest version compared to v10, and while migrating from v10 to V11 one has to make substantial changes to their Mule application.
Upgrades in This Release
The NetSuite Connector v10.x used to resolve the metadata by receiving Java objects as input and internally converting those objects to XML so that the NetSuite could understand them. In NetSuite Connector v11.x, XML metadata is resolved without the need of any internal transformation, that is all requests/responses from the connector will be in XML which would map directly to the NetSuite WSDL.
Because of this change, the input and output response for the connector operations has changed and is now the same as the request and response bodies of the corresponding SOAP API operations.
The v11.x uses 2020.2 SuitTalk API whose WSDL can be downloaded from here https://www.netsuite.com/portal/developers/resources/suitetalk-documentation.shtml. The NetSuite version may not be the same as the SuiteTalk API version. NetSuite account can run on a Netsuite version that differs from the version of the API being used.
NetSuite Connector (v11) comes with the following features and capabilities :
- SOAP-based integration
- Generation of NetSuite business objects
- Different authentication levels
- Error-handling support
Connecting NetSuite With MuleSoft
NetSuite connector(v10) provided two ways of Authentication to connect NetSuite
- Request-based authentication.
- Token authentication.
Either of them could be used to connect a mule project with NetSuite in v10 but in v11 we have only one type of authentication.
Configuration upgrades in NetSuite v11
NetSuite connector(v11) provides only Token Based authentication. There is a new field “SOAP port” in the configuration settings. The parameter defines the version of the WSDL used. The port must be the same as the one used in the Namespaces.
Separate SOAP & REST interface connector
NetSuite connector v10 was able to work with the SOAP interface as well as with NetSuite’s REST-based endpoints using REST calls to RESTlets that expose APIs created with SuiteScript. The new Netsuite Connector v11 only exposes SOAP endpoints and for the REST endpoints, MuleSoft provides a separate connector (NetSuite Restlet Connector).
Upgrades in Record Operations
There are several changes in the record operations in NetSuite connector v11 some of which are mentioned below
Renamed Operations
Add File – Add
Attach Record- Attach.
Detach Record- Detach
Upsert Record- Upsert
Operations Removed and their replacement
Add Record- Add –
Update Records List -Update List
Get Custom Record- Get
Delete Record- Delete
Delete Records List – Delete List
Getting SOAP request for NetSuite connector v11 using existing v10 based mule project
The major upgrade in the new version is the change in requests and responses to be sent to the NetSuite connector. For migrating a mule project from v10 to v11, one has to form new XML requests which could be an uphill struggle. To start with migration one can troubleshoot his existing v10 mule application to get the XML request.
For this, Debug logs have to be enabled on the Anypoint platform where the v10 mule application is deployed.
Go to the Runtime manager –> application –> settings –> Logging
Enable the following log at debug level
- org.mule.service.http.impl.service.HttpMessageLogger
Or we can enable the debug logs in the Anypoint Studio by adding this line in the log4j2 file.
<AsyncLogger name=”org.mule.service.http.impl.service.HttpMessageLogger” level=”DEBUG” />
Once the application is up and running, these logs will show the XML soap request which is internally converted by NetSuite connector, for example, this is a SOAP request for Upsert operation in Contacts.
The body shown in this can be used to form the new SOAP request along with DataSense explorer in Studio to drag and drop the metadata fields, which generates their corresponding namespaces and tags automatically.
We will see how to form XML requests and fetch data from NetSuite connector v11 in our next article.