Contact Free trial Login

NetSuite OpenAir Connector

Select

The NetSuite OpenAir connector is a closed source enterprise connector which provides a connection between OpenAir and third-party software.

Prerequisites

This document assumes that you are familiar with 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

We recommend you use the NetSuite OpenAir SOAP API Guide (PDF) as you familiarize yourself with the connector.

OpenAir complex types are limited to a set of OpenAir operations. See the OpenAir guide to see the object types. You can see, for example, that object oaActualCost works with "read", "add", "modify", and "upsert" methods, while object oaApproval only works with the "submit" method.

What’s New in this Connector

Support for Mule 4 has been added.

Compatibility

The OpenAir connector is compatible with:

Application/Service Version

Mule Runtime

EE 4.1.0 and later

Anypoint Studio

7.1 and later

Java

JDK 8

To Connect in Design Center

  1. Click a trigger such as HTTP Listener or Scheduler.

  2. To create an HTTP global element for the connector, first set the path where your mule application listens:

    Path
  3. Click Edit and set these fields:

    Trigger options
    Field Description

    Protocol

    Protocol selected for the HTTP endpoint, it can be HTTP or HTTPS (secure).

    Host

    IP address where your Mule application listens for requests.

    Port

    Port address where your Mule application listens for requests.

    Base Path

    An optional base path, the Mule application listens to the base path + path.

  4. Select the plus sign next to the trigger to add a component.

  5. Select the connector as a component.

  6. Select the operation:

    operations
  7. Configure the global element for the connector:

    account config
    Field Description

    Company

    Enter the company.

    Username

    Enter the username who is going to connect.

    Password

    Enter the password for the user previously chosen.

    API Namespace

    Enter the API namespace.

    Api Key

    Enter the API key.

  8. Optionally configure the connection options for the connector:

    connector config
    Field Description

    Endpoint

    Enter the endpoint.

    Connection Timeout

    Enter the connection timeout.

    Read Timeout

    Enter the read timeout.

Connect in Anypoint Studio 7

You can use this connector in Anypoint Studio by adding it as a dependency in your Mule application.

Install Connector in Studio

  1. In Anypoint Studio, click the Exchange icon in the Studio task bar.

  2. Click Login in Anypoint Exchange.

  3. Search for the connector and click Install.

  4. Follow the prompts to install the connector.

When Studio has an update, a message displays in the lower right corner, which you can click to install the update. After updating, update Maven pom.xml file dependencies to the new version.

Ensure your Maven dependency is set:

  1. Open your Mule project in Anypoint Studio.

  2. Add the connector as a dependency in the pom.xml file:

    <dependency>
      <groupId>com.mulesoft.connectors</groupId>
      <artifactId>mule-netsuite-openair-connector</artifactId>
      <version>2.0.0</version>
    </dependency>

Configure in Studio

  1. Drag and drop the connector operation to the Studio Canvas (they are the same as are in Design Center).

  2. Configure the global element for the connector (just like in Design Center):

    anypoint config
  3. Optionally, configure a connection:

    anypoint connection

    To enable the automatic reconnection feature:

    1. Access the OpenAir Global Element configuration window from Studio.

    2. Click the "Advanced" (next to Connection) tab.

    3. Select the "Standard" option in Reconnection Strategy.

    4. Adjust the "Frequency (ms)" and "Reconnection Attempts" fields accordingly.

Use Case: Add OpenAir Object

OpenAir use case flow
  1. Create a new Mule Application in Studio and select an HTTP Listener as a Source in the new flow.

  2. Drag and drop an HTTP Listener onto the canvas and configure it to listen at Port 8081.

  3. Drag and drop the OpenAir Add Operation connector into the flow and configure the connector as described above.

  4. Drag and drop a Transform Message component between the HTTP connector and the OpenAir connector.

  5. Inside the Transform Message insert the DataWeave script below into the DataWeave editor. The script adds both oaCustomer objects to your NetSuite OpenAir instance.

    %dw 2.0
    output application/xml
    ns ns0 http://namespaces.soaplite.com/perl
    ---
    {
      ns0#ArrayOfoaBase: {
        oaBase: {
          oaCustomer: {
            name: "James Bond",
                  company: "MuleSoft"
          },
          oaCustomer: {
            name: "John Doe",
            company: "Pepsi"
          }
        }
      }
    }
  6. Drag and drop another Transform Message component after the OpenAir connector, and insert the DataWeave script below 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
    ---
    {
      ID1: payload.ns0#ArrayOfUpdateResult.*updateResult[0].id,
      ID2: payload.ns0#ArrayOfUpdateResult.*updateResult[1].id
    }
  7. Save and run the project as a Mule Application by right-clicking the project name in the Package Explorer, selecting Run As > Mule Application.

  8. After hitting the HTTP endpoint you configured, your browser should display the following JSON:

    {
        "ID1": "411",
        "ID2": "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="localhost" 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  --- { ns0#ArrayOfoaBase: { oaBase: { oaCustomer: { name: "James Bond", company: "MuleSoft" }, oaCustomer: { name: "John Doe", company: "Pepsi" } } } }]]></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 --- { ID1: payload.ns0#ArrayOfUpdateResult.*updateResult[0].id, ID2: payload.ns0#ArrayOfUpdateResult.*updateResult[1].id }]]></ee:set-payload>
         </ee:message>
      </ee:transform>
   </flow>
</mule>

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub