<dependency>
<groupId>com.mulesoft.connectors</groupId>
<artifactId>mule-netsuite-openair-connector</artifactId>
<version>RELEASE</version>
<classifier>mule-plugin</classifier>
</dependency>
NetSuite OpenAir Connector - Mule 4
Support Category: Select
NetSuite OpenAir Connector v2.0
Anypoint Connector for NetSuite OpenAir (NetSuite OpenAir Connector) is a closed-source enterprise connector that provides a connection between OpenAir and third-party software.
Release Notes: NetSuite OpenAir Connector Release Notes
Exchange: NetSuite OpenAir Connector
Prerequisites
To use this information, you must be familiar with NetSuite OpenAir, Mule runtime engine (Mule), Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and Global Elements.
To use this connector, you need:
-
A NetSuite OpenAir instance
-
A set of valid credentials, including username, password, companyID, API namespace, and key.
-
A MuleSoft Enterprise License
OpenAir complex types are limited to a set of OpenAir operations.
See the OpenAir documentation for information about its object types. For example, object oaActualCost
works with read
, add
, modify
, and upsert
methods, while object oaApproval
works only with the submit
method.
POM File Information
Mule converts RELEASE to the latest version. To specify a version, view NetSuite OpenAir Connector in Anypoint Exchange and click Dependency Snippets.
Connect in Flow Designer
Flow Designer provides input sources (known as triggers) for:
-
On New Object - Start your application when a NetSuite user creates an object.
-
On Modified Object - Start your application when a NetSuite user modifies an object.
-
On Deleted Object - Start your application when a NetSuite user deletes an object.
-
HTTP Listener - Start your application from a browser, curl, or Postman.
-
Scheduler - Start your application at selected time intervals.
To configure your Flow Designer app:
-
Configure a trigger.
-
Select the plus sign next to the trigger to add a component.
-
Select the connector as a component.
-
Select the operation:
-
Configure the Global Element for the connector:
Field Description Company
Enter the company.
Username
Enter the user name to connect to.
Password
Enter the password for the user.
API Namespace
Enter the API namespace.
Api Key
Enter the API key.
-
Optionally configure the connection options for the connector:
Field Description Endpoint
Enter the endpoint.
Connection Timeout
Enter the connection timeout.
Read Timeout
Enter the read timeout.
Add the Connector to Your Project
Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette view.
Add the Connector Using Exchange
-
In Studio, create a Mule project.
-
Click the Exchange icon (X) in the upper-left of the Studio task bar.
-
In Exchange, click Login and supply your Anypoint Platform username and password.
-
In Exchange, search for "openair".
-
Select the connector and click Add to project.
-
Follow the prompts to install the connector.
Configure in Studio
-
Drag the connector operation to the Studio Canvas (they are the same as are in Design Center).
-
Configure the Global Element for the connector:
-
If needed, configure a connection:
-
Enable the automatic reconnection feature.
-
Access the OpenAir Global Element configuration window from Studio.
-
Click the Advanced tab (next to Connection).
-
Select the Standard option in Reconnection Strategy.
-
Adjust the Frequency (ms) and Reconnection Attempts fields accordingly.
-
Log HTTP Requests and Responses
To log the HTTP interactions of the connector with NetSuite OpenAir, configure the log4j2.xml file for the Mule app as follows, and use a Logger component in your project to display the results:
<AsyncLogger name="org.mule.service.http" level="DEBUG"/>
Access the Read Operation Metadata
To access the metadata of the Read operation in version 2.0.6 or later, you must transform the message to JSON:
<ee:transform doc:name="Transform Message" doc:id="f1a6393e-38a4-497f-a9cd-ad161971073a" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
</ee:message>
</ee:transform>
<ee:transform doc:name="Transform Message" doc:id="f1a6393e-38a4-497f-a9cd-ad161971073a" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload.ArrayOfReadResult.readResult.objects.oaBase]]></ee:set-payload>
</ee:message>
</ee:transform>
Once you transform the message, you can access the results to see metadata like that shown in this example:
<?xml version="1.0" encoding="UTF-8"?> <ns0:ArrayOfReadResult xmlns:ns0="http://namespaces.soaplite.com/perl"> <readResult> <objects> <oaBase> <oaCustomer> <invoice_layoutid>0</invoice_layoutid> <picklist_label>Altima Technology</picklist_label> <bus_typeid>0</bus_typeid> <rate>0.00</rate> <updated>2015-06-08 18:03:51</updated> <id>1</id> <filterset_ids>4</filterset_ids> <code /> <tb_approver>0</tb_approver> <sold_to_contactid>0</sold_to_contactid> <active>1</active> <name>Altima Technology</name> <territoryid>0</territoryid> ... <return_fields> <item> <key>addr_mobile</key> <value>1</value> </item> <item> <key>addr_contact_id</key> <value>1</value> </item> </return_fields> </oaCustomer> <oaCustomer> ... </oaCustomer> </oaBase> </objects> </readResult> </>
Use Case: Add OpenAir Object

-
In Studio, drag an HTTP Listener operation onto the canvas and configure it to listen to host
0.0.0.0
at port8081
. -
Drag the OpenAir Add operation connector into the flow and configure the connector as described in Configure in Studio.
-
Drag a Transform Message component between the HTTP connector and the OpenAir connector.
-
In the Transform Message component, insert the DataWeave script into the DataWeave editor to add oaCustomer objects to your NetSuite OpenAir instance:
%dw 2.0 output application/xml ns ns0 http://namespaces.soaplite.com/perl --- { ArrayOfoaBase: { oaBase: { ns0#oaCustomer: { name: "James Bond", company: "MuleSoft" }, ns0#oaCustomer: { name: "Jane Doe", company: "Salesforce" } } } }
-
Drag another Transform Message component after the OpenAir connector, and insert the DataWeave script into the Transform Message component’s DataWeave editor.
The script should return the IDs of the newly added OpenAir objects.
%dw 2.0 output application/json ns ns0 http://namespaces.soaplite.com/perl --- { customerName_1: payload.ns0#ArrayOfUpdateResult.*updateResult[0].id, customerName_2: payload.ns0#ArrayOfUpdateResult.*updateResult[1].id }
-
Save the project.
-
In Package Explorer, right-click the project and click Run As > Mule Application.
-
Use a browser to access
http://0.0.0.0:8081
, and the following JSON displays:{ "customerName_1": "411", "customerName_2": "412" }
Use Case: XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:openair="http://www.mulesoft.org/schema/mule/openair"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http
http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/openair
http://www.mulesoft.org/schema/mule/openair/current/mule-openair.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<openair:config name="Open_Air_Config" doc:name="Open Air Config">
<openair:login-authentication-connection
company="${config.company}"
username="${config.username}"
password="${config.company}"
apiNamespace="${config.namespace}"
apiKey="${config.key}"
endpoint="${config.endpoint}"
connectionTimeout="${config.conTimeout}"
readTimeout="${config.readTimeout}" />
</openair:config>
<flow name="testopenairFlow">
<http:listener doc:name="Listener" config-ref="HTTP_Listener_config" path="/" />
<ee:transform doc:name="Transform Message">
<ee:message>
<ee:set-payload>
<![CDATA[
%dw 2.0
output application/xml
ns ns0 http://namespaces.soaplite.com/perl
---
{
ArrayOfoaBase: {
oaBase: {
ns0#oaCustomer: {
name: "James Bond",
company: "MuleSoft"
},
ns0#oaCustomer: {
name: "Jane Doe",
company: "Salesforce"
}
}
}
}
]]>
</ee:set-payload>
</ee:message>
</ee:transform>
<openair:add doc:name="Add" config-ref="Open_Air_Config" oaObject="jasdhjasdhik" />
<ee:transform doc:name="Transform Message">
<ee:message>
<ee:set-payload>
<![CDATA[
%dw 2.0
output application/json
ns ns0 http://namespaces.soaplite.com/perl
---
{
customerName_1: payload.ns0#ArrayOfUpdateResult.*updateResult[0].id,
customerName_2: payload.ns0#ArrayOfUpdateResult.*updateResult[1].id
}
]]>
</ee:set-payload>
</ee:message>
</ee:transform>
</flow>
</mule>