Amit 的个人资料All about BizTalk Server...照片日志列表 工具 帮助

日志


3月15日

Integrating BizTalk Server 2006 R2 with WF & WCF

With the release of 3.0 there are some talks on the future of BizTalk server, how we will be integrating BizTalk with new technologies like WF and WCF in 3.0?

And so Microsoft is coming up with BizTalk Server 2006 R2. In this article I will be focusing on some of the new features of BTS 2006 R2 which helps us to integrate BizTalk Server R2 with 3.0. 

These are some good article on When to use "Windows Workflow Foundation" and when to use "BizTalk Server" ?

I am putting here a basic example in which BizTalk server is integrated with 3.0 (WF and WCF).

BizTalk Server 2006 R2 & Windows Workflow Foundation (WF)

There are various ways in which we can communicate b/w BizTalk Server 2006 R2 and Windows Workflow Foundation.

  1. Hosting WF inside BizTalk Server
    1. Create the WorkFlow in Windows WorkFlow foundation
    2. Call the Workflow from the Assembly
    3. Use the Hosting Assembly (Class) in the BizTalk Server
  2. Exposing WF as a Web Service hosted inside IIS
    1. Create the WF
    2. Publish rge WF as a Web Service
    3. Call the WS from the BizTalk using SOAP, http adapter
  3. Hosting WF inside WCF Service
    1. Create the WF
    2. Host the WF inside the WCF Service
    3. Call the WCF Service from the BizTalk using WCF adapter
  4. Consuming an Orchestration exposed as WS in WF
    1. Create an Orchestration and expose it as a WS
    2. Consume the WS as a simple WS in WF 

Hosting WF inside BizTalk server  

This option provides the simplest of the option to call WF from BizTalk.  

First, create any Workflow in Windows Workflow foundation. Don’t forget to strong name the assembly as we have to put it in the GAC (BizTalk picks dll’s from GAC). This WF assembly now needs to be called from a class which will then be used in the BizTalk.

In this class just create the Workflow Runtime, create an instance of the WF and start it.  

So the flow of development will be:  

WF-à Class--à BizTalk Server  Orchestration

Also, if you want to pass any parameters to WF from BizTalk, the flow will be like this  

BizTalk -à Class-à WF  

As WF is executed in an asynchronous manner, you cannot pass the parameters back to the BizTalk in a synchronous manner, for this what you can have do is,

First call the class from the Expression box in BizTalk. When ever the WF will complete, it will dump the information at Ftp, File, MSMQ etc and then have a Receive shape in BizTalk polling at the required location. You will have to consider Correlation and Sequential Convoy for this  

The following code an extract of the code which is ised in the Class

 

private WorkflowRuntime wr;  

if (wr == null)

{ 

    wr = new WorkflowRuntime(); 

    wr.StartRuntime();

}

//Parameters passed from BizTalk --> Assembly --> WF

Dictionary<string, object> parameters = new Dictionary<string, object>();

parameters.Add("ProjectID", ProjectID);

parameters.Add("ProjectName", ProjectName);

parameters.Add("ProjectLocation", ProjectLocation);

 

WorkflowInstance instance = wr.CreateWorkflow(typeof(GatherComponentsWorkFlow.MaterialsNeededForPlant), parameters);instance.Start();


Exposing WF as a Web Service hosted inside IIS

 

First create the WF. You will be using some specific activities for exposing your WF as Web Service like WebServiceInput, WebServiceOutput. Publishing the WF as a WS is not that difficult as Microsoft has provided an option to publish. After publishing the WS, you can always use this WS in any application like ASP.NET, Windows Application and off course our BizTalk Orchestration also using SOAP, HTTP adapter.

This option is better as the WF then can be used by many application, and not only BizTalk. Also you can always scale the Web Server architecture.

This option has some advantages over the previous one, as we can take the advantage of Load Balancing Servers for the Web Service also. 

 

 

BizTalk Server  2006 R2 & Windows Communication Foundation (WCF) Service

Microsoft is doing a lot of work on there WCF framework. They are marketing it as the technology for future.

And BizTalk is also not untouched from WCF. Microsoft is adding the following features in the BizTalk 2006 R2

  1. For Conusming WCF Service BTS 2006 R2 will ship with a list of various built in adapters for the WCF which will support the following type of bindings:
    1. WCF-BasicHttp
    2. WCF-Custom
    3. WCF-CustomIsolated
    4. WCF-NetMsmg
    5. WCF-Net NamedPipe
    6. WCF-NetTcp
    7. WCF-WSHttp
  2. To expose BizTalk Orchestrations/Schemas as WCF Services the following features are added to BTS 2006 R2
    1. A option in added t o the tools menu in VS "BizTalk WCF Service Publishing Wizard"

 

 

 

There are still some issues on integrating BizTalk Server and Windows Workflow Foundation.  

  1. How can we integrate the tracking data in BTS and WF?
  2. Tracking data in WF is stored in SQL Server in a separate Db just as BTS.
    1. But I think there should be some sort of difference in that?
  3. Can we some how use HAT to have a consolidate view for both BTS and WF?
  4. I think Microsoft should be doing some thing to integrate these?
  5. Can we some how use BAM across WF and BizTalk for over all monitoring the Business?
  6. Yes I know BAM API’s is a good option, but can’t we do this with out using it?
  7. Just like in BizTalk from Tracking Profile editor?
  8. Is Microsoft going to provide something like BAM in WF?
  9. What’s the future of BizTalk with the release of WF?
  10. Will Microsoft be pushing WF?
  11. Don’t think so, as at present both the things are meant for different levels

 

BizTalk a Server product is to integrate diverse applications (that’s why there are so many of those adapters coming every release). Also the scalability which BizTalk provides can’t be compared with any thing else.

As far as WF is considered, it can be used in small workflows within ASP.NET, Windows applications, and as a sub process to BizTalk workflows.

Some good links on when to consider WF and when BTS

  1. http://geekswithblogs.net/bloesgen/archive/2005/10/09/56481.aspx
  2. http://blogs.msdn.com/scottwoo/archive/2005/10/10/479331.aspx
  3. http://blogs.msdn.com/irenak/archive/2006/11/29/sysk-249-choosing-the-right-microsoft-integration-technology.aspx
  4. http://pluralsight.com/blogs/matt/archive/2005/09/14/14818.aspx
  5. http://blogs.msdn.com/lamonth/archive/2005/09/14/466222.aspx

 

2月23日

Redefining Workflows with Microsoft’s Windows Workflow Foundation

 
With the go live of the 3.0, Microsoft has come up
  • Windows Workflow Foundation
  • Windows Communication Foundation
  • Windows Presentation Foundation
  • Windows Card Space

You can download these from here

One of the architects asked me to give him an overview of WF, and here it is an extract of that…

In this article I will be talking about the Windows Workflow Foundation (WF) and its various features. This will provide a bird eye view of the technology.

Why WF, why not WWF?

There are a lot of talks around, of the new workflow model which Microsoft has come up with. Some of the good features of WF are:

Designer Features in Visual Studio

    • The design IDE is inside visual studio, for this there are VS extensions for WF from Microsoft, you can get them here.
    • As always, the IDE is very good, helpful for the developer, toolbox with most of the activities. Drag and Drop from the Toolbox and ready to go.

Learning Curve

    • As always with any new technology, there is some sort of learning curve involved.
    • Even if you have some BizTalk experience, you will find some difficulty in getting started with the technology.
    • Especially at every instance you have to create interfaces and use them. It’s good and makes it more generic.
    • In short it will take at least 40 hrs (5 working days) of training to get hands on with WF.

Features provides by WF

 

    • Types of Workflows
        • Sequential
        • State Machine

This is different from BizTalk, in which you can only create sequential workflows.

    • Web Services support
        • Consuming Web Services
            • For consuming WS, WF provides various activities like
                • InvokeWebService
                • Just give the URL of the WS and provide the name of the method and parameters to pass. Done.
        • WF Exposed as Web Service
            • For exposing a WF as a WS, WF provides activities like
                • WebServiceInput
                • WebServiceOutput
                • WebServiceFault
    • Error Handling in WF
        • Activities provided in WF for Error handling are
            • SynchronizationScope
            • CompensatableTransactionScope
            • TransactionScope
            • Throw
            • Terminate
            • Suspend
    • Create Custom Activities
        • Just like custom controls, we can also make custom activities in WF, Activities can be of two type
            • Primitive : Made from scratch
            • Composite : Built from other existing activities
        • You can also change the look and feel of the activities.
    • Tracking service
        • Window Workflow Foundation provides a SQL Server based tracking service
        • You can track Workflow Events, Activity Level Events and User Tracked events. But I don’t think there is something as HAT as of now. You can always go and create this
    • State Persistence in WF
        • WF uses SqlWorkflowPersistenceService for this, which internally used SQL Server database.
    • Business Rules
        • There are some custom activities which are provided out of the box in WF for Rules
            • ConditionedActivityGroup
            • Policy
            • If-Else
        • You can also call BizTalk Rules from WF
            • There is an article on this from Matt Milner. You can see it here
    • Hosting WF
        • WF in windows console application
        • WF in an ASP.NET application
        • WF exposed as WS i.e Host the WF from WS in IIS.....Provides the scalability of the Web Farm architecture
        • Hosting WF from BizTalk
            • A method call within an expression shape (Problem with the scalability architecture)
            • Consuming a WS hosting a WF workflow
        • Host a WF from WCF web service
    • Share Point Server with WF

Some Use full links on WF