Solution to Error in BizTalk 2006 R2 WCF Service Consuming Wizard

I’ve recently been working with an existing WCF service that does not properly export its metadata.  [Note to WCF service developers: when testing your service, you need to explicitly test metadata export along with the actual service functionality.  There are many ways to break it.] The Service Model Metadata Tool (a.k.a svcutil.exe) can connect to the service for metadata download (svcutil.exe /t:metadata <url>), but the result is a brief WSDL that contains no type information (no messages, no bindings, no schema at all).

The company that built the service uses the Web Services Contract First (WSCF) tool from Thinktecture to generate serializable .NET proxy classes and WSDL files from XML schemas.  The service contract is defined by the XSD’s.  [Note: WSCF does not directly support WCF.]  Since we can’t download metadata from the service, the developers gave us a copy of their XSD’s and WSDL file (the latter generated by WSCF).  Should be no problem to consume them.

In my case the service client is BizTalk Server 2006 R2, using its built-in support for WCF.  BizTalk can generate a proxy (message and port types and schemas) for a service using the WCF Service Consuming Wizard.  In a great example of unfriendly UI design, to reach this tool you must first have a BizTalk project open.  Right-click the project and select “Add” then “Add Generated Items…”, then choose the “Consume WCF Service” option.  The wizard can import directly from a running service, or it can import directly from a WSDL and associated XSD’s.  The second option was perfect for our situation.  Almost.

When I ran through the wizard, the wizard ended with the error “Error consuming WCF service metadata.  Object reference not set to an instance of an object.”  Not so good.  One solution to this is quite simple, fortunately.  There may be other variations in the WSDL or XSD’s that can cause the same error, but check this out first.  In your WSDL file, make sure that the <xsd:schema> element has a targetNamespace attribute.  It doesn’t matter what attribute value you use, just make sure it looks like <xsd:schema targetNamespace=”anything”>.  The WSCF tool did not generate this attribute.  Once it was in place, the wizard quickly generated the proper items in the project.

Another note: the WSCF-generated WSDL was also missing a <service> element.  Without a service defined, BizTalk will generate empty binding files for the service.  Be sure to include something like this in your WSDL:

<service name=”service1″>
  <port name=”BasicHttpBinding_IService1″ binding=”tns:BindingName”>
    <soap:address location=”http://localhost:8080/service1″ />
  </port>
</service>

Make sure that the name in the binding attribute corresponds to the name attribute of your <binding> (or <wsdl:binding>) element, otherwise you’ll still end up with empty binding files.

When it’s working (most of the time), BizTalk 2006 R2 makes it really easy to both consume and publish WCF services.  I’m glad that we are finally starting to move beyond the WSE and ASMX days!

Choosing a WPF Data Grid Control

As you may or may not know, Windows Presentation Foundation (WPF) does not ship with a data grid control.  [I’ll pause while I wait for the cursing to die down…]  First, I need to make an important distinction: there is a Grid control in WPF, but it is a layout control, not a data grid like Windows Forms’ DataGridView/DataGrid.  The good news is that the usual array of third-party component vendors has jumped in to fill the gap.  The bad news is that most are still at various stages of beta or 1.0 releases. 

Update: For the sake of completeness, I should mention that Windows Forms controls can be hosted in WPF, and that’s another option to consider.  Here, I’m talking about “pure” WPF controls.

The WPF data grid controls that I have discovered include:

For the last three months I’ve been working on a .NET 3.5 WPF-based business application (a rare animal these days, since most WPF samples and real-world apps are highly consumer-oriented).  I’ve been using Visual Studio 2008 Beta2, and jumped over to the RTM the day it was available.  The main purpose of this application is data editing, so I needed a solid data grid control.  I started by checking out the options listed above.

My first approach was Infragistics xamDataGrid.  They offer a free Express edition, so I started with that (and later purchased the product to obtain support).  It went in pretty easily and visually looked nice.  My data source is a collection of objects that implements IBindingList.  If your collection class does not implement IBindingList, you will not be able to add new rows to the grid (this is also true with Xceed).  I quickly discovered that xamDataGrid did not provide the out-of-box behaviors that one would expect when adding and canceling a new row.  For instance, if you start a new row, enter some values, then hit Escape twice, my expectation is that the new row is canceled and removed (see Access, SQL Management Studio, etc.).  I also had trouble getting the grid to bind to a column using a ComboBox instead of a string value.  I had a collection of objects that represented all possible values of a field (CountriesCollection, for example), and was binding the ComboBox to a property of that same object type (binding CurrentCountry property, of type Country, for example).

The Infragistics support forum for xamDataGrid consisted of many people posting questions and rarely receiving answers.  There were many threads ending with “Hello, is anyone from Infragistics listening?”  Thinking that premier support would be great, we purchased the product.  Quite frankly, I was disappointed with the “premier” support.  I got responses that did not address my specific scenario (as explicitly described in the support request), and those that said “it’ll be fixed in a future hotfix.”  Suffice it to say, I dumped xamDataGrid.

I highly recommend Xceed DataGrid for WPF.  This is a solid product with good support.  It has been out in real release, not beta, for a long time already, and it just works.  It took a half day or so to drop it in and hook it up, figure out a few subtleties, and it was ready to go.  I still had some questions, so we purchased this product too, and their support staff turned the questions around quickly with definitive answers.  Xceed also offers a free, highly-capable version of DataGrid for WPF, so check it out.  One thing to note if you are used to Windows Forms data grids: Xceed DataGrid for WPF does not support the IDataErrorInfo interface for bound object validation and automatic error display.  They have that in their suggestions list but with no timeline.

Save yourself some time and hassle and go straight to Xceed DataGrid for WPF.

NOTE: I have no connection to Xceed whatsoever; I just hope this saves you some time since I learned the hard way!

Exam 70-235: Developing Business Process & Integration Solutions Using BizTalk Server 2006

Digineer continues to be a leading Microsoft partner for BizTalk Server in the Twin Cities area.  As of this writing, we are proud to have six consultants who have passed exam 70-235, and several like myself who also completed the 2004 certification exam.  We are active in the Twin Cities BizTalk Server User Group and regularly provide content for the BizTalk Hotrod e-mag.

Since I have been so behind on my blog this year, I’m writing this in November but I passed the 70-235 exam in June (!).  Passing is 700 with 50 questions total.  I was pleased to walk away with an 842, despite the diabolical BAM questions they always throw in.

I think the exam was quite good as certification exams go.  It covered many aspects of the product and in order to pass you will have to spend hands-on time with the product.  There was quite a bit of BAM and BRE, some poorly written questions, but pretty much as expected overall.  There was a question on BRE FactRetrievers that I wasn’t expecting, but otherwise, no code-focused questions.

The question types are a lot of “choose X of Y”, some straight choose-one multiple choice and some “choose the necessary steps from a list and put them in the right order.”

If you’re a current or aspiring BizTalk developer and want to be part of a group who really knows and loves BizTalk, and you’re in the Twin Cities area, please contact me.  We are always looking for people who have a passion for BizTalk!

Faster Downloads from MSDN Subscriber Downloads using Akamai

A while back Microsoft copied some of the biggest and most in-demand software downloads for MSDN Subscribers to the Akamai content distribution network.  If you haven’t heard of Akamai, it operates a worldwide network of content distribution servers with the goal of offloading download activity from web servers and moving the content as close to your physical location as possible.  It’s all about getting data to you faster.

There are now two ways to get some popular software from MSDN Subscriber Downloads.  The first, and familiar, way is to log into the Subscriber Downloads website as usual, and use the Microsoft Download Manager ActiveX control to download the software.  The newer, Akamai way is (I believe) only available from one web page here.  You will still need to log in as usual.

In order to use the Akamai downloads:

  1. Allow pop-ups from http://msdn2.microsoft.com.
  2. Visit the downloads link, log in, and when the page comes up, look down to the “Top Subscriber Downloads” area.  These are the Akamai download links.
  3. Determine if the software you want is in the list.  If not, you’ll have to go through the normal Subscriber Downloads site.
  4. If the software you want, like VS 2008, is in the list, click the link to begin the download.  A pop-up will appear, and you will have to allow the Akamai Download Manager ActiveX control to install.  You may need to re-click the link after the control installs.
  5. The Download Manager will ask for a folder to store the file in.  You’ll have to keep its window open while the download takes place.
  6. If you are on Vista with default configuration, there is one little catch: the Download Manager will not be allowed to download to most directories on your hard disk, and it will be forced into a Vista virtualized folder system.  That’s where Vista points an application to a folder in a temporary location (not the folder the application thinks it is pointing to) for security with Internet applications.  Once you have downloaded a multi-GB file and it is not in the folder that you selected at the start of the download, you are probably not going to be a happy camper.  It’s there, just not where you expect.  Look for a folder like this: C:UserstabrahamAppDataLocalMicrosoftWindowsTemporary Internet FilesVirtualizedCUserstabrahamDocuments.  In this example, I pointed the Download Manager to C:UserstabrahamDocuments and that is where it ended up.

I hope that helps.  Some of the downloads are a lot faster from Akamai — if they happen to be popular enough to be on the Top Subscriber Downloads list.  Visual Studio 2008 RTM is up there as I write this, and my download just finished.  Time to install!

Visual Studio 2008, .NET Framework 3.5, .NET Framework 3.0 SP1, .NET Framework 2.0 SP1 RTM

The next major release of Visual Studio 2008 and the .NET Framework 3.5 have quietly been released to manufacturing over the weekend, along with .NET Framework 2.0 SP1 and .NET 3.0 SP1.  This is an important release of Visual Studio because it fully integrates the tooling for the technologies released in .NET 3.0 (Windows Communication Foundation, Windows Presentation Foundation, Windows Workflow Foundation and CardSpace) and, for the first time, can target multiple versions of the .NET Framework.

Our team has been building experience in the .NET 3.0 technologies for most of this year and playing with the betas, and we’re looking forward to working with the improved tooling in the RTM release.

Download .NET Framework 3.5 here.  The .NET 3.5 installer will install the 2.0/3.0 Framework and 2.0 SP1 and 3.0 SP1 automatically.  The service packs are also available separately for 2.0 and 3.0.  As for Visual Studio 2008, I think the MSDN subscriber downloads site is having issues already, probably due to high demand.

I just finished installing .NET Framework 3.5 RTM on my laptop running Vista Enterprise.  The install took a long time, about 30 minutes, but succeeded.  Along with 2.0 SP1 and 3.0 SP1, it also installed two Vista hotfixes, KB929300 and KB110806.  This release, like 3.0, is more of an additive release that requires and builds upon 2.0 and 3.0, unlike the 1.1 to 2.0 transition.

There is also a big new training kit (120 MB) that includes presentations, demos and labs.  You can get that here.  There are also 3.5 whitepapers by David Chappell and a 3.0 common namespaces and types poster.

I’ve been working with 3.0 and the 2008 betas for about 10 months now, so I’ve been a bit negligent with my blogging!  It has just ended up to be another really busy year.  I hope to get some new posts out about 3.0/3.5 soon.

From Microsoft:

.NET Framework 3.5 builds incrementally on the new features added in .NET Framework 3.0. For example, feature sets in Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF) and Windows CardSpace. In addition, .NET Framework 3.5 contains a number of new features in several technology areas which have been added as new assemblies to avoid breaking changes. They include the following:

  • Deep integration of Language Integrated Query (LINQ) and data awareness. This new feature will let you write code written in LINQ-enabled languages to filter, enumerate, and create projections of several types of SQL data, collections, XML, and DataSets by using the same syntax.
  • ASP.NET AJAX lets you create more efficient, more interactive, and highly-personalized Web experiences that work across all the most popular browsers.
  • New Web protocol support for building WCF services including AJAX, JSON, REST, POX, RSS, ATOM, and several new WS-* standards.
  • Full tooling support in Visual Studio 2008 for WF, WCF, and WPF, including the new workflow-enabled services technology.
  • New classes in .NET Framework 3.5 base class library (BCL) that address many common customer requests.

Recent Presentations on BizTalk Server 2006 R2

This has turned out to be a very busy year, thanks in part to Microsoft’s ever-accelerating stream of product releases.  Even five years ago I never thought that I’d hope Microsoft would slow down!

One of those exciting new products is Microsoft BizTalk Server 2006 R2, which features Microsoft’s new RFID platform, extensive support for EDI and all-new native WCF adapters (my favorite!).  I had the pleasure of presenting at the Minneapolis/St. Paul-area BizTalk Server 2006 R2 Launch event on October 9th.  My session was entitled “BizTalk Server 2006 R2: A Core Component of a Service-Oriented Architecture” and was very well-attended.  Thank you to everyone who listened in!  We even had Jon Flanders from Pluralsight and Michael Woods from the BizTalk product group on hand, and Michael introduced my sessions with an overview of Microsoft’s vision of SOA.

Tonight, November 15th, I’m presenting a session with my co-worker Randall entitled “Message Queuing with BizTalk 2006 R2: MSMQ, IBM WebSphere MQ and Ordered Delivery” for the Twin Cities BizTalk User Group.  I’m going to talk about queuing and the pros and cons, go through some MQ configuration issues and demo the MSMQ and WebSphere MQ adapters for BizTalk.  Randall is going to show some code as part of a solution for ordered delivery using MSMQ.  We hope to see you there!

Take Advantage of the ENTIRE Set of .NET Framework Class Libraries

Most developers tend to think in the context of the language they are currently writing.  If you’re writing C#, you are accustomed to having the core .NET Framework class library at your disposal.  If you’re writing VB.NET, you’re used to having many more classes above and beyond the core class library, and in J# (assuming anyone actually uses J#) you have yet another pool of classes to choose from.  This language-specific focus can lead to an unfortunate bit of tunnel vision.

To make a stunningly obvious point (once you think about it for a minute): your C# application is free to use any class available in the VB.NET or J# class libraries (or any others).  Your VB.NET application is free to use any class available in the J# class library, and so on.  Whatever language you are using, you can, and should, take advantage of all of the class libraries available to you!  Less work and less custom coding is always a great thing.

In the context of a C# application, this means adding a reference to Microsoft.VisualBasic.dll.  (What? Is he nuts?!?)  Sure, it might seem odd at first, but all high-level language code for .NET is reduced to one intermediate language in a managed code assembly — IL.  It makes no difference if it originated in COBOL.NET, C#, VB.NET, J#, etc., and there is absolutely nothing wrong with having “using Microsoft.VisualBasic” in your C# code.  The core .NET Framework already includes the extra VB class libraries, but to get the J# class libraries you need to have the J# Runtime installed.

There is a lot of great code just waiting to be used.  For example: need to work with ZIP files (unlike System.Compression)?  Check out the java.util.zip namespace in the J# runtime.  Yeah, that’s .NET managed code, despite the “java” in the namespace.  Remember that the J# runtime and J# itself was designed to be compatible with Java, so the runtime attempts to recreate as much of the (older) Java class libraries as possible.  Another example: the Microsoft.VisualBasic.Financial class.  How cool is this?  Asset depreciation calculation, present value of an annuity and more.  If you’re coding in C#, you may well have gone off and coded all of this yourself, or looked to open source for a solution — all while it was right under your nose.

I found an old article from MSDN magazine that demonstrates writing a ZIP utility in C# using the J# runtime, which is a great example for this topic.

Some of you will be saying “Duh!” by this time, but the reactions from years of saying this to developers has told me that it is not immediately obvious to everyone.  Hopefully this will save you some time!

Getting Started with the ASP.NET 2.0 AJAX Extensions and Control Toolkit

I happened to be building an ASP.NET 2.0 website earlier this year when the ASP.NET 2.0 AJAX Extensions RTM’d, so I decided to try it out.  Someone recently asked me my impressions of the Extensions and Control Toolkit and how best to get started, so I thought I’d pass on my comments.

Thinking of existing ASP.NET developers picking up AJAX for the first time with this framework, it is an extremely well designed and natural development model.  It integrates almost seamlessly into the existing development environment and “<asp:xyz>” tag model.

The AJAX Extensions support static page class methods and web services, mainly using JSON serialization, to access and even data bind controls.  Some of the controls use this capability to populate data, such as the CascadingDropDown.  If you want to use that capability outside of the provided controls, you get to start writing some JavaScript against the client-side API (Microsoft created a new object model written in JavaScript, all client-side, namespaces and all).  However, all of the source code to all of the controls, and the entire Toolkit itself, is available for download, so you can dig as deep as you want for usage or implementation examples.

The barrier to entry for JavaScript and all of the cross-brower drama that comes with it can be significantly lowered by learning and programming to the new client-side API, so that is something worth learning.  Developers should make an effort to truly understand what is going on when they use AJAX on a page.  There is a lot of code happening behind the scenes to produce the end user effect of partial updates or fancy animated controls.

There are several good tutorials to get you off the ground.  The AJAX Framework is truly a framework — when you install it you don’t have any fancy AJAX controls to drop on your pages.  Instead, you’ve got the basis for building your own, and for writing cross-browser JavaScript code on top of the client-side API.  That may be a surprise to someone installing it for the first time.  Instead, all the fancy controls are housed in a Microsoft-sponsored open-source project on CodePlex.  Naturally, they are documented about as well as most open-source projects.  However, they do come with a sample website that you can play with.

One thing that should be high on everyone’s to-do list as a web developer is mastering CSS.  If you are not very strong with CSS, it is going to become tougher to use the new tools, including AJAX and WPF/E.  For many of the fancy controls noted above, you need to create a number of CSS styles just to get them to work.  I recommend one site for CSS that may open your eyes to the possibilities.  Check out all the layouts you can do with no nested tables involved, and cross-browser too.

I believe that the AJAX toolkit documentation is lacking, in some areas significantly.  You will probably find yourself with questions that are not answered at all, or poorly.  However, that has not proven to be a major issue.  For the most part things work as expected, but there are certainly subtleties to learn.

I have had some issues with the collapsible controls not sizing correctly in a stacked configuration, but that is in an absolute positioning-based CSS website that may have another CSS issue that I’m missing.  On the same site, we have an issue with the stacking and with calendar controls not appearing in IE6 only, but again, that could be related to the other CSS.

Another downside seems to be page speed during development.  If debugging is enabled you get a non-compressed debug version of the large JavaScript client-side code, and starting a page in the debugger may take an extra five seconds before it is usable vs. no AJAX.  I believe one of the recent Control Toolkit updates is beginning to address this issue.

A not-to-miss blog for a wide range of ASP.NET topics, not just AJAX, is Scott Guthrie’s.  Here are some more ASP.NET AJAX labs.  And training videos.  The good news is that you can start using the Extensions for very small bits of functionality on your site and expand from there.  For instance, I put an existing checkbox that simply turns a flag on and off in a database inside an UpdatePanel to avoid a complete postback.  I’m sure you can think of areas like this on your websites where a simple operation could be easily optimized with AJAX Extensions for a much bigger benefit in user experience.

Reuse the Exception MessageBox from SQL Server 2005 in your Apps

I’ve been forgetting to write about this one for the better part of a year…  Many of you have probably seen the exception dialog box in the SQL Server 2005 GUI’s.  It lets you copy the exception text to the clipboard and so on.  It’s pretty nice, certainly an improvement over past dialogs that just printed the error and made you take a screenshot or copy down the error message.

Microsoft quietly released that very exception dialog as a standalone, supported managed assembly that you can use in your own applications.  This is a great thing to take advantage of if you are working on any WinForms 2.0 apps.  (I haven’t checked, but it is probably .NET 2.0 since it is part of SQL 2005.)

From the source:
Microsoft Exception Message Box
“The exception message box is a programmatic interface that you can use in your applications for any tasks for which MessageBox may be used. The exception message box is a supported managed assembly designed to elegantly handle managed code exceptions. It provides significantly more control over the messaging experience and gives your users the options to save error message content for later reference and to get help on messages.”

http://download.microsoft.com/download/f/7/4/f74cbdb1-87e2-4794-9186-e3ad6bd54b41/SQLServer2005_EMB.msi

.NET Framework 1.1 and 2.0 and 3.0 Side-by-Side (SxS)

I’ve written before about installing .NET Framework 1.1 and 2.0 side by side (SxS) on the same box.  Microsoft recently added to the mix .NET Framework 3.0, so it’s about time to clear up any confusion on the newest release.

Above all, you should understand that the version designation of 3.0 was strictly marketing-driven.  At the most basic level, .NET Framework 3.0 equals .NET Framework 2.0 plus a bunch of new DLLs.  If you install .NET Framework 3.0 on a box that does not already have .NET Framework 2.0, the installer installs Framework 2.0.  Therefore, if you already have .NET Framework 2.0 installed on a box, you should not be too concerned that installing 3.0 will break existing applications.  In fact, you will find that in the ASP.NET tab in IIS Admin, .NET 3.0 is not even a choice.

It is worth noting that .NET Framework 3.0 is pre-installed on Windows Vista and will be pre-installed on “Longhorn” Server.  However, .NET 3.0 may be installed on any Windows XP SP2 or Windows Server 2003 SP1 box.

If you’re working with a mission-critical server then you should, of course, be cautious and do some planning and testing anyway.  Just be aware that the 1.1 to 2.0 story is identical to the 1.1 to 3.0 story, because 3.0 is in effect 2.0 with more files.

By now you may be asking what .NET Framework 3.0 is good for if it is essentially Framework 2.0.  .NET 3.0 delivers a number of long-anticipated and important features, though mostly of interest to application developers rather than server administrators.  The list includes Windows Communication Foundation, Windows Workflow Foundation, Windows Presentation Foundation and Windows CardSpace.  You can read more about them on the official .NET Framework 3.0 site.

In summary:

  • .NET 3.0 is not a major change to the core .NET Framework as was 1.0/1.1 to 2.0
  • If you currently have only .NET Framework 1.0 or 1.1 and you are looking to install 2.0 or 3.0, see my side-by-side post
  • If you currently have .NET Framework 2.0, installing .NET Framework 3.0 is not a major change as the version numbers would suggest
  • If you currently run .NET 2.0 applications, they will not know or care that you have installed .NET 3.0

Please feel free to contact me with questions and your own experiences with the upgrade.  Thanks for reading!

%d bloggers like this: