Contact Us 1-800-596-4880

Testing Connections

This functionality enables you to test connections to external resources. As you model your application in Studio, you have the opportunity, when configuring connectors, to test the functionality of its connection to a Web service.

Prerequisites

This document assumes that you are familiar with the Visual Editor in Anypoint Studio, as well as the Anypoint Connectors and DataWeave Transformer that you can use to create applications in Studio. Further, this document references Connectors and Global Elements. Review DataSense to learn more about the overall DataSense functionality.

Testing a Connection to an External Resource

As you model flows in a Mule application, you are likely to use a connector to communicate with an external resource, such as a SaaS provider. As you configure a connector with all the details that enable it to connect with a resource – username, password, URL – you might ask yourself: have I configured everything I need to be able to connect successfully?

Rather than wait until you run the application to find out if a connection is functional, Anypoint Studio allows you to test the connection as soon as you have built it to confirm communication. Thus, you can cross one potential runtime bug off the list by testing the connection early, as you model your flow.

When creating a new connector, you can configure all connection values, then – before you even hit save – you can conduct a one-click test to make sure that your connector is successfully communicating with the resource.

  1. In the Global Elements tab, click Create New.

    A window with a button labeled Create, Edit, and Delete
  1. Configure your connector with all the required connection values, most importantly username and password. Because you’re testing a connection, so you must enter all the required details to access the resource.

  2. Click Validate Configuration

    A form for Salesforce Basic Authentication settings
    A cloud with the Salesforce logo is connected to another cloud with the Salesforce logo, with a
  3. Studio calls the resource and attempts to connect.

    If successful, Studio displays a message to indicate success. If unsuccessful, Studio displays an error which describes the connection issue.

  4. At this point, during creation of the connector, you have the ability to adjust the connector’s configuration and test as often as needed until you can confirm a successful connection. When satisfied with the connection, click OK to save.

If you are disinclined or unable to resolve any connection issue immediately, you can uncheck the Enable DataSense box, then click OK to simply save the connector configurations. With DataSense disabled, Mule does not test the connection or retrieve metadata when you click OK.

Testing Existing Connections

If you have already created connectors, those which support connection testing (see table above) appear in a the the Connections tab of the Outline pane in Studio (see image below).

Where is my Connections tab?

If you cannot see the Connections tab in Studio, it may be hidden or closed.

  1. Check the bottom lefthand corner of your Studio window for a small, blue globe icon with a wrench (see image below). Click this icon to display the Connections tab.

    A software interface showing a Connections button, a workflow diagram, and an HTTP connector configuration
  2. If no globe icon is present, in the top nav bar click WindowShow ViewOther

  3. In the Show View panel that appears, click to expand the MuleSoft folder, then select Connections Explorer.

  4. Click OK to open the Connections tab.

    A Connections Explorer window with a search bar, a list of connections, and a title bar
    • The Current view in the Connections tab displays all the connectors in the .mflow file within which you are working. in other words, this view only displays the connectors in your active project.

    • The All view displays all your Studio projects and enables you to expand each project file to view the connectors within each. Essentially, you can access all the connectors (which support connection testing) within all your Mule projects.

      A screenshot showing an empty configuration element in Anypoint Studio
  5. Double-click a connector in the Connections tab to open the Properties panel.

  6. Click Validate Configuration

  7. Studio calls the resource and attempts to connect. If successful, Studio displays a message to indicate success. If unsuccessful, Studio displays an error which describes the connection issue.

  8. If unsuccessful, adjust the connector’s configuration and test as often as needed until you can confirm a successful connection. When satisfied with the connection, click OK to save.

Set a Connection Time-out

By editing the Anypoint Studio Preferences, you can set a connection timeout value for DataSense so that, in case the connection fails to respond for long enough, Mule stops trying.

  1. Navigate to Preferences > Anypoint Studio > DataSense

  2. Set the parameter DataSense Connection Timeout to the value in seconds that you prefer.

    A settings window for DataSense preferences, with a connection timeout of 60 seconds

Testing New Connections

Limitations

  • Be aware of call limits. Some SaaS providers place a limit on the number of calls you can make to a service. Each time you test a connection, you are using up one call to the service. Avoid excessive connection testing so as not to approach your service call limits.

  • Connection testing functionality is only available in Studio’s Visual Editor.

See Also