Step by Step: Working with Content Based Correlation in Workflow 4.0

Don’t miss the screen cast video on this same subject available at Content Based Correlation in Workflow 4.0

Content based correlation is used when you send a message out of a long running workflow and need to get a response back later into that same workflow using information contained inside the original message.  In this case, the correlation needs to be stored and made available to match the response message.

Content based correlation is easy to set up and use inside Windows Workflow 4.0.  At a high level you need to do the following:

  1. Create a Correlation Handle variable to use for the correction
  2. Set up this variable and xpath on the Send Activity
  3. Set up this variable and xpath on the Receive Activity

It is that easy! 

Lets take a look at this process step by step.

First, set up a new Variable inside the workflow.  In the picture below, the variable is named OrderCorrelation. 

Using the Type Picker and the Search box on the top right, search for CorrelationHandle.  Select the value under the WorkflowServiceModel as seen below.

Now we use this variable on the Send Activity that needs to set up the correlation.  Select the Send Activity and press F4.  When the properties window opens, go to section 4 – Send Message Correlation.  Here we need to set three values.  First, set the variable in the Correlation Handle box and then select the correct endpoint from the drop down as seen below.

The third value to set on the Send Activity is the XPath values to use for the content based correlation.  Below, we set up an OrderIdQuery with an XPath of //temp:OrderId.  OrderId is the variable name of the value in the output message we want to correlate on.

When it is all done, the Send Message will look like the picture below.

The same process is followed on the Receive Activity.  Make sure to use the same Correlation Handle.  The end result of the Receive Activity is shown below.

 

And you are done!  It is that easy to set up content based correction inside Workflow 4.0. 

ESB Guidance 2.0 (CTP)

ESB Guidance 2.0 (CTP)

There’s an announcement around for the ESB Guidance 2.0 CTP (October 2008). It’s good to know that this is already getting worked on to have new features and work with the upcoming BizTalk Server 2009. The strange thing is that I can’t actually find the download anywhere: it’s not at Codeplex, and I can’t find it at Connect.

According to the post, the new features are:

  • Alignment with Microsoft BizTalk Server 2009 ( Beta )
  • ESB Configuration tool
  • Centralized itinerary store
  • Itinerary resolver components
  • Itinerary forwarder pipeline component
  • Itinerary selector pipeline component
  • Itinerary designer
  • Centralized configuration uses Enterprise Library 4.0 Configuration Block
  • Centralized caching uses Enterprise Library 4.0 Caching Block
  • Multiple service invocation using both messaging and orchestrations
  • Itinerary BAM tracking
  • Improved ESB Core engine and itinerary execution

I hope the installation process is improved and that non-US regional settings are supported. Those were a huge barrier to adoption of the ESB Guidance, on my view.

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

TechED US and PDC in LA again!

TechED US and PDC in LA again!

So its already been announced that TechED US will be in LA (where I happen to live
:)) in May, and PDC again in November.  Shannon and I couldn’t be happier.

I did here a lot of complaints though from people who feel like Downtown LA is kind
of boring in the evenings.  And well – I can’t really argue there,  there
isn’t that much going on. 

Three tips for those of you coming to either event in 2009:

 

1) Leave Downtown!  I know cabs are expensive – but the Metro line goes to Hollywood
from very near the convention center.  Hollywood can be fun (if a little weird)

2) Go to Little Tokyo.   I tried to tell everyone I could that the thing
to do in Downtown LA at night is to head to Little Tokyo – there are great places
to eat, Karaoke, and good bars.  Check it out. http://maps.live.com/default.aspx?v=2&FORM=LMLTCC&cp=34.047006~-118.251085&style=r&lvl=15&tilt=-90&dir=0&alt=-1000&scene=33819618&phx=0&phy=0&phscl=1&encType=1 
(Little Tokyo in the upper right corner)

3) See http://la.eater.com/archives/2008/11/19/plywood_tracking_la_live_restaurants_opening_soon.php
This is all right next to the Convention Center, so by the time TechEd rolls around
– there will be good massed produced fun to be had right downtown (I still recommend
Little Tokyo for un-produced fun, but I do like the Yard House quite a bit :)).



Check out my new book on REST.

Date Converter functoid

Hi all

I have added a new functoid to the collection of functoids I am building. This time,
I have programmed a functoid that converts between different datetime formats, which
comes in handy when mapping between two schemas that have date elements, that require
different formats of the date.

You can find version 4 of my functoid collection at http://www.eliasen.eu/DownloadSoftware.aspx



eliasen

Integrating SharePoint 2007 and jQuery [Part One]

In the first part of this article I’ll talk about how you can enable the jQuery JavaScript library in SharePoint 2007 sites and pages. The second part of this article will focus on using jQuery in SharePoint 2007 sites and pages.

When I was at PDC’08, I attended a session about the jQuery JavaScript library (watch online). A few weeks before that Scott Guthrie announced that Microsoft would support, and even ship jQuery together with Visual Studio, along with Microsoft’s own AJAX implementation: ASP.NET AJAX. If you’ve never heard about jQuery, I defenitly recommend you to to check it out, there are some great tutorials available. The defenition of jQuery reads: “jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.” In my opinion jQuery is great because it simplifies a lot the JavaScript that you have to write if you’d like to do fancy AJAX stuff, selecting HTML elements for example is a breeze. Secondly jQuery has a big community that develops plugins for various scenarios. I already wrote and talked quite a bit about integrating ASP.NET AJAX with SharePoint 2007, so let’s check out how you can integrate jQuery as well!

First things first: you need to get the jQuery library from the official website. It comes in three varieties: uncompressed (with debug information, use it while you develop), packed (smaller, use it for production) and minified (needs to be uncompressed at the client, so slower but even smaller). The jQuery library is just a JavaScript (JS) file, so it can be loaded from any web page (html, aspx, etc). If you’d like to have IntelliSense when writing code in Visual Studio 2008 for jQuery (highly recommended of course), you need to download a Visual Studio hotfix. Now you’re good to go to make use of jQuery in your development environment.

Before I show you some things you can accomplish with jQuery in your SharePoint sites, let’s think about how we can make the jQuery library available on the ASPX pages of our SharePoint sites. There are two things that need to be done: first the JS file (the library itself) should be deployed to a location which can be accessed by SharePoint pages, secondly the library should be loaded by the SharePoint pages.

Deploying the jQuery JS file is quite easy: I recommend deploying it to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS folder on every Front End Web Server of your SharePoint Server Farm. By doing so, the file can be loaded by making use of the URL http://yoursite/_layouts/ jquery-1.2.6.min.js or http://yoursite/subsite/_layouts/ jquery-1.2.6.min.js, since the _layouts part of the URL always points to the LAYOUTS folder in the 12-hive.

Making sure that SharePoint pages will load the library can be accomplished in a couple of ways:

1) Load the library in the page you want to use it
This can be done very easily by adding for example a Content Editor Web Part to the page (or modifying the page with an editor), containing the following HTML:

<script type=”text/javascript” src=”http://weblogs.asp.net/_layouts/jquery-1.2.6.min.js”></script>

2) Add the script to the master page
You can add the same script tag to the master page that is used by your SharePoint sites as well, typically in the HEAD tag:

<HEAD runat=”server”>
    . . .
    <script type=”text/javascript” src=”http://weblogs.asp.net/_layouts/jquery-1.2.6.min.js”></script>
    . . .
</HEAD>

This may look very easy, but remember modifying out-of-the-box files in the 12 hive is typically not supported. So if your sites use the default master page, this is a no-go. Additionally it could be that you’ve to multiple master pages (e.g. system and site master pages) which complicate the situation.

3) Use the AdditionalPageHead Delegate Control (my favorite!)
By providing the contents for the AdditionalPageHead Delegate Control that is used by all the out-of-the-box master pages, you can make sure the the jQuery library is loaded by all the SharePoint pages. The AdditionalPageHead Delegate Control allows multiple controls to provide contents, so it’s a great extensibility scenario. To accomplish this you need to build a web user control (ASCX file), that contains the script tag to load the jQuery library:

<%@ Control Language=”VB” ClassName=”jQueryControl” %>
<script type=”text/javascript” src=”http://weblogs.asp.net/_layouts//jquery-1.2.6.min.js”></script>

There is no code-behind file required. This control needs to be deployed to the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES folder on the hard drive of every SharePoint Front End Web Server. Additionally you need to have a feature that will add the control to the AdditionalPageHead Delegate Control, the feature’s manifest will look like this (assuming the control is named jQueryControl.ascx):

<Elements xmlns=”http://schemas.microsoft.com/sharepoint/”>
  <Control
    Id=”AdditionalPageHead”
    ControlSrc=”~/_controltemplates/jQueryControl ascx />
</Elements>

The feature can be scoped to any level, when it’s activated on a certain level, all the pages will automatically have the script tag in their HEAD tags. Pretty cool, isn’t it?

You can do all of this manually, but it’s of course much nicer to package the jQuery library JS file, the user control and the corresponding feature into a SharePoint Solution (WSP). I’ve created a sample Solution file, that contains a feature scoped to the Web level so the jQuery library can easily be deployed and enabled or disabled per SharePoint site. There is also an installer available that guides you through the installation process by making use of a nice wizard. You can find the solution, installer and sources as a part of the SmartTools project on CodePlex (direct link to the releases).

Ok, now we are ready to make use of jQuery in our SharePoint sites, in the second part of this article I’ll show you some cool stuff you can do by integrating jQuery with SharePoint 2007.

Technorati Tags: sharepoint,wss,moss,jquery,smarttools,ajax,aspnetajax

Windows Live Writer

Hi all

Recently, I started using Windows
Live Writer in large scale. Until then, I used the built in editing functionality
of dasBlog, which is my blog software.

I must say, I love it!

Now, don’t get me wrong, I have no other software products that do what Windows Live
Writer does to compare it with, so there might be other and better products out there,
but I am SO happy with not using the built in functionality of dasBlog anymore, I
just had to tell you all 🙂

The obvious advantages for using Windows Live Writer over the built in functionality
in dasBlog are the possibility to work offline, either if my blog is unavailable or
if I am in a train, and so on.

But also, I am quite fond of the way I can have multiple entries as work in progress
at the same time, edit existing posts, etc. And all in a thick client on my laptop.

Really, I am quite thrilled 🙂 And I encourage all to use it… There is a newer
version out than the 2008 that I am using, but it is a beta version, and some people
have reported issues with using it against dasBlog, so I will wait a bit before I
try that version.



eliasen

I’m on MSDN’s Endpoint.TV

During a recent trip to Redmond, I was interviewed by Ron Jacobs for his Endpoint.TV series.

I had just been shown a bunch of new things, was full of excitement, and we had a great chat about models, clouds, workflow… all my current hot-buttons 🙂

http://channel9.msdn.com/shows/Endpoint/endpointtv-WCF-and-WF-40-First-Look-with-Brian-Loesgen/

Enjoy!

Technorati Tags: Oslo,Cloud Computing,WF,Workflow

SharePoint, Silverlight, and Virtual Earth

SharePoint, Silverlight, and Virtual Earth

I’ve been doing a number of project lately for the SharePoint and SharePoint online
teams.  Mostly around services and integrating SharePoint services with Silverlight. 
One of these projects was pretty cool so we decided to put it up on CodePlex – http://www.codeplex.com/sharepointsilverligh 
(yes I can spell Silverlight – CodePlex seems to not like long project names in its
URIs ;-)).

The basic idea is a Silverlight control that coordinates data between a SharePoint
List (using the SharePoint List Web Service) and the Virtual Earth map control in
the browser.  You can point it at any list that has columns containing longitude
and latitude data (it should be pretty easy to modify it to use addresses and do a
query of Virtual Earth as well).  It can also be pointed at a Picture list, so
the picture can show up on the pushpin "tooltip".  Enjoy and let me
know what you think.



Check out my new book on REST.