Error handling using nested scopes used for API calls via BizTalk

Introduction

Think about a scenario where you need to send a request to an API and capture error responses for HTTP status codes other than 200, as well as for HTTP status code 200. You can use the logic below to achieve this.

Steps

The main scope captures errors related to HTTP status codes other than 200, while the child scope captures errors for HTTP status code 200. In the child orchestration, we check a specific field in the response. If the field is not populated with a value, we know that there is an error and can handle it accordingly.

Main Scope

{
   //Send API request to API
   //Receive response
   Child scope
   {
    //Check for a particular Business identifier in the response message.For example, check invoice ID is present in the response message
    //Throw custom exception
    }
   Child Catch block
   {
    //Catch custom errors
    //Log custom errors in the DB
   }
}
Main Catch block
{
    //Catch errors
    //Log the errors in the DB
}

Comments

Popular posts from this blog

EDI X12 Trading partner configuration in BizTalk

How to create an EDI 850 profile in Boomi?

Basics of Correlation in BizTalk