|
1 | 1 | --- |
2 | | -title: Validate XML in enterprise integration workflows |
3 | | -description: Validate XML using schemas in workflows using Azure Logic Apps and the Enterprise Integration Pack. |
| 2 | +title: Validate XML in B2B Workflows |
| 3 | +description: Learn how to validate XML in B2B workflows using schemas in Azure Logic Apps so you can make sure messages meet trading partner requirements. |
4 | 4 | services: logic-apps |
5 | 5 | ms.suite: integration |
6 | 6 | author: divyaswarnkar |
7 | 7 | ms.author: divswa |
8 | | -ms.reviewer: estfan, azla |
| 8 | +ms.reviewers: estfan, azla |
9 | 9 | ms.topic: how-to |
10 | | -ms.date: 01/04/2024 |
| 10 | +ms.date: 12/09/2025 |
| 11 | +#Customer intent: As an integration developer who works with Azure Logic Apps, I want to validate XML using schemas before processing messages in B2B workflows. |
11 | 12 | --- |
12 | 13 |
|
13 | | -# Validate XML in workflows with Azure Logic Apps |
| 14 | +# Validate XML using schemas in B2B workflows with Azure Logic Apps |
14 | 15 |
|
15 | 16 | [!INCLUDE [logic-apps-sku-consumption-standard](../../includes/logic-apps-sku-consumption-standard.md)] |
16 | 17 |
|
17 | | -In enterprise integration business-to-business (B2B) scenarios, the trading partners in an agreement often have to make sure that the messages they exchange are valid before any data processing can start. Your logic app workflow can validate XML messages and documents by using the **XML Validation** action and a predefined [schema](logic-apps-enterprise-integration-schemas.md). |
| 18 | +In enterprise integration business-to-business (B2B) scenarios, trading partners that communicate with each other based on an agreement need to make sure their messages are valid before any data processing can start. |
18 | 19 |
|
19 | | -If you're new to logic apps, review [What is Azure Logic Apps](logic-apps-overview.md)? For more information about B2B enterprise integration, review [B2B enterprise integration workflows with Azure Logic Apps and Enterprise Integration Pack](logic-apps-enterprise-integration-overview.md). |
| 20 | +This guide shows how your logic app workflow can validate XML messages and documents using a predefined [schema](logic-apps-enterprise-integration-schemas.md) and the **XML Operations** action that validates XML. |
20 | 21 |
|
21 | 22 | ## Prerequisites |
22 | 23 |
|
23 | | -* An Azure account and subscription. If you don't have a subscription yet, [sign up for a free Azure account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn). |
| 24 | +- An Azure account and subscription. [Get a free Azure account](https://azure.microsoft.com/pricing/purchase-options/azure-account?cid=msft_learn). |
24 | 25 |
|
25 | | -* The logic app workflow, blank or existing, where you want to use the **XML Validation** action. |
| 26 | +- The logic app resource and workflow where you want to validate XML. |
26 | 27 |
|
27 | | - If you have a blank workflow, use any trigger you want. This example uses the Request trigger. |
| 28 | + Your workflow must start with a trigger, but you can use any trigger that works for your scenario. For more information, see these [general steps](create-workflow-with-trigger-or-action.md#add-trigger) to add any trigger you want. |
28 | 29 |
|
29 | | -* An [integration account resource](logic-apps-enterprise-integration-create-integration-account.md) where you define and store artifacts, such as trading partners, agreements, certificates, and so on, for use in your enterprise integration and B2B workflows. This resource has to meet the following requirements: |
| 30 | + The examples in this guide use the [**Request** trigger named **When an HTTP request is received**](../connectors/connectors-native-reqres.md), which waits until an external caller sends a request to the trigger. Alternatively, you can use the [**Schedule** trigger named **Recurrence**](../connectors/connectors-native-recurrence.md). |
30 | 31 |
|
31 | | - * Is associated with the same Azure subscription as your logic app resource. |
| 32 | +- An [integration account resource](./enterprise-integration/create-integration-account.md) to define and store artifacts for use in your enterprise integration and B2B workflows across multiple logic app resources. |
32 | 33 |
|
33 | | - * Exists in the same location or Azure region as your logic app resource where you plan to use the **XML Validation*** action. |
| 34 | + - Both your integration account and logic app resource must exist in the same Azure subscription and Azure region. |
34 | 35 |
|
35 | | - * If you're using the [**Logic App (Consumption)** resource type](logic-apps-overview.md#resource-environment-differences), your integration account requires the following items: |
| 36 | + - The [schema](logic-apps-enterprise-integration-schemas.md) to use for validating XML content. |
36 | 37 |
|
37 | | - * The [schema](logic-apps-enterprise-integration-schemas.md) to use for validating XML content. |
| 38 | +- Before you start working with XML operations that use artifacts such as schemas in an integration account, you must [link your Consumption logic app](enterprise-integration/create-integration-account.md?tabs=consumption#link-account) or [link your Standard logic app](enterprise-integration/create-integration-account.md?tabs=standard#link-account) to the integration account. You can then use the artifacts across workflows in multiple logic app resources. |
38 | 39 |
|
39 | | - * A [link to your logic app resource](logic-apps-enterprise-integration-create-integration-account.md#link-account). |
| 40 | + You can optionally add specific artifacts directly to a Standard logic app resource. However, only workflows in the same resource can work with those artifacts. |
40 | 41 |
|
41 | | - * If you're using the [**Logic App (Standard)** resource type](logic-apps-overview.md#resource-environment-differences), you don't store schemas in your integration account. Instead, you can [directly add schemas to your logic app resource](logic-apps-enterprise-integration-schemas.md) using either the Azure portal or Visual Studio Code. You can then use these schemas across multiple workflows within the *same logic app resource*. |
| 42 | +[!INCLUDE [api-test-http-request-tools-bullet](../../includes/api-test-http-request-tools-bullet.md)] |
42 | 43 |
|
43 | | - You still need an integration account to store other artifacts, such as partners, agreements, and certificates, along with using the [AS2](logic-apps-enterprise-integration-as2.md), [X12](logic-apps-enterprise-integration-x12.md), and [EDIFACT](logic-apps-enterprise-integration-edifact.md) operations. However, you don't need to link your logic app resource to your integration account, so the linking capability doesn't exist. Your integration account still has to meet other requirements, such as using the same Azure subscription and existing in the same location as your logic app resource. |
| 44 | + If you use a trigger that waits for a request to start the workflow, you need an HTTP request tool to test the trigger and workflow. |
44 | 45 |
|
45 | | - > [!NOTE] |
46 | | - > Currently, only the **Logic App (Consumption)** resource type supports [RosettaNet](logic-apps-enterprise-integration-rosettanet.md) operations. |
47 | | - > The **Logic App (Standard)** resource type doesn't include [RosettaNet](logic-apps-enterprise-integration-rosettanet.md) operations. |
| 46 | +## Add a validate XML action |
48 | 47 |
|
49 | | -## Add XML validation action |
| 48 | +1. In the [Azure portal](https://portal.azure.com), open the logic app resource. Open your workflow in the designer. |
50 | 49 |
|
51 | | -1. In the [Azure portal](https://portal.azure.com), open your logic app and workflow in designer view. |
| 50 | +1. On the designer, follow these [general steps](create-workflow-with-trigger-or-action.md?tabs=standard#add-action) to add the **XML Operations** action with the name that matches your workflow type: |
52 | 51 |
|
53 | | -1. If you have a blank logic app that doesn't have a trigger, add any trigger you want. This example uses the Request trigger. Otherwise, continue to the next step. |
| 52 | + | Workflow | Action name | |
| 53 | + |----------|-------------| |
| 54 | + | Consumption | **XML Validation** | |
| 55 | + | Standard | **Validate XML** | |
54 | 56 |
|
55 | | - To add the Request trigger, in the designer search box, enter `HTTP request`, and select the Request trigger named **When an HTTP request is received**. |
| 57 | +1. To view the source options for your XML content, follow these steps: |
56 | 58 |
|
57 | | -1. Under the step in your workflow where you want to add the **XML Validation** action, choose one of the following steps: |
| 59 | + 1. Select inside the **Content** box, then select an option: |
58 | 60 |
|
59 | | - For a Consumption logic app, choose one of the following steps: |
| 61 | + | XML content source | Select | Description | |
| 62 | + |--------------------|--------|-------------| |
| 63 | + | Output from a previous workflow operation | Lightning icon | Open the dynamic content list so you can select the output from the trigger or a previous action. | |
| 64 | + | Output from an expression | Function icon | Open the expression editor so you can use an expression function or build an expression to produce the XML content. | |
60 | 65 |
|
61 | | - * To add the **XML Validation** action at the end of your workflow, select **New step**. |
| 66 | + This example continues with the dynamic content list, for example: |
62 | 67 |
|
63 | | - * To add the **XML Validation** action between existing steps, move your pointer over the arrow that connects those steps so that the plus sign (**+**) appears. Select that plus sign, and then select **Add an action**. |
| 68 | + :::image type="content" source="./media/logic-apps-enterprise-integration-xml-validation/open-dynamic-content-list.png" alt-text="Screenshot shows the Azure portal, workflow designer, selected validate XML action, cursor in Content box, and opened dynamic content list." lightbox="./media/logic-apps-enterprise-integration-xml-validation/open-dynamic-content-list.png"::: |
64 | 69 |
|
65 | | - For a Standard plan-based logic app, choose a step: |
| 70 | + 1. From the dynamic content list, select the output with the XML content from the operation you want. |
66 | 71 |
|
67 | | - * To add the **XML Validation** action at the end of your workflow, select the plus sign (**+**), and then select **Add an action**. |
| 72 | + This example selects the **Body** output from the trigger named **When an HTTP request is received**. |
68 | 73 |
|
69 | | - * To add the **XML Validation** action between existing steps, select the plus sign (**+**) that appears between those steps, and then select **Add an action**. |
| 74 | +1. To specify the schema for validation, follow the steps for your workflow type: |
70 | 75 |
|
71 | | -1. Under **Choose an operation**, select **Built-in**. In the search box, enter `xml validation`. From the actions list, select **XML Validation**. |
| 76 | + **Consumption** |
72 | 77 |
|
73 | | -1. To specify the XML content for validation, click inside the **Content** box so that the dynamic content list appears. |
| 78 | + From the **Schema Name** list, select the schema from the linked integration account. |
74 | 79 |
|
75 | | - The dynamic content list shows property tokens that represent the outputs from the previous steps in the workflow. If the list doesn't show an expected property, check the trigger or action heading in the list and whether you can select **See more**. |
| 80 | + **Standard** |
76 | 81 |
|
77 | | - For a Consumption logic app, the designer looks like this example: |
| 82 | + 1. From the **Schema source** list, select **IntegrationAccount** or **LogicApp**. |
78 | 83 |
|
79 | | -  |
| 84 | + This example selects **IntegrationAccount**. |
80 | 85 |
|
81 | | - For a Standard plan-based logic app, the designer looks like this example: |
| 86 | + 1. From the **Schema name** list, select the schema. |
82 | 87 |
|
83 | | -  |
| 88 | +1. When you're done, save your workflow. |
84 | 89 |
|
85 | | -1. From the dynamic content list, select the property token for the content you want to validate. |
| 90 | +You're now finished with setting up your validate XML action. In a real world app, you might want to store the validated data in a line-of-business (LOB) app such as SalesForce. To send the validated output to Salesforce, add a **Salesforce** action. |
86 | 91 |
|
87 | | - This example selects the **Body** token from the trigger. |
| 92 | +## Test your workflow |
88 | 93 |
|
89 | | -1. To specify the schema to use for validation, open the **Schema Name** list, and select the schema that you previously added. |
| 94 | +Confirm that the workflow works the way that you expect. |
90 | 95 |
|
91 | | -1. When you're done, make sure to save your logic app workflow. |
| 96 | +1. On the designer, select the trigger named **When an HTTP request is received**. |
92 | 97 |
|
93 | | - You're now finished setting up your **XML Validation** action. In a real world app, you might want to store the validated data in a line-of-business (LOB) app such as SalesForce. To send the validated output to Salesforce, add a Salesforce action. |
| 98 | +1. From the **HTTP URL** property, copy and save the endpoint URL for the trigger. |
94 | 99 |
|
95 | | -1. To test your validation action, trigger and run your workflow. For example, for the Request trigger, send a request to the trigger's endpoint URL. |
| 100 | +1. On the designer toolbar. select **Run** > **Run**. |
96 | 101 |
|
97 | | - The **XML Validation** action runs after your workflow is triggered and when XML content is available for validation. |
| 102 | +1. To fire the **Request** trigger, use your preferred HTTP request tool to send a request with the XML content to the trigger's endpoint URL. |
98 | 103 |
|
99 | | -## Next steps |
| 104 | + The validate XML action runs after the trigger fires and XML content is available for validation. |
100 | 105 |
|
101 | | -* [Add schemas for XML validation in Azure Logic Apps](logic-apps-enterprise-integration-schemas.md) |
102 | | -* [Transform XML for workflows in Azure Logic Apps](logic-apps-enterprise-integration-transform.md) |
| 106 | +1. To review the status for each operation, inputs, and outputs, follow the steps in [Review workflow run history](view-workflow-status-run-history.md#review-workflow-run-history). |
| 107 | + |
| 108 | +## Related content |
| 109 | + |
| 110 | +- [Add schemas for XML validation in Azure Logic Apps](logic-apps-enterprise-integration-schemas.md) |
| 111 | +- [Transform XML for workflows in Azure Logic Apps](logic-apps-enterprise-integration-transform.md) |
| 112 | +- [B2B enterprise integration workflows with Azure Logic Apps](logic-apps-enterprise-integration-overview.md) |
| 113 | +- [What is Azure Logic Apps](logic-apps-overview.md) |
0 commit comments