Thursday 1 September 2016

WebApi Integration using Biztalk

problem statement:

need to integrate web api using Biztalk ,let's say we have a scenario where I need to form different URL  based on requirement.

sample URL'S

http://BiztalkPoc.blogspot.in/GetOrderDetail/{OrderID}
http://BiztalkPoc.blogspot.in/UpdateProduct/UpdateDesc/{OrderID}


solution:


  • Create Orchestration  in which we will be calling the web api service
  • promote desired  operation (GetOrderDetail,UpdateProduct) from orchestration using custom property schema
  • promote order id from orchestration so that we can bind the same in send port variable mapping property
  • Create a custom pipeline component for reading the operation name and promoting it again

       object obj = context.Read("Operation", "http://BiztalkPoc.Samaple.WebApiIntegration.PropertySchema1");
                //operation is the property promoted from orchestration 
                string operationName = Convert.ToString(obj);               

                pInMsg.Context.Promote("Operation", "http://schemas.microsoft.com/BizTalk/2003/system-properties", operationName);

  • Create WCF-WebHttp send port ,configure different urls using  BtsHttpUrlMapping propert


<BtsHttpUrlMapping>  <Operation Name="GetOrderDetail" Method ="GET" Url="/GetOrderDetail/{OrderID}"/>
  <Operation Name="UpdateProduct" Method ="POST" Url="/UpdateProduct/UpdateDesc/{OrderID}"/>
  <!--we can have as many operation based on our requiremenr-->
</BtsHttpUrlMapping>











DownloadSample Code Here