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

16 comments:

  1. Thank you for such a nice article. It is exactly what I am looking for :)

    -Sreeni

    ReplyDelete
  2. Remarkable! Its in fact amazing piece of writing, I have got
    much clear idea concerning from this post.

    Look at my webpage - novoline merkur

    ReplyDelete
  3. Thank you for this nice article. Is there a way you could share the properties of the shape with the name "Invoke Endpoint". I know it has an off-ramp extender but I am lost as to where one would refer the request-response port, within the itinerary. It is not showing up on my drop-down of send ports, within the itinerary. Also, where is the IsRequestResponse set to true? Both at the itinerary designer level and the "Invoke Endpoint" level? Thank you, and have a nice day. Warm regards, Chandrasekhar G

    ReplyDelete
    Replies
    1. Hi Chandrasekhar ,
      I received your email for requesting for complete solution. Please check you email for reply.

      Thanks
      Raj.Webjunky

      Delete
  4. Nice Article!!! Can you send me as well complete solution?

    ReplyDelete
    Replies
    1. Hi Viredra,
      Sorry for late reply ,if you are still looking for source code pleas send a an email to raj.webjunky@yahoo.com
      Thanks

      Delete
  5. Hello,

    Can you send me your sample ?
    I've send you a mail (gladice.gladius) last week :-)

    Thans in advance

    ReplyDelete
    Replies
    1. sorry Gladice, Are you still looking for solution ? if yes then drop an email to me.

      Delete
  6. Hi,

    Nice example.
    Can you please send me the sample (singlaashwani1980@gmail.com)?

    Thanks in advance.
    Regards,
    Ashwani Singla

    ReplyDelete
    Replies
    1. Hi Ashwani, If you are still looking for solution please drop an email.

      Thanks

      Delete
    2. Hi Raj,
      Thanks for this post. This post gave me some idea about how to use the itineraries for consuming the web services.

      Can you please send me the sample to vimal@vernal.is (or) vimalcse7@gmail.com

      Delete
  7. Hi Raj,
    Thanks for this post. This post gave me some idea about how to use the itineraries for consuming the web services.

    Can you please send me the sample to vimal@vernal.is (or) vimalcse7@gmail.com

    ReplyDelete
    Replies
    1. Sorry for the late, I sent you an email with details.
      Thanks
      Raj

      Delete
  8. Hi,

    Could you please share me the sample.

    Connectgirish@yahoo.in.

    Stuck up with similar issue.

    Thanks
    Girish

    ReplyDelete
  9. hi,
    please share the sample.
    vishal.b@yahoo.com

    ReplyDelete
  10. Thank You and that i have a dandy provide: How Much Are House Renovations Stardew Valley home renovation burnaby

    ReplyDelete