Happy Holidays

For me at least :-). I’m off to India for my annual vacation tomorrow and will be there for Christmas and New Year. So unless I’m really bored, there wont be any posts from me for a long time.
Theres news on the BizUnitExtensions front though. I finally got some time to cleanup and reorganise the […]

Canadian Business Process/SOA Conference Documents

People have been asking, so here they are. I’ve attached all of the presentations that were presented during the recent Canadian Business Process/SOA Conference. All of the presentations from both technical days and the business day are included in the three attached ZIP files.


http://peterkelcey.com/downloads/businesspresentations.zip


http://peterkelcey.com/downloads/technicaltrack_1.zip


http://peterkelcey.com/downloads/technicaltrack_2.zip



Cheers and keep on BizTalking

Dealing with cXML based messages in BizTalk

cXML (commerce eXtensible Markup Language) is a XML based standard for communication of data related to electronic commerce. The problem from a BizTalk perspective is that they don’t publish any XML schemas (XSD), only Document Type Definition (DTD).

When trying to generate a schema based on a DTD using the functionality in BizTalk (via Add Generated Items) one ends up with a schema split of three files that really doesn’t make any sense (XmlSpy doesn’t do a very good job either …). So after a while I found Nick Heppleston schema repository! After some tweaking I actually had a cXML Order schema in the version I was looking for! Thanks Nick!

The next set of problems was to handle the lack of XML namespace and the DOCTYPE declaration that messages validating against DTD carries on top.

<div><span style="color: #0000FF; "><?</span><span style="color: #FF00FF; ">xml version="1.0" standalone="no"</span><span style="color: #0000FF; ">?></span><span style="color: #000000; ">
</span><span style="color: #0000FF; "><!</span><span style="color: #FF00FF; ">DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.014/cXML.dtd"</span><span style="color: #0000FF; ">></span><span style="color: #000000; ">
</span><span style="color: #0000FF; "><</span><span style="color: #800000; ">cXML </span><span style="color: #FF0000; ">xml:lang</span><span style="color: #0000FF; ">="en-US"</span><span style="color: #FF0000; "> payloadID</span><span style="color: #0000FF; ">="2007117.25919@Contempus"</span><span style="color: #FF0000; "> timestamp</span><span style="color: #0000FF; ">="2007-11-07T11:06:16+01:00"</span><span style="color: #0000FF; ">></span></div>

To handel these two issues I set up a receive pipeline that looked like the one below.

Remove the DOCTYPE declaration

First I created a pipeline component to remove the DOCTYPE node. It’s simple code using regular expression to find the DOCTYPE node, replace it with an empty string and return the message.

<div><span style="color: #0000FF; ">public</span><span style="color: #000000; "> IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
{
   </span><span style="color: #0000FF; ">string</span><span style="color: #000000; "> messageString </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> StreamReader(inmsg.BodyPart.Data).ReadToEnd();
   Regex doctypePattern </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> Regex(</span><span style="color: #000000; ">"</span><span style="color: #000000; "><!DOCTYPE.+?></span><span style="color: #000000; ">"</span><span style="color: #000000; ">);
   messageString </span><span style="color: #000000; ">=</span><span style="color: #000000; "> doctypePattern.Replace(messageString, </span><span style="color: #0000FF; ">string</span><span style="color: #000000; ">.Empty);
   MemoryStream memStream </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">new</span><span style="color: #000000; "> MemoryStream();
   </span><span style="color: #0000FF; ">byte</span><span style="color: #000000; ">[] data </span><span style="color: #000000; ">=</span><span style="color: #000000; "> Encoding.UTF8.GetBytes(messageString);
   memStream.Write(data, </span><span style="color: #000000; ">0</span><span style="color: #000000; ">, data.Length);
   memStream.Seek(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">, SeekOrigin.Begin);
   inmsg.BodyPart.Data </span><span style="color: #000000; ">=</span><span style="color: #000000; "> memStream;
   </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> inmsg;
}</span></div>

Set an XML namespace

Secondly I used Richard Seroter’s post on how to change the SetNSForMsg component to add a XML namespace. That’s the second component showing in the decode stage of the pipeline.

Arrow number 3 shows how the SetMsgNS exposes a property that allows us to set the namespace that we can configure per pipeline. In this case I’ve set it to http://schemas.modhul.com/cXML/1.2.014/OrderRequest__ which is the namespace of the cXML schema I’m currently working agains.

In the end we’ll have a message with the following declaration and root node.

<div><span style="color: #0000FF; "><?</span><span style="color: #FF00FF; ">xml version="1.0" encoding="utf-16" standalone="no"</span><span style="color: #0000FF; ">?></span><span style="color: #000000; ">
</span><span style="color: #0000FF; "><</span><span style="color: #800000; ">cXML </span><span style="color: #FF0000; ">xml:lang</span><span style="color: #0000FF; ">="en-US"</span><span style="color: #FF0000; "> payloadID</span><span style="color: #0000FF; ">="2007117.25919@Contempus"</span><span style="color: #FF0000; "> xmlns</span><span style="color: #0000FF; ">="http://schemas.modhul.com/cXML/1.2.014/OrderRequest"</span><span style="color: #FF0000; "> timestamp</span><span style="color: #0000FF; ">="2007-11-07T11:06:16+01:00"</span><span style="color: #0000FF; ">></span></div>

Now we’re ready to start mapping!

Project Fjord : BizTalk Mapper to require Surface in Oslo

In

recent weeks all of the buzz in the world of BizTalk has been about Oslo, the project

which encompasses updates to many products, but specifically to BizTalk Server.

As you can imagine there is a great deal Microsoft is not talking about in regards

to Oslo, but today I’m lucky enough to be the first person to announce that the details

of one sub-project of Oslo, code named Fjord.

Fjord is the code name for the Microsoft Surface integration pieces to the Modeling

commitments of Oslo. As you know, Oslo has two key components, Services and

Modeling. Microsoft Surface, the revolutionary multi-touch display and device

integration platform demonstrated by Bill Gates at CES several years ago. Obviously

the enterprise of the future will need a robust manipulation environment for the complex

models that Oslo will host, and the Oslo team is looking to Surface for those answers.

As you can see above in this as yet unreleased publicity shot, BizTalk Mapper is the

first piece of Oslo to be integrated with Surface, because unlike many other pieces

the code base for the Mapper is already complete.

I can’t disclose any of my sources, here are some of the things I’ve heard will be

included in this update:

  • BizTalk Mapper will now require a multi-touch interface and as such will require a

    Microsoft Surface table.

  • Mapping from one field to another will be accomplished by “touch and hold” on each

    field, then the link will be automatically created.

  • Scripting Functoids will now be editable in a full screen editor with intellisense.

  • Multiple fields can be touched per side of the schema, and when a destination is touched

    an analysis engine will suggest possible functoid combinations. For instance,

    touch “FirstName” and “LastName” from the source, then touch “Name” on the left and

    the Mapper will suggest the use of a Concatenation functoid.

Further details are sketchy, and as I’m under an NDA with Microsoft there is little

more I can say at this time, but needless to say I think we can expect a lot more

from Project Fjord in the future. I’ll post more details in the future as I

can.


Tim Rayburn is a consultant for Sogeti in the Dallas/Fort

Worth market.

Sydney Dec 2007 BizTalk User Group – RFID Services

Just got this email from the user group…. get to it if you want to learn about MS RFID services…. (but more importantly, play some XBOX!!!!).

 

Hi Chris Vidotto,

Welcome to our last meeting of the year.
I know its Christmas soon and we’re all checking out the best gifts to get…….well I got thinking….. why don’t we have a ‘try before you buy’ session with a xbox360/media extender etc??
We also need to make it Educational as well, so here’s the line up for next Dec 5th.

Where:
Microsoft, North Ryde
1 Epping Road

When:
6pm – Beer + Pizza
6.30pm – Kick off
Dec 5th 2007
(Add to calendar)

1. Introduction to BizTalk RFID Services – 101
Presenter: Scott Scovell
– Scott has extensive experience in EDI and BizTalk RFID Services.
He has recently been part of a team that has created the Microsoft BizTalk RFID Courseware, and is always eager to share his knowledge and lend an ear.
Session Outline:
BizTalk RFID Services is new to the BizTalk Product Suite, being able to enable production lines, track and trace and various other scenarios with RFID technology is key for companies to maintain a competitive edge.
This presentation will cover:

1. Setting up and configuring BizTalk RFID Services
2. Plugging in a real RFID Reader Device
3. Reading/Writing Tags within a BizTalk RFID Process.
4. Extending and customising RFID Services.
2. XBOX 360 ‘Christmas Evaluation’ Session
Come along and road test some XBOX 360’s with us for Christmas!
We’re now just shy of 80 registered members – you guys are great! Well done and keep all the feedback coming.
I’m looking forward to a great meeting and hope to see you all there.

Many thanks,

Mick.
p.s. Let me know if you’re coming (so I know how many xbox controllers to put out)

Updating the Retry Activity – adding timed interval

I recently created a retry activity that I’ve been wanting to write for some time now, and had a few features that I wanted to add. I was teaching a class a couple of weeks ago and took the opportunity to add a retry interval to the activity.  The activity is designed as a composite activity which can retry its child activities if it detects that a fault/exception has occurred.  Rather than retrying immediately, I wanted the consumer of my activity to be able to specify a TimeSpan indicating how long to wait between retry attempts.

The simplest part was adding a property that allowed people to specify the interval. 

private TimeSpan retryInt;

public TimeSpan RetryInterval 
{
    get { return retryInt; }
    set { retryInt = value; }
}

 

The next step was to actually use this information.  When the child activity closes, my Retry activity checks if it faulted and then needs to reschedule the child activity for execution.  With the interval, I need a way to wait for a duration and then schedule the activity for execution.  Since my workflow could be persisted during this interval, I have to use a mechanism that will both support passivation, and allow for the workflow to be resumed automatically when the duration has been reached.  To support this I used the same mechanism that the delay activity uses, which is to create  timer subscription and then wait for an event signaling the time has expired. 

In my event handler for closing child activities, if I determine that I should retry the child activity, I use the following code to 1) create a new workflowqueue where the timer can signal completion, 2)register for data arriving on the queue, 3) create a TimerEventSubscription with my duration and my queue information and 4) add my timer subscription the collection on the workflow. 

 

DateTime expires = DateTime.UtcNow.Add(RetryInterval);
SubscriptionID = Guid.NewGuid();
thisContext.GetService<WorkflowQueuingService>().CreateWorkflowQueue(SubscriptionID, false).QueueItemAvailable += new EventHandler<QueueEventArgs>(RetryActivity_QueueItemAvailable);
TimerEventSubscription subscription = new TimerEventSubscription(SubscriptionID, WorkflowInstanceId, expires);
TimerEventSubscriptionCollection timers = GetTimerSubscriptionCollection();
timers.Add(subscription);

 

The GetTimerSubscriptionCollection simply grabs the collection from the parent workflow by recursively climbing the parent hierarchy. 

 

private TimerEventSubscriptionCollection GetTimerSubscriptionCollection()
{
    Activity parent = this;
    while (parent.Parent != null)
    {
        parent = parent.Parent;
    }
    TimerEventSubscriptionCollection timers = (TimerEventSubscriptionCollection)parent.GetValue(TimerEventSubscriptionCollection.TimerCollectionProperty);
    return timers;
}

 

Finally, I have the event handler for when data arrives on the queue for the timer.  I simply empty and delete the queue, then begin my next iteration on the child activity. 

 

void RetryActivity_QueueItemAvailable(object sender, QueueEventArgs e)
{
    ActivityExecutionContext ctx = sender as ActivityExecutionContext;
    ctx.GetService<WorkflowQueuingService>().GetWorkflowQueue(e.QueueName).Dequeue();
    ctx.GetService<WorkflowQueuingService>().DeleteWorkflowQueue(e.QueueName);

    BeginIteration(ctx);
}

 

So adding a retry interval turned out to be pretty simple and I was also able to provide a good example of how you can put your own delay into your activities.  In a later post, I’m going to talk about the other issue I had to manage which is how to deal with exceptions and control whether or not my Retry activity got put into the faulting state. 

 

The updated retry activity can be found here, and has been updated for Visual Studio 2008.  If you want the updates for 2005, just download the original, and then copy the class file for the retry activity from the new project.  I didn’t use any new features of 2008, just updated the project and solution files, so it should work fine. 

We Are Microsoft – Team Sogeti

The

South Central Developer Guidance Council is hosting an event, being organized by the

fabulous Toi Wright, called We

Are Microsoft. This event is a developer competition where teams of developers

create projects for charities over the weekend of January 18th-20th, 2008.

If you’ve not looked into this event, you should. You should get a group of

developers together and compete. Why?

Because Team Sogeti is going to school you, fool, that’s why! Sogeti will be

fielding a team of extraordinary talent to deliver for whatever charity we end up

paired with, and we’re ready to crush the competition. The exact members of

the team are still evolving, but we will be there, and will be bringing our A-game.

Think you’ve got what it takes to compete with us? Great … Bring It!


Tim Rayburn is a consultant for Sogeti in the Dallas/Fort

Worth market.

Visual Studio 2008 InstallFest

Chris Koenig, our Local Developer Evangelist

has a big event coming up, here are some details:

To celebrate the RTM of Visual Studio 2008, Microsoft is teaming up with some of the

local area User Groups to throw a set of Holiday Party InstallFests. We’ve got

3 of them scheduled for South Central District:

These holiday parties will feature food, drink, fun – including several Xbox 360s

in HD with some of the latest games, fellowship and a chance to install the RTM bits

of Visual Studio 2008 along with your friends! In fact, EVERYONE THAT REGISTERS

FOR AND ATTENDS THE EVENT IN PERSON WILL RECEIVE A FREE COPY OF VISUAL STUDIO 2008

PROFESSIONAL IN THE MAIL ONCE IT’S AVAILABLE! As an added bonus – if

you install Visual Studio 2008 on your computer during the event, we’ll give you a

free Visual Studio T-Shirt! So – no sneaky register-for-the-event-and-then-not-show-up

action – you must be present to win 🙂

Since we’re giving away free product, we’ve had to put a cap on registrations – so

register now and make sure you attend to get your free copy of Visual Studio 2008

Professional. If registrations are full, the waitlist should be enabled, so

get on it. If you don’t make it on the registration or waitlist list, don’t

fret – walk-ins are totally welcome, and we’d love to have you join us at the party!

If there is any product left over after all the registered and wait-listed folks get

theirs, you’ll be next in line to get one 🙂

Q&A:

Q: What version of Visual Studio will I get, and how will the free version

upgrade work?

A: You will be installing a copy of Visual Studio 2008 Professional

Trial Edition at the event. This is a specially created 90-day evaluation of

VS08Pro – it is NOT the same thing that is available today from Microsoft Downloads.

Once you receive your free copy of Visual Studio 2008 in the mail, you will be able

to enter the product key from the packaging into VS08 and “unlock” it. The unlocking

process will only work for the PRO trial edition that you get at the InstallFest –

the version from Microsoft Downloads or MSDN will NOT be unlockable and will require

an uninstall/re-install to get the proper version installed.

Q: Isn’t Visual Studio 2008 RTM already publicly available? Why

do I need to come to this party?

A: Several reasons – first, the opportunity to have some fun over the

holidays with your local user groups! Second, we are giving away FREE copies

of Visual Studio 2008 Professional to registered attendees in the mail following the

product launch.

Q: Do I have to bring my laptop to the event?

A: No, you don’t. But – if you install the bits at the party, we’ll give

you a free T-shirt

Q: What if I don’t have a laptop – can I bring my Desktop? Will

there be room/power?

A: Yes! Please do – we’re looking for volunteers to bring their

monitors + keyboards + mice to the event so that not everyone else needs to.

If you’re interested in helping us this way, please let me know.

Q: Can I bring a friend?

A: Absolutely! Bring 2! Just remember that you have to

be registered, or on the wait list, for a chance to win free product.

Q: Does this InstallFest party cost anything to attend?

A: Nope – it’s absolutely FREE to all attendees!

Q: Does this replace the normal .NET User Group meeting in my city?

A: Yes – there aren’t any plans to have additional meetings, but there

will be plenty of .NET conversations going on around the party, I’m sure 🙂

Q: I can’t go to this event – can I still get a free copy of Visual Studio

2008 somewhere else?

A: There are several other events coming up that will give you additional

chances at getting free product including the next round of DevCares events,

the “official” product launch events starting at the end of February, and some post-release

Community Launch events starting in March (more on that in a future post).


Tim Rayburn is a consultant for Sogeti in the Dallas/Fort

Worth market.