Thursday 20 February 2014

How to integrate Two way WCF Service with Windows Azure Biztalk Services


Introduction

This sample demonstrates how to integrate web application running on-premises or in the cloud with two ways WCF Service, via Windows Azure BizTalk Services.
 

Architecture


The following diagram shows the architecture of the solution.


 








Prerequisites

  • Visual Studio 2012 Express for Windows 8
  • Windows Azure Biztalk Services SDK for Windows 8
  • and a Windows Azure account (get the Free Trial)
 


Step by Step 



Create WCF Service and Host it on cloud.


Create a Windows Azure Cloud Service Project.
















Add WCFServiceWebRole
 














Change The Iservice class to IVendorInventoryService

 











Change the code for VendorInventoryService










Create the Package to deploy on Cloud




























Deploy package on Cloud.
Log on to cloud portal.
Click on New Cloud Service.
















Enter the name of Service
 
















Select the package and configuration from local


















Click the “Deploy even if one or more roles contain a single instance”.


 














You can check in IE that service in hosted properly.
 
















Test the WCF  service using SOAP UI.















Create The Biztalk Services.


Create the Biztalk Service project.

 














Create Input Schema for receive request from web / HTML Application.
 














Add another XML Schema Inventory Response

 














Create XML Structure for InventoryResponse.
 















Generate Schema for Service using add Schemas from service Wizard.
 





















Enter the end point of service .
 




















Click on Get and Import , to include schema into solution.
 

















Create Map for convert Inventory Request to Inventory Service Request.

 














Create Map for Inventory Service Response to InventoryResponse



































Configure XML RequestReplyBridge.
Configure Message Type of Request and Response of Bridge.
 












Configure Map for Request Message.















Configure Map for Response Message
 

































Set the runtime address of Two Way External Service

 








Set the filter condition of link
 














Set action
 















Set the Biztalk Service URL of MessageFlowIternary.


 








Deploy the solution. 
















You can check the application deployed properly by checking on portal resources.

 













Test The Solution.

Send Message to Bridge using Biztalk Services Explorer.
 






















Load the Sample Instance and Send the request.
 














Possible Error

The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).


Solution: if you have not add proper Action in Soap action then this Error will come, you can check the action from wsdl of service