Showing posts with label ESB Toolkit Invoke Consume Call WCF Service Request Response Two-Way. Show all posts
Showing posts with label ESB Toolkit Invoke Consume Call WCF Service Request Response Two-Way. Show all posts

Thursday, 7 July 2011

How to call WCF Service using ESB ToolKit

This example aims to describe the key design model for Consuming WCF Service and send the WCF Response to any local folder.
IService.cs


Service.cs


Web.config
I knew this configuration is simple and everyone knows the basic config settings. However I am giving this example because, I have seen many problems while calling wcf service at Itinerary design resolvers.
If you have more complex configuration, then you cannot use existing Wcf-wsHttp adapter instead you must go for wcf-Custom adapter
Here I am trying to use existing wcf-wshttp adapter.



After successful creation of WCF Service build and execute it and test with
WCF-Test Client before you consume the service in BizTalk.

If everything is fine , then use BizTalk Add generate items wizard to extract the WCF xsd schemas.
Steps to generate schemas using BizTalk add Generate Items wizard
Click on BizTalk solution and right click and select
Add Generated Items -> Click Consume WCF Service->
Metadata Exchange(MEX)Endpoint -> enter your WCF service URL
and click Ok to generate the XSD Schemas at your BizTalk application.

Here I am giving you my solution explorer for sake of more clarity


Create maps from Createorders to WCF Request and wcf-Response to OrderSummary (output) schema.
Hope you can create basic schemas by observing this maps. Hence I am not providing another steps to creating OrderSummary and CreateOrders Schemas.




Create a new Biztalk Application and add two send ports and define the properties mentioned below
Name : ESBConsumeWCFService.TwoWaySendPort
Type : Two-Way Port
SendPipeline : ItinerarySendPassthrough
ReceivePipeLine :ItinerarySendReceive
Filter Properites:
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == TwoWayOrderSubmit And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging And
Microsoft.Practices.ESB.Itinerary.Schemas.IsRequestResponse == True

Name : ESBConsumeWcfServiceTest.WCFOutput.FILE
Type : One-Way Port
SendPipeline : ItinerarySendPassthrough
Filter Properites:
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceName == OneWaySend And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceState == Pending And
Microsoft.Practices.ESB.Itinerary.Schemas.ServiceType == Messaging

Configuring Receive Port
Receive Port : ESBConsumeWcfServiceTest.ReceiveNewOrder
Receive Location : ESBConsumeWcfServiceTest.ReceiveNewOrder.FILE
Type : FILE (Enter local folder path to pick up the input file)
ReceviePipeline : ItinerarySelectReceiveXml
ReceviePipeline Properties:
ItineraryFactKey : Resolver.Itinerary
ResolverConnectinString :ITINERARY:\\name=ESBConsumeStockService;


Finally Itinerary Design
Here is the sample for consume WCF service using ESB Toolkit 2.1 Itinerary design. No need of suing Orchestration process






Properties for Get Endpoint config Static Resolver






Drop a comment if this article helped you to solve your problem
also you can email me for complete solution zip file to download
you can reach me @ raj.webjunky@yahoo.com