You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/logic-apps/logic-apps-enterprise-integration-flatfile.md
+38-31Lines changed: 38 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,67 +7,74 @@ author: divyaswarnkar
7
7
ms.author: divswa
8
8
ms.reviewer: jonfan, estfan, logicappspm
9
9
ms.topic: article
10
-
ms.date: 04/28/2020
10
+
ms.date: 05/12/2020
11
11
---
12
12
13
13
# Encode and decode flat files in Azure Logic Apps by using the Enterprise Integration Pack
14
14
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 use the **Flat File** connector to encode and decode flat files. Your logic app can get this XML content from various sources, such as an HTTP 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)?
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
17
## Prerequisites
18
18
19
-
* An Azure subscription. If you don't have an Azure subscription yet, [sign up for a free Azure account](https://azure.microsoft.com/free/).
19
+
* An Azure subscription. If you don't have a subscription, [sign up for a free Azure account](https://azure.microsoft.com/free/).
20
20
21
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).
22
22
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 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.
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.
24
24
25
-
* A flat file [schema]() that you use for encoding or decoding the XML content
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
26
26
27
-
* At least two [trading partners](../logic-apps/logic-apps-enterprise-integration-partners.md) that you've already defined in your integration account.
27
+
* At least two [trading partners](logic-apps-enterprise-integration-partners.md) that you've already defined in your integration account
28
28
29
29
## Add flat file encode action
30
30
31
-
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.
31
+
1.In the [Azure portal](https://portal.azure.com), open your logic app in the Logic App Designer.
32
32
33
-
1.In the Logic App Designer, add the **When an HTTP request is received** trigger to your logic app.
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.
34
34
35
-
1. Add the flat file encoding action, as follows:
35
+
This example uses the following JSON schema that describes the payload from the inbound request:
36
36
37
-
a. Select the **plus** sign.
37
+
```json
38
+
{
39
+
"type": "object",
40
+
"properties": {
41
+
"member": {
42
+
"type": "string"
43
+
}
44
+
}
45
+
}
46
+
```
38
47
39
-
b. Select the **Add an action** link (appears after you have selected the plus sign).
40
-
41
-
c. In the search box, enter *Flat* to filter all the actions to the one that you want to use.
48
+
```xml
49
+
{
50
+
"member": "<member><firstName>Sophia</firstName><lastName>Owen</lastName><address><street>123456 Any Street</street><city>Any Town</city><state>Any State</state><postalCode>10000</postalCode></address></member>"
51
+
}
42
52
43
-
d. Select the **Flat File Encoding** option from the list.
53
+
1. Under **Choose an action**, enter `flat file`. From the actions list, select this action: **Flat File Encoding**
44
54
45
-

1.On the **Flat File Encoding** dialog box, select the **Content**text box.
57
+
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.
48
58
49
-

59
+

50
60
51
-
1. Select the body tag as the content that you want to encode. The body tag will populate the content field.
61
+
> [!TIP]
62
+
> If you don't see the **Body** property in the dynamic content list,
63
+
> select **See more** next to the **When a HTTP request is received** section label.
52
64
53
-

54
-
55
-
1. Select the **Schema Name** list box, and choose the schema you want to use to encode the input content.
56
-
57
-

58
-
59
-
1. Save your work.
65
+
1. From the **Schema Name** list, select the schema that's in your linked integration account to use for encoding.
60
66
61
-

67
+

62
68
63
-
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.
69
+
> [!NOTE]
70
+
> If no schema appears in the list, your integration account doesn't contain any schema files to use for encoding.
71
+
> Upload the schema that you want to use to your integration account.
64
72
65
-
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.
73
+
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 XML content in the body of the request.
66
74
67
-
## Create the flat file decoding connector
75
+
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).
68
76
69
-
> [!NOTE]
70
-
> To complete these steps, you need to have a schema file already uploaded into you integration account.
77
+
## Add flat file decode action
71
78
72
79
1. In the Logic App Designer, add the **When an HTTP request is received** trigger to your logic app.
0 commit comments