question

BaharulIslam-2413 avatar image
0 Votes"
BaharulIslam-2413 asked KamleshKumar answered

Azure Integration with complex mapping & transformation

Hi Expert,
We are using Azure Integration where need to integrate between two system. But before sending data to target system we need enrich data with some complex mapping & transformation (like different mapping different type of input type as well defaulting some values).

Here getting first data as input body and subsequently need to call some 3rd party API to get additional data.

What is the best layer & efficient way to achieve this type of mapping ?

azure-functionsazure-logic-appsazure-api-management
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

KamleshKumar avatar image
1 Vote"
KamleshKumar answered

Hi There,

Thank you for asking this question on the Microsoft Q&A Platform.

As you mentioned, you are already using Azure Integration so I assume you already have an Integration account where you can store your map/schema.

For your scenario, you can achieve it in multiple ways, I am giving some suggestion that you can take,

  1. Build a LogicApp and implement the mapping as per your data transformation rule. Even if you have 3rd party call in between to pull and add the additional data, I would suggest this option will be much easier to achieve it. Here you can go with XSLT or Liquid map.

  2. You can write a function to do obj-obj mapping based on your input received from 3rd party API. This would be much tricky but again it's possible in this way as well.

Regards,
Kamlesh Kumar
BizTalk Techie

If this answer solved your problem, please click the Verify Answer button (found below the answer) to help other users who have the same question.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SudiptaChakraborty-1767 avatar image
0 Votes"
SudiptaChakraborty-1767 answered

You can use Azure API Management (APIM) service and write different policies for manipulating requests as well as integrating with third party services.

References:
https://docs.microsoft.com/en-us/azure/api-management/api-management-policies
https://docs.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#SendRequest

The sample policy shows one way to verify a reference token with an authorization server:

 <inbound>
   <!-- Extract Token from Authorization header parameter -->
   <set-variable name="token" value="@(context.Request.Headers.GetValueOrDefault("Authorization","scheme param").Split(' ').Last())" />
    
   <!-- Send request to Token Server to validate token (see RFC 7662) -->
   <send-request mode="new" response-variable-name="tokenstate" timeout="20" ignore-error="true">
     <set-url>https://microsoft-apiappec990ad4c76641c6aea22f566efc5a4e.azurewebsites.net/introspection</set-url>
     <set-method>POST</set-method>
     <set-header name="Authorization" exists-action="override">
       <value>basic dXNlcm5hbWU6cGFzc3dvcmQ=</value>
     </set-header>
     <set-header name="Content-Type" exists-action="override">
       <value>application/x-www-form-urlencoded</value>
     </set-header>
     <set-body>@($"token={(string)context.Variables["token"]}")</set-body>
   </send-request>
    
   <choose>
         <!-- Check active property in response -->
         <when condition="@((bool)((IResponse)context.Variables["tokenstate"]).Body.As<JObject>()["active"] == false)">
             <!-- Return 401 Unauthorized with http-problem payload -->
             <return-response>
                 <set-status code="401" reason="Unauthorized" />
                 <set-header name="WWW-Authenticate" exists-action="override">
                     <value>Bearer error="invalid_token"</value>
                 </set-header>
             </return-response>
         </when>
     </choose>
   <base />
 </inbound>
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.