Tuesday, December 30, 2008

Calling WCF Service from BTS-2009

 

First let's create a simple WCF service that Biztalk server will call.

Here is my ServiceContract and Implementation of the  Service Contract.

image

I am Hosting this WCF service in  Console Application (Self hosting).

image 

Now  I need to actually start up my WCF service host. Now BizTalk can interrogate this service to extract the necessary metadata. Within Visual Studio.NET, I chose “Consume WCF Service” from the “Add Generated Items” project menu.

Now create Empty Biztalk Project. Right click on the project and select Add Generated Items as shown below.

image

From Add Generated Items Dialog select Consuming WCF Service Template.

image

 

Now Follow the  BizTalk WCF Service Consuming Wizard.

image

Here Edit the WCF Service MEX endpoint URL

image

Before doing above step make sure that WCF service UP and Running ( Remember We hosted this service in console App).

image

 

image

 

image

 

Now we are successfully finished the Wizard.

image

WCF Service Consuming Wizard Generates the following files.

image

 

Now Open the SreeniImpl.odx Orchestration Create a message for the WCF Service Add Operation and configure the  Receive and Send Ports.

image

Now Build and Deploy the Application and Open up the Biztalk 2009 Admin Console.

Our WCF service build with Basic HTTP binding so  in Biztalk we need to configure send port Transport type as WCF-Basic HTTP as shown below.

image

Now configure the send port as shown below.

image

 

Now configure the Receive port as shown below .

image

Now test the  Biztalk application.

Input XML Message

<ns0:Add xmlns:ns0="http://tempuri.org/">

<ns0:a>5000</ns0:a>

<ns0:b>18</ns0:b>

</ns0:Add>

when we drop the input XML message in Receive Location Biztalk server call WCF service Add Operation.

image

Output XML Message:

<?xml version="1.0" encoding="utf-8" ?>

<AddResponse xmlns="http://tempuri.org/">

<AddResult>5018</AddResult>

</AddResponse>

 

Thanks

SreenivasaRagavan,

No comments: