|
1 | 1 | ---
|
2 | 2 | title: Encode or decode flat files
|
3 |
| -description: Encode or decode flat files for enterprise integration with Azure Logic Apps and Enterprise Integration Pack |
| 3 | +description: Encode or decode flat files for enterprise integration in Azure Logic Apps by using the Enterprise Integration Pack |
4 | 4 | services: logic-apps
|
5 | 5 | ms.suite: integration
|
6 | 6 | author: divyaswarnkar
|
7 | 7 | ms.author: divswa
|
8 | 8 | ms.reviewer: jonfan, estfan, logicappspm
|
9 | 9 | ms.topic: article
|
10 |
| -ms.date: 07/08/2016 |
| 10 | +ms.date: 05/09/2020 |
11 | 11 | ---
|
12 | 12 |
|
13 |
| -# Encode or decode flat files with Azure Logic Apps and Enterprise Integration Pack |
| 13 | +# Encode and decode flat files in Azure Logic Apps by using the Enterprise Integration Pack |
14 | 14 |
|
15 |
| -You may want to encode XML content before you send it to a business partner in a business-to-business (B2B) scenario. In a logic app, you can use the flat file encoding connector to do this. The logic app that you create can get its XML content from a variety of sources, including from an HTTP request trigger, from another application, or even from one of the many [connectors](../connectors/apis-list.md). For more information about logic apps, see the [logic apps documentation](logic-apps-overview.md "Learn more about Logic apps"). |
| 15 | +Before you send XML content to a business partner in a business-to-business (B2B) scenario, you might want to encode that content first. By building a logic app, you can encode and decode flat files by using the **Flat File** connector. Your logic app can get this XML content from various sources, such as the Request trigger, another app, or other [connectors supported by Azure Logic Apps](../connectors/apis-list.md). For more information, see [What is Azure Logic Apps](logic-apps-overview.md)? |
16 | 16 |
|
17 |
| -## Create the flat file encoding connector |
18 |
| -Follow these steps to add a flat file encoding connector to your logic app. |
| 17 | +## Prerequisites |
19 | 18 |
|
20 |
| -1. Create a logic app and [link it to your integration account](logic-apps-enterprise-integration-accounts.md "Learn to link an integration account to a Logic app"). This account contains the schema you will use to encode the XML data. |
| 19 | +* An Azure subscription. If you don't have a subscription, [sign up for a free Azure account](https://azure.microsoft.com/free/). |
21 | 20 |
|
22 |
| -1. In the Logic App Designer, add the **When an HTTP request is received** trigger to your logic app. |
| 21 | +* The logic app where you want to use the **Flat File** connector and a trigger that starts your logic app's workflow. The **Flat File** connector provides only actions, not triggers. You can use either the trigger or another action to feed the XML content into your logic app for encoding or decoding. If you're new to logic apps, review [Quickstart: Create your first logic app](../logic-apps/quickstart-create-first-logic-app-workflow.md). |
23 | 22 |
|
24 |
| -1. Add the flat file encoding action, as follows: |
| 23 | +* An [integration account](../logic-apps/logic-apps-enterprise-integration-create-integration-account.md) that's associated with your Azure subscription and [linked to the logic app](logic-apps-enterprise-integration-accounts.md#link-account) where you plan to use the **Flat File** connector. Both your logic app and integration account must exist in the same location or Azure region. |
25 | 24 |
|
26 |
| - a. Select the **plus** sign. |
| 25 | +* A flat file [schema](logic-apps-enterprise-integration-schemas.md) that you've uploaded to your integration account for encoding or decoding the XML content |
27 | 26 |
|
28 |
| - b. Select the **Add an action** link (appears after you have selected the plus sign). |
| 27 | +* At least two [trading partners](logic-apps-enterprise-integration-partners.md) that you've already defined in your integration account |
29 | 28 |
|
30 |
| - c. In the search box, enter *Flat* to filter all the actions to the one that you want to use. |
| 29 | +## Add flat file encode action |
31 | 30 |
|
32 |
| - d. Select the **Flat File Encoding** option from the list. |
| 31 | +1. In the [Azure portal](https://portal.azure.com), open your logic app in the Logic App Designer. |
33 | 32 |
|
34 |
| -  |
| 33 | +1. Under the trigger or action in your logic app, select **New step** > **Add an action**. This example uses the Request trigger, which is named **When a HTTP request is received**, and handles inbound requests from outside the logic app. |
35 | 34 |
|
36 |
| -1. On the **Flat File Encoding** dialog box, select the **Content** text box. |
| 35 | + > [!TIP] |
| 36 | + > Providing a JSON schema is optional. If you have a sample payload from the inbound request, |
| 37 | + > select **Use sample payload to generate schema**, enter the sample payload, and select **Done**. |
| 38 | + > The schema appears in the **Request Body JSON Schema** box. |
37 | 39 |
|
38 |
| -  |
| 40 | +1. Under **Choose an action**, enter `flat file`. From the actions list, select this action: **Flat File Encoding** |
39 | 41 |
|
40 |
| -1. Select the body tag as the content that you want to encode. The body tag will populate the content field. |
| 42 | +  |
41 | 43 |
|
42 |
| -  |
| 44 | +1. Click inside the **Content** box so that the dynamic content list appears. From the list, in the **When a HTTP request is received** section, select the **Body** property, which contains the request body output from the trigger and the content to encode. |
43 | 45 |
|
44 |
| -1. Select the **Schema Name** list box, and choose the schema you want to use to encode the input content. |
| 46 | +  |
45 | 47 |
|
46 |
| -  |
| 48 | + > [!TIP] |
| 49 | + > If you don't see the **Body** property in the dynamic content list, |
| 50 | + > select **See more** next to the **When a HTTP request is received** section label. |
| 51 | + > You can also directly enter the content to decode in the **Content** box. |
47 | 52 |
|
48 |
| -1. Save your work. |
| 53 | +1. From the **Schema Name** list, select the schema that's in your linked integration account to use for encoding, for example: |
49 | 54 |
|
50 |
| -  |
| 55 | +  |
51 | 56 |
|
52 |
| -At this point, you are finished setting up your flat file encoding connector. In a real world application, you may want to store the encoded data in a line-of-business application, such as Salesforce. Or you can send that encoded data to a trading partner. You can easily add an action to send the output of the encoding action to Salesforce, or to your trading partner, by using any one of the other connectors provided. |
| 57 | + > [!NOTE] |
| 58 | + > If no schema appears in the list, your integration account doesn't contain any schema files to use for encoding. |
| 59 | + > Upload the schema that you want to use to your integration account. |
53 | 60 |
|
54 |
| -You can now test your connector by making a request to the HTTP endpoint, and including the XML content in the body of the request. |
| 61 | +1. Save your logic app. To test your connector, make a request to the HTTPS endpoint, which appears in the Request trigger's **HTTP POST URL** property, and include the XML content that you want to encode in the request body. |
55 | 62 |
|
56 |
| -## Create the flat file decoding connector |
| 63 | +You're now done with setting up your flat file encoding action. In a real world app, you might want to store the encoded data in a line-of-business (LOB) app, such as Salesforce. Or, you can send the encoded data to a trading partner. To send the output from the encoding action to Salesforce or to your trading partner, use the other [connectors available in Azure Logic Apps](../connectors/apis-list.md). |
57 | 64 |
|
58 |
| -> [!NOTE] |
59 |
| -> To complete these steps, you need to have a schema file already uploaded into you integration account. |
| 65 | +## Add flat file decode action |
60 | 66 |
|
61 |
| -1. In the Logic App Designer, add the **When an HTTP request is received** trigger to your logic app. |
| 67 | +1. In the [Azure portal](https://portal.azure.com), open your logic app in the Logic App Designer. |
62 | 68 |
|
63 |
| -1. Add the flat file decoding action, as follows: |
| 69 | +1. Under the trigger or action in your logic app, select **New step** > **Add an action**. This example uses the Request trigger, which is named **When a HTTP request is received**, and handles inbound requests from outside the logic app. |
64 | 70 |
|
65 |
| - a. Select the **plus** sign. |
| 71 | + > [!TIP] |
| 72 | + > Providing a JSON schema is optional. If you have a sample payload from the inbound request, |
| 73 | + > select **Use sample payload to generate schema**, enter the sample payload, and select **Done**. |
| 74 | + > The schema appears in the **Request Body JSON Schema** box. |
66 | 75 |
|
67 |
| - b. Select the **Add an action** link (appears after you have selected the plus sign). |
| 76 | +1. Under **Choose an action**, enter `flat file`. From the actions list, select this action: **Flat File Decoding** |
68 | 77 |
|
69 |
| - c. In the search box, enter *Flat* to filter all the actions to the one that you want to use. |
| 78 | +  |
70 | 79 |
|
71 |
| - d. Select the **Flat File Decoding** option from the list. |
| 80 | +1. Click inside the **Content** box so that the dynamic content list appears. From the list, in the **When a HTTP request is received** section, select the **Body** property, which contains the request body output from the trigger and the content to decode. |
72 | 81 |
|
73 |
| -  |
| 82 | +  |
74 | 83 |
|
75 |
| -1. Select the **Content** control. This produces a list of the content from earlier steps that you can use as the content to decode. Notice that the *Body* from the incoming HTTP request is available to be used as the content to decode. You can also enter the content to decode directly into the **Content** control. |
| 84 | + > [!TIP] |
| 85 | + > If you don't see the **Body** property in the dynamic content list, |
| 86 | + > select **See more** next to the **When a HTTP request is received** section label. |
| 87 | + > You can also directly enter the content to decode in the **Content** box. |
76 | 88 |
|
77 |
| -1. Select the *Body* tag. Notice the body tag is now in the **Content** control. |
| 89 | +1. From the **Schema Name** list, select the schema that's in your linked integration account to use for decoding, for example: |
78 | 90 |
|
79 |
| -1. Select the name of the schema that you want to use to decode the content. The following screenshot shows that *OrderFile* is the selected schema name. This schema name had been uploaded into the integration account previously. |
| 91 | +  |
80 | 92 |
|
81 |
| -  |
| 93 | + > [!NOTE] |
| 94 | + > If no schema appears in the list, your integration account doesn't contain any schema files to use for decoding. |
| 95 | + > Upload the schema that you want to use to your integration account. |
82 | 96 |
|
83 |
| -1. Save your work. |
| 97 | +1. Save your logic app. To test your connector, make a request to the HTTPS endpoint, which appears in the Request trigger's **HTTP POST URL** property, and include the XML content that you want to decode in the request body. |
84 | 98 |
|
85 |
| -  |
86 |
| - |
87 |
| -At this point, you are finished setting up your flat file decoding connector. In a real world application, you may want to store the decoded data in a line-of-business application such as Salesforce. You can easily add an action to send the output of the decoding action to Salesforce. |
88 |
| - |
89 |
| -You can now test your connector by making a request to the HTTP endpoint and including the XML content you want to decode in the body of the request. |
| 99 | +You're now done with setting up your flat file decoding action. In a real world app, you might want to store the decoded data in a line-of-business (LOB) app, such as Salesforce. Or, you can send the decoded data to a trading partner. To send the output from the decoding action to Salesforce or to your trading partner, use the other [connectors available in Azure Logic Apps](../connectors/apis-list.md). |
90 | 100 |
|
91 | 101 | ## Next steps
|
92 |
| -* [Learn more about the Enterprise Integration Pack](logic-apps-enterprise-integration-overview.md "Learn about Enterprise Integration Pack"). |
93 | 102 |
|
| 103 | +* Learn more about the [Enterprise Integration Pack](logic-apps-enterprise-integration-overview.md) |
0 commit comments