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.


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 @

Friday, 1 July 2011

ESB Portal unhandled exception - HTTP request is unauthorized -server was Negotiate NTLM Basic realm localhost

I have been trying to fix the below error for last couple of days , But could not get right path and I had an impression that this error is more related to Windows permissions for my ESB.Portal application. But that is not the fact.

Exception message: The HTTP request is unauthorized with client authentication scheme Negotiate. The authentication header received from the server was Negotiate,NTLM,Basic realm=localhost.

I had around 80,600 records of data on my Exception Database for 1 month of transaction. Initially when I tried for Hour , Day and week view of ESB Portal it worked fine for me but it did not work for Month view. So, it gave me an impression that MS had developed a code to restrict the usage of ESB.Portal because this is a sample version. Then I started looking at the Stored procedures used for ESB Portal but did not get any clue.

After a while I started to debug the code and I found the root cause of this issue. The issues is due to large size of data (exceptions database) been imported for the Faults Service and this is more to deal with application configuration section than database level.

You might find Warning or Error in Event log as below

Log Name : Application
Source : ASP.NET 2.0.50727.0
Event code : 3005
Event message : An unhandled exception has occurred.

Application information:
Application domain: /LM/W3SVC/1/ROOT/ESB.Portal-1-129539791417651141
Trust level: Full
Application Virtual Path: /ESB.Portal
Application Path: C:\Projects\Microsoft.Practices.ESB\Source\Samples\Management Portal\ESB.Portal\

Process information:Process ID: 13408
Process name: w3wp.exe

Exception information:
Exception type: MessageSecurityException
Exception message: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM,Basic realm="localhost"'.

Request information:Request URL: http://localhost/ESB.Portal/Faults/Faults.aspx
Request path: /ESB.Portal/Faults/Faults.aspx
User host address: ::1
Is authenticated: True
Authentication Type: Negotiate

The Fix is very simple
all you have do is Update the web.config files for both ESB.Exceptions.Service and ESB.Portal. Make sure you have done the same changes for both files. including the message size and maxarray lengths.

ESB.Exception.Service - Web.Config Changes

ESB.Portal - Web.Config Changes

Drop a comment if this article helped you to solve your problemyou can reach me @