Follow Us On social
5717 Legacy Dr, Ste 250, Plano TX 75024 +1 (469) 606-9656
Externalizing DWL files in Mulesoft Dataweave Expression Language

Externalizing DWL files in Mulesoft

The Transform Message component in Mulesoft deals with Dataweave Expression Language. This means there is a high chance where there is a situation that dataweave scripts to be used multiple times.  Externalizing DWL files in Mulesoft is an additional feature to re-use the Dataweave scripts specifically. It can also make it easier to maintain all the DWL scripts used in the current project in one place in case of any errors.

In layman’s terms, we refer to the file which has the Dataweave mappings or scripts in our application. Here are the series of steps that are to be followed to get this in our project.

Before you get started with the actual steps, make sure you have the DWL file saved in your local directory. It is recommended to have a folder just dedicated to .dwl files for easier access to files. For example, please refer to the picture below.

Step 1: Drag a Transform Message and drop it on the canvas

Step 2: Click on the pencil icon 🖊️ you see in the transform message properties view. It’ll appear in the left corner of the properties tab once you select the component.

Once you click, you’ll get a pop-up dialog window. In the dialog box, by default, the source code is selected to Inline. Change the source code to the File option.

It enables the filename section to refer to the respective .dwl file to be used once you select the File option. If you have the destination file path you can directly paste the path. Or you can click 3 dots which open a file explorer to point to your file.

This is how the Configuration XML looks when you refer to a file.

<ee:transform doc:name=”Transform Message” doc:id=”d9ae3b62-4ef9-4e39-b4fa-c1584″ >

<ee:message >

<ee:set-payload resource=”dwl/upsertCustomer.dwl” />



Step 3: Almost done. To make sure you’re referring to correct mappings, once you select the DWL file and save the application, the mappings will be auto-populated concerning the file. 

And lastly, please note that once you make any changes to the mappings (DWL file), it reflects all the transformations. Be careful before making the changes. It is best practice to have all the mappings externalized as DWL files, ensuring there is no code duplication.

Does your business need a platform to connect data, applications and devices across on-premises and cloud computing environments? MuleSoft might be the right fit for you! Connect with our integration experts to set up a MuleSoft demo today.

Post a Comment