Author: Aman Kumar & Harshal Borade
In our previous article, we have discussed various upgrades in Mulesoft NetSuite connector v11. In this article, we will see how to make XML SOAP requests for v11 connectors and various operations available NetSuite connector v11.
Before going forward one has to confirm two things :
- In the pom.xml file of the Mule project, check that the NetSuite Connector dependency version is 11. X.x.
- Test connection with NetSuite is successful.
GET – This operation is used to retrieve a particular record by providing the internal ID that uniquely identifies a record in NetSuite.
Internal ID – It’s a unique ID assigned to each record by NetSuite.
External ID – Unique ID assigned to each record by the external system like Salesforce.
Use case 1: Getting a customer record from NetSuite
- Drag an HTTP listener and set its port and path
- A transform message for the XML request
- Get operation from NetSuite palette
- Transform Message to convert XML response to JSON
- Request and response loggers to capture logs
Select the connector configuration, Ref type has to be set as “RecordRef” and type equals to “customer”
To get the expected SOAP request we can make use of debug logs of the v10 mule application.
One will get similar logs for a customer to get a request in NetSuite connector v10. These logs will help to specify the correct namespace and type.
The XML request to get a customer record
1) Both 2020_1 and 2020_2 in the namespace will work, make sure that the port passed in namespaces should be the same as the SOAP port in NetSuite Config.
2) Namespaces are automatically generated using DataSense Explorer, but one might need to add some namespaces which are used in SOAP requests (Debug logs can be referred to get them).
One can test the customer details by hitting the HTTP endpoint.
Use case 2: Getting invoice and cash sale from NetSuite
In this use will get cash sale & invoice from NetSuite and combine them using scatter-gather to obtain cumulative data and finally store them in a file.
Getting the invoice from NetSuite
Ref type is “RecordRef” and Type “invoice”
Getting cash sale from NetSuite
Ref type is “RecordRef”and Type “cashSale”
Merging the response and storing it in a single file
The above two sub-flows will return us an invoice and cash sale, now we have to merge the data sent by them and store it in a file.
We have used scatter-gather to call both the flows and then convert the XML response to JSON.
The collective response is stored in a text file in our local system.