---
title: "Mulesoft XML policy"
slug: "mulesoft-xml-policy"
updated: 2025-01-21T06:23:58Z
published: 2025-01-21T06:23:58Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://traceabledocs.document360.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Mulesoft XML policy

Mulesoft is an integration platform that helps businesses connect their data, devices, and applications for cloud computing and on-premise deployments. Mulesoft's Anypoint Platform™ is a solution for API-led connectivity that creates an application network of apps, data, and devices for both on-premise and cloud deployments. Traceable provides a policy that can help you in protecting your APIs. You can attach the Traceable policy to any API registered on the Anypoint platform for security and monitoring purposes.

The following diagram shows the high-level deployment of Traceable policy in your environment.

![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_deployment.jpg)

> **Note** If you wish to deploy Traceable’s blocking policy, see the [Mulesoft XML blocking policy](/docs/mulesoft) topic.

---

## Before you begin

Before proceeding to attach the Traceable policy to an API on your Mulesoft Anypoint Platform, make a note of the following points:

- Maven ( `mvn`) must be installed.
- You should have access and permission to upload artifacts to Mulesoft Exchange in your organization's Mulesoft Anypoint Platform account.

Note

To upload Traceable's custom policy to Mulesoft Exchange, you must have the exchange contributor's role assigned to you. For more information, see [Uploading a Custom Policy to Exchange](https://docs.mulesoft.com/policies/policies-custom-upload-to-exchange).
- Keep the IP address of your Traceable agent handy. You would need this IP address to configure Traceable's Mulesoft policy.

The process to attach Traceable's policy consists of two steps:

1. Download the policy from Traceable's download site and then upload it to Mulesoft's Exchange
2. Attaching the policy to the API in Mulesoft.

---

## **Step 1 – Download the policy and upload it to Mulesoft Exchange**

Complete the following steps to download and unzip Traceable's policy:

1. Navigate to Traceable's [download site](http://downloads.traceable.ai/) and then navigate to agent > mulesoft > latest.
2. Download and unzip the downloaded file.
3. Change the directory to the Mulesoft policy directory:

```actionscript
cd traceable-mule-policy
```
4. Navigate to Traceable policy:

```actionscript
cd traceable
```
5. Edit the `pom.xml&nbsp;`file to update your Mulesoft's organization ID:

```actionscript
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

<!--UPDATE GROUP ID-->
    <groupId>4c2d42c8-910d-42fe-8f21-bc76f21ef3fe</groupId>
    <artifactId>traceable</artifactId>
    <version>1.14.0</version>
```

### Policy deployment options

You have two options to deploy the Traceable policy. You can either use `mvn` or `curl` command to deploy the policy.

Note:

If you are using a Windows machine to deploy the policy, use the `mvn` option only.

#### **Option 1 - Deploy using mvn**

Make a note of the following before proceeding with this option. For more information on mvn install, see Mulesoft documentation, [Uploading a Custom Policy to Exchange](https://docs.mulesoft.com/mule-gateway/policies-custom-upload-to-exchange).

- **Traceable's Mulesoft agent earlier than 1.21.0** - If you are using Traceable's Mulesoft agent earlier than 1.21.0, then in your Maven installation directory, update the `settings.xml&nbsp;`file with your Exchange credentials.

ActionScript

```actionscript
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
       <id>exchange-server</id>
       <username>myusername</username>
       <password>mypassword</password>
     </server>
  </servers>
</settings>
```

`myusername` and `mypassword` are your username and password to log in to your Mulesoft account.
- **Traceable's Mulesoft agent 1.21.0 and later** - If you are using Traceable's Mulesoft agent 1.21.0 or later, then in your Maven installation directory, update the `settings.xml&nbsp;`file with your Exchange credentials.

ActionScript

```actionscript
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
       <id>anypoint-exchange-v3</id>
       <username>myusername</username>
       <password>mypassword</password>
     </server>
  </servers>
</settings>
```

`myusername` and `mypassword` are your username and password to log in to Mulesoft account.

Deploy the Traceable policy. Enter the following command:

```actionscript
mvn clean deploy
```

Verify in your Mulesoft Anypoint Platform Exchange whether a Traceable policy is present or not.

#### **Option 2 - Deploy using the curl command**

To deploy using the curl command, you would need a bearer token. You can use your bearer token or use Connected App credentials. Enter the following commands to deploy:

1. Build the Traceable policy. Enter the following command:

ActionScript ActionScript

** **

```actionscript
mvn clean install
```
2. Publish the policy by running the following. Make sure to enter all the values in the <> brackets. The `traceable_version`is the version of Traceable's Mulesoft policy.

ActionScript ActionScript

** **

```actionscript
curl -v \
  -H 'Authorization: bearer ' \
  -H 'x-sync-publication: true' \
  -F 'files.pom=@/path/to/traceable-mule-policy/traceable/pom.xml' \
  -F 'files.mule-policy.jar=@/path/to/traceable-mule-policy/traceable/target/traceable--mule-policy.jar' \
  -F 'files.policy-definition.yaml=@/path/to/traceable-mule-policy/traceable/traceable.yaml' \
  -F 'files.docs.zip=@docs.zip' \
https://anypoint.mulesoft.com/exchange/api/v2/organizations/<org_id>/assets/<org_id>/traceable/<traceable_version>
```

---

## **Step 2 – Attach the policy**

You can attach the policy to the API at a global or at an individual API level.

### **Option 1 – Attach using automated policy**

You can attach Traceable's agent for Mulesoft as a policy that would apply to all the APIs. You can achieve this using Mulesoft's Automated policy option. Complete the following steps:

1. Login to your Anypoint Platform and navigate to API Manager.
2. Click on Automated Policies from the left navigation menu. **![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_automated_policy.png)**
3. Click on add automated policy in the Automated Policies page. **![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_add_automated_policy.png)**
4. Search for the Traceable policy. Select the appropriate policy and click on Next. **![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_search_policy.png)**
5. Enter the different values to configure Traceable. Make sure to configure `TA REPORTING ENDPOINT`. The value should be `http://traceable_platform_agent_host:5442/ext_cap/v1/req_res_cap`. You can use the default values for the rest of the properties or modify them if you wish.
6. Click on **Apply** to apply the policy.

**Note:**

If you are using CloudHub 1.0 applications, the service name is the mule-app name, not the one you configured in the policy. The service name configured in the policy is used only for CloudHub 2.0 applications.

### **Option 2 – Attach policy to an API**

Complete the following steps to attach the Traceable policy to the APIs that you wish to secure:

1. Login to your Anypoint Platform and navigate to API Manager.
2. Select the API to which you wish to attach the Traceable policy.
3. Click on the **Policies** option as shown below:

![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_add_policy.png)
4. Click on **Add policy**
5. Search for Traceable policy. Select the policy.
6. Add the Traceable Platform agent's IP address. The value should be `http://traceable_platform_agent_host:5442/ext_cap/v1/req_res_cap`.
7. Update the other configurations, or you can use the default values.
8. Apply the policy.

---

## **Configuration options**

The following table describes the various configuration options.

| Configuration option | Description |
| --- | --- |
| `TA REPORTING ENDPOINT` | This is a mandatory value. The value should be `http://traceable_platform_agent_host:5442/ext_cap/v1/req_res_cap` In case you are using a TLS connection, then the value should be: `https://traceable_platform_agent_host:5443/ext_cap/v1/req_res_cap` |
| `TA SERVICE NAME` | Service name of CloudHub 2.0 applications. For CloudHub 1.0, the service name would be the application's name. |
| `TA DATA CAPTURE ALLOWED CONTENT TYPES` | List of values without spaces (json,graphql,x-www-form-urlencoded) |
| `TA DATA CAPTURE BODY MAX SIZE BYTES` | Defines the maximum size that should be captured from the body. |
| `TA DATA CAPTURE HTTP BODY REQUEST` | Set to `true` to capture the HTTP request body. The other value that can be set is `false`. |
| `TA DATA CAPTURE HTTP BODY RESPONSE` | Set to `true` to capture the HTTP response body. The other value that can be set is `false`. |
| `TA DATA CAPTURE HTTP HEADERS REQUEST` | Set to `true` to capture request headers. The other value that can be set is `false`. |
| `TA DATA CAPTURE HTTP HEADERS RESPONSE` | Set to `true` to capture request headers. The other value that can be set is `false`. |
| `TA TLS ENABLED` | Set it to `true` if you wish to use a TLS connection to Traceable's Platform agent. |
| `TA DATA CAPTURE COMPRESS GZIP (Optional)` | `true` or `false`. The default value is `false`. Note If you change the value to `true`, make sure your minimum Traceable Platform agent version is 1.27.0 or later. |

Following is a short demo to add the Traceable policy in Mulesoft's Anypoint Platform:

[Anypoint Platform](https://demo.arcade.software/YmTlEpI6jELPzyyMu63B?embed)

---

## **Verification**

Navigate to the Traceable platform to verify whether the policy is successfully attached to the API in Mulesoft. Click on **Settings** → **Data Collection** → **Tracing agents**. Check if the Mulesoft agent is displayed and the status is active. Further, you can check for spans in API Analytics or API Activity under the API Catalog.

![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_verification(2).png)

---

## **Upgrade and uninstall**

To upgrade the policy, follow the steps mentioned in the Step -1 section to add the new policy to Mulesoft's Exchange. After you have added the new policy to Mulesoft Exchange, complete the following steps:

1. Navigate to the API for which you want to upgrade the policy.
2. Click on the **Policies** option.
3. Click on the menu item as shown below.

![](https://cdn.document360.io/24f14f07-13d1-4684-8fae-6d8f811768ee/Images/Documentation/traceable_mulesoft_upgrade_uninstall.png)
4. Click on Check for updates to update the policy.

If you wish to uninstall the policy, click on **Remove policy**.

---

## **Enable debug logs**

You can enable debug logs by completing the following steps:

1. In Runtime Manager in your Anypoint Platform, navigate to the application for which you wish the logs to be enabled.
2. Navigate to the logging tab.
3. Add a new entry with the level set to `debug` and `org.traceable.ai.internal` as package name.
