Hawkeye on Web Service Software Factory

As I wrote the other day, I’ve been investigating the Web Service Software Factory. The WSSF includes four guidance packages: Data Access, ASMX, WCF and WCF Security. The Data Access isn’t service specific (I’m guessing it’s also included in p&p’s other factories) so I didn’t focus on it much. I also didn’t investigate the ASMX package at all.

For the WCF and WCF Security packages, I walked through the tutorial in the documentation. The tutorial contains the usual WCF suspects such as creating a data contract, creating a service contract and implementing a service contract. While you can do these things manually, the WSSF provides wizards for most if not all these operations. This seems like overkill for some of these operations. For example, filling out the grid of data contract members was more cumbersome (for me) then just typing the values in the code file.

Also on the subject of somewhat more complex than necessary, WSSF provides wizards for building type translators. This is pretty standard stuff: given an instance of a given type, the translator returns an instance of a different type. Again, I find it faster to write the code for this directly than to individually select the matching fields in the wizard UI. Somewhere on the complexity scale between CRUD stored procedures and service data contracts is the tipping point where it’s faster and easier to just write the code than it is to manipulate the wizard UI which generates the code.

On the plus side, the WSSF includes snippets which are very convenient to use. For example, WSSF includes the WCFDataMember snippet (short name: wcfDM). It’s a lot like the standard prop snippet, but with the automatic addition of the DataMember attribute.

I had much more success with the main WCF package than I did with the WCF Security package. I wasn’t interested in the anonymous or direct authentication mechanisms, which left only two security recipes that I cared about: kerberos and x.509 certificates. Unfortunately, I couldn’t make either of these tutorials work. For kerberos, the baseline configuration works (i.e. standard wsHttpBinding with no additional configuration), but after running the “Secure a Service Using Kerberos” recipe, I get an exception that “The token provider cannot get tokens for target”. It wasn’t in me to debug the sample to figure out what that meant. For x.509 certificates, I can’t even complete the wizard – I click OK in the certificate selection dialog, but the wizard doesn’t get updated and won’t let me continue.

I really dig the new Guidance Navigator window, especially the history window, but I do have one problem with it. Is there a way to mark a recipe so it doesn’t show up in the history view? The WSSF includes some recipes like “View Service in Browser” and “Run Client” that don’t change the project state and quickly clutter up the history view. It would be great if they didn’t show up there in the first place.

I’m guessing the WSSF is designed primarily new WCF developers, so I’m not exactly in the target demographic. Many of my issues above stem from my deeper than average experience with it (though nowhere near the depth of experience some members of the community have already). But it’s a good start and I’m sure it will get better with successive releases.

Morning Coffee 20

  • Jim Gray has been missing at sea since Sunday. My thoughts are with him. (via Werner Vogels)
  • We launched Windows Vista and Office 2007 yesterday. There were parties on campus, but my office is a little off the beaten path, so we didn’t get a party.
  • WF Activity Validation is very cool, but make sure you put your activities into a separate project from your workflows. It took me a few minutes yesterday to figure this out, but the validators are invoked not only for the activities in workflows, but for the actual activity implementation itself. My validation logic is checking to ensure properties are specified and that given activities are or are not inside a transaction scope. Obviously, the activity implementation is invalid according to these rules. Also, you need to remove the Workflow.Targets import from your activity project file, as that is what invokes the activity validation.
  • A quick follow-up to yesterday’s compiling workflows post: WF appears to be fairly short on out of the box functionality, but more than makes up for it with an expansive extensibility model. It makes the learning curve longer, but it’s well worth it the trip.
  • I’m demoing the result of the proof of concept work we’ve done over the last few months today. It’s been a while since I’ve presented to any kind of audience so we’ll see how it goes.

Compiling Workflows

Scott Allen pointed out that if you need to declare top level properties in a XAML only workflow, you can subclass the root activity class, add the properties you want, then specify the custom subclass in the XAML workflow. That doesn’t really solve my problem. I’m trying to limit to activity vocabulary that the workflow author has access to. If they can specify their own custom type as the root activity of their workflow, they can also add whatever execution logic they want, which is what I’m trying to avoid.

There is an example in the Advanced Authoring chapter of Essential WF where they describe building a root activity class that generate top level properties as part of the workflow compilation process. The root activity (in the example, it’s called “SequenceWithVars”) where you can specify the top level parameters in the XAML. Here’s an example from the book:

<SequenceWithVars x:Class="Workflow1" xmlns="..." xmlns:x="...">

The SequenceWithVars type includes a custom ActivityCodeGenerator that loops thru the VariableDecls collection and adds a top-level property (via CodeDOM) for each VariableDecl instance. You end up with a workflow class that looks like this:

public partial class Workflow1 : SequenceWithVars
{
  public static DependencyProperty OrderProcConversationProp =
    DependencyProperty.Register("OrderProcConversation",
      typeof(Guid), typeof(Workflow1));

  public Guid OrderProcConversation
  {
    get
    {
      return (Guid)base.GetValue(Workflow1.OrderProcConversationProp);
    }
    set
    {
      base.SetValue(Workflow1.OrderProcConversationProp, value);
    }
  }

  //Remaining WF type declaration goes here
}

In order to use the XAML workflow with the SequenceWithVars activity, you do need to compile the XAML first using the WorkflowCompiler class. WorkflowCompiler.Compile() returns a compiled type which can then be passed to CreateWorkflow. But adding the separate compile step is a small price to pay, in my opinion. This approach lets me limit the workflows to XAML only while still allowing for top level properties which are needed in many data binding scenarios.

Morning Coffee 19

  • I find Jim Kobielus’ “SOA as 50 square miles of fungus” analogy funny and strangely compelling. The “keep in the dark and feed it shit” jokes practically write themselves. (via Joe McKendrick)
  • Politics 2.0 Rising: The number of Americans who got “most of their information” about the 2006 midterm elections was double the number from the 2002 elections.
  • Do you use external/flash drives? Do you have issues when you try to “Safely Remove Hardware” with said drive? I do, all the time. Apparently, unlocker is the answer. (via Paul Andrew)
  • How come there’s no information about LogToTraceListeners in the WF documentation? As far as I can tell, it’s not in the Windows SDK docs at all and the only reference to it on MSDN is this year-old article and this year-old blog post. I only discovered because someone on the internal WF discussion alias asked about it. I’ve added In my SSB/WF work, I subclassed the built-in SQL persistence service in order to add tracing support. If you’re developing a WF host, you need to turn this on. I find it mind-boggling this isn’t included anywhere in the official WF docs.
  • Nice to see Soma bragging about Software Factories. As he writes, our current solution – consisting of the Guidance Automation Toolkit and the DSL Tools - are really just a first step. I’m just starting to experiment with the Web Service Software Factory (WSSF). Aaron Skonnard introduces both the ASMX and WCF version in his two most recent Service Station articles.
  • Michael.NET makes Programming Promises and Ted Neward swears the Oath of the Conscientious Programmer. Why stop there? How about the Architect’s Affidavit to actually implement the shit we draw on the white board? The Technologist’s Testimony of understanding and belief in all things geeky and gadget? Come on, isn’t this just called “doing your job”? Do we really need to make promises and swear oaths to take it seriously and do it to the best of our abilities?

Morning Coffee 18

  • I’m sure glad Heroes is back. And so far, I’m liking this season of 24 better than the last couple. I especially like how they’re introducing Jack’s family to the storyline – very cool.
  • Bill Gates will be onThe Daily Show with Jon Stewart next Monday. I rarely miss an episode (though I typically watch it a day or two later via my DVR) so I’m looking forward to this.
  • Roger Sessions latest ObjectWatch newsletter is available. Roger does his usual brand of relating architectural concepts to everyday situations (this time, planning his daughter’s wedding). This one was funnier than most – especially since I have a 1 year old daughter – though I’m still waiting for one of these that doesn’t contain the words “doppio machiato”. If you’re reading this Roger, don’t worry, I am enjoying every moment.
  • Apparently, I am the keeper of obscure development knowledge on my team. My teammate Buzz was getting an error in shdocvw.dll when trying to open an XSD with the BizTalk editor. He’s on an interim build of BTS06 R2, so bugs are to be expected, but he wasn’t sure what shdocvw was, so he asked me. In case you’re curious, shdocvw is the WebBrowser control.
  • Did I mention that I left my laptop power cord at the office again on Tuesday? That’s three times in four the last five trips to my office (not counting weekends, sick days and training). My boss actually got a spare from his boss that I can leave at the house 24/7.