Uncategorized

Consuming WCF service in Orchestration in BizTalk


Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application. You can get more detail here on msdn WCF. I was very relunctant to post this blog but then I thought that my blog will save alot of time of others plus I could provide simple way to achieve this.

Now for consumption we need to have a WCF web srevice ,there are two ways to create a wcf service, one is to create through BizTalk wcf web publishing wizard and other is publish through Visutal studio by defining our web method on that , on IIS.

I have already created a WCF service in which I send a request to Database and get response through our service. I have created below service through BizTalk WCF web publishing wizard.

Now I service has made and browsed on our browser as in my screen shot. Now  service is responding fine , Now we have to work on our orchestration where we do our implementation part, with the following steps

(1) Create a Empty biztalk project, and then Add Web Reference, by right click on the project.

add web Reference

add web Reference

as we Added web reference in our project so , we will have the following artifacts in our project as fellows, as we are consuming WCF service in our orchestration.

artifacts created by BizTalk itself

artifacts created by BizTalk itself

Now Create a new orchestration, with nay name

Now whenever we add reference of any service, BizTalk generate request and response artifact in port type tab, when we open our orchestration we could find them below picture.

WCF service request and reponse message schema

WCF service request and reponse message schema

, on the right or left side of the orchestration click and Create a new Configuration port mentioned in below.

 Configuration Port

Configuration Port

Now this is our dynamic configuring port which go and get back our required data from our WCF service whenever our orchestration instance created against this service in the message box, or simple is that it will bring data form wcf service for our project, In the port configuration wizard just name to your port  and check on existing port radio button which will show the port which dynamically created by the biztalk, as I show in the image below.

dynamic port configuration

dynamic port configuration

Now designed your workflow as your project or service requirement, for simplicity I make it simpler.

Work Flow of Service:

Start Create a Receive port to get request form our application

(1) Create a Receive Shape , which receive our service request.

(2) Create a Map so that we can create a request message for our wcf service

(3) Send shape to send request to the WCF service,

(4) Again We need to heave a receive shape to get response form WCF service

End Create a send port to send or manipulate the wcf service response

WorkFlow

WorkFlow

Now most of our work has been done , we just need to create our mesage and make two and flow of those. Create request mesage, transform that mesage to WCF service request mesage, then make a resposne message which receive our response from WCF service, but when you are going  to create a request and response message you will need to select request/response schema of Wcf from Web Message Type option as mentioned below.

Web Mesage Type

Web Mesage Type

Now our whole work has done, finally the workflow will be looking like below.

Final WorkFlow

Final WorkFlow

 

I hope this will remove most of the queries in consuming WCF service within orchesration.

Standard

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s