Reading Time: 8 minutes

Can MuleSoft connect ________ (insert name of any system) to ________? Regardless of how you’ve filled in the blanks, anyone from MuleSoft will answer with an enthusiastic, ‘Yes, we can!’

To enable this universal connectivity, along with increasing the breadth and the quality of our out-of-the-box connectors, we are continuing to invest in expanding the usability and feature set of our connectivity tooling, including our: HTTP Connector, Web Service Consumer, and our SDK, Anypoint Connector DevKit.

latest report
Learn why we are the Leaders in API management and iPaaS

DevKit, as many users have noticed, went through a tremendous facelift in the past year. Along with new features such as real-time error highlighting and and code templates that make the development process more intuitive, we’ve also added other features such as support for external libraries and the ability to generate functional and interop test cases.

To add to this list, we are thrilled to introduce a new DevKit feature called SOAP Connect, which will be included in our Mule 3.7 release.

What is SOAP Connect?

SOAP Connect is a feature within DevKit that allows users to quickly package multiple WSDL files or fetch them dynamically into a single reusable connector with minimal coding. Not only does this simplify the building process, but the dynamic fetching of APIs dramatically simplifies the process of updating API versions as well. On top of this, connectors created using SOAP Connect also support DataSense, which allows you to dynamically pick and choose your connector operations while the connector is being consumed.

As with any other connector built using DevKit, the connector can be installed in Anypoint Studio and used (and reused) in different Mule applications.

Web Service Consumer vs. SOAP Connect

Web Service Consumer is a pre-installed connector within Anypoint Studio that you can use to quickly consume an API using the information contained in a service’s WSDL. You simply need to identify the location of the WSDL file, then ask the Web Service Consumer to configure itself from the WSDL – the host, the port, and the address.

When considering your options, if you have all the configuration details for the WSDL and only need to consume a few services, we recommend using the Web Service Consumer. It’ll be the quickest and simplest option for connecting.

However, if you need to connect to multiple APIs (we know some applications have thousands of WSDLs) and want to use them repeatedly in a consistent manner, we would recommend SOAP Connect. While the Web Service Consumer will enable connectivity, SOAP Connect will build a connector which allows you to scale and reuse in a consistent manner across the organization.

Using SOAP Connect

To use SOAP Connect, you need to have Anypoint Studio 5.2 with the latest Anypoint DevKit plugin, which will be available early July.

For this post we are going to use the Cookbook API, an example provided on the DevKit tutorial page, to demonstrate how to connect to a SOAP API.

  1. First, let’s create a new Anypoint Connector Project by right clicking in the Package Explorer.
  2. Select the SOAP Connect option.
soap2
  1. Choose a name for the connector and add the WSDL file(s). For this example, we are going to pick Cookbook as the connector name, and add a WSDL file from the tutorial.
soap3
  1. Choose an icon (or use the default icon) for your connector, then hit finish.

soap4
Let’s take a look at the code generated under org.mule.modules.cookbook.config.ConnectorConfig:

Note that the method annotated with @WsdlServiceRetriever (#18) returns a single ServiceDefinition object providing DevKit with the following information:

  • the place where the WSDL file is (in this case, it is remote, but it could be local /src/main/resources)
  • the service
  • the port

All of the above are auto-populated by the wizard, which took the job of introspecting the WSDL file under https://docs.mulesoft.com. Additionally, the code generated will also allow users to change the endpoint by feeding a different value under the @Configurable (#18) address field.

  1. Install the connector in Anypoint Studio and use it in a Mule app

soap5We have now developed a connector from scratch that is installed and ready to used in any Mule application!

  1. To put the connector to use, create a flow with the Cookbook connector surrounded by two HTTP Connectors.

soap6Click on the Cookbook connector to configure it. To configure the connector, click on the green “+” sign next to “Connector Configuration”.

soap7We will continue to use the same address for this example, but you can change it should you want for your use case. Click “OK” when done.

soap8Simple and ready to use in just 6 steps!

To try the feature for yourself, make sure you download Mule 3.7 (Anypoint Studio 5.2) and the DevKit plugin early July. For a detailed walkthrough of this feature, register now for our demo on July 8th at 10am PT/ 1pm ET.