Archive for August, 2010

Navigating SSRS reports in prior versions of SQL Server

Friday, August 27th, 2010

Recently, I created an application that navigates SSRS reports. I’m developing against SQL 2008 R2, so my instructions were specific to that platform.

If you are not yet on R2, you can still develop such an application. Here’s what you’ll need to do differently.

Use the ReportService2005.asmx endpoint
In my example, I used the ReportService2010.asmx endpoint to access report service methods. If you are not on R2, that will give you the error:

The path of the item 'wsdl' is not valid.

You might try ReportService2006.asmx. But if you do, you will probably run up against this:

This operation is not supported on a report server that runs in native mode

The answer (thank you Tristan Fernando) is to use ReportService2005.asmx. Follow the instructions in my previous post, but replace the endpoint.

Use the Type enum to identify catalog items
My previous example used the TypeName string property to differentiate between folders and reports. ReportService2005.asmx uses an enum property called Type instead. Enums are safer than magic strings anyway.

Don’t use DefaultCredentials
This change is not related to R2. It’s just something I got wrong at first. If you are using Forms authentication, like I am, then DefaultCredentials won’t work for you. I set ReportingService2010.Credentials to CredentialCache.DefaultCredentials in my last example. It worked for me only because the app happened to be running under my own account.

Instead, create a NetworkCredential using the password that you captured during login. Use the code from Forward network credentials to Report Server to capture and encrypt the password.

Java Tuple update

Friday, August 20th, 2010


Four years ago I created a Java Tuple class. I needed a way to quickly create type-safe multi-valued keys in Java. Here’s what I came up with:

Map<Pair<String, String>, Integer> population = new HashMap<Pair<String, String>, Integer>();
    Tuple.from("TX", "Dallas"),
    Tuple.from("TX", "Fort Worth"),
    Tuple.from("IL", "Springfield"),
    Tuple.from("NM", "Albuquerque"),

int p = population.get(
    Tuple.from("TX", "Fort Worth"));
// p = 624067
assertEquals(624067, p);
    Tuple.from("NM", "Roswell")));
    Tuple.from("NJ", "Springfield")));

Tuple.from() creates a type-safe object containing the listed values. It implements equals(), getHashCode(), compareTo(), and toString() in meaningful ways. And it provides for multi-valued returns.

Variable<Boolean> found = new Variable<Boolean>();
Variable<Integer> index = new Variable<Integer>();

findCharacter("Hello, world", 'w').extract(found).extract(index);
if (found.get()) {
    int i = index.get();
    assertEquals(7, i);
else {

Where findCharacter returns Pair<Boolean, Integer>. I published the source and got a few comments.

The most persistent complaint was that Tuple only worked with types that implemented IComparable<Themselves>. This constraint was only used in compareTo(). If you wanted tuples for one of the other methods, you ran into a meaningless compiler issue.

I have since removed that generic constraint. Now you can create tuples of non-comparable types. If you try to compare them, you will get a run time issue.

If you have used this library in the past, or if you need tuples in Java, please download the latest using the links at the top of this article.

Correspondence launch

Tuesday, August 3rd, 2010


Download the project from Codeplex.

Correspondence is a library for building occasionally connected client applications. In other words, an app that can tolerate being off line. These have typically been hard to write. Correspondence makes it easier. It gives you the following features:

  • Client-side storage
  • Server-side storage
  • Client-server communication
  • Client-to-client collaboration

And because it’s based on Update Controls, you also get:

  • Automatic dependency management
  • UI update notification
  • MVVM support

So imagine that you and a friend are using the same application. They make a change. Your UI is updated. That’s what Correspondence does.

The Factual modeling language
To get all of these features, you have to model your data differently. You declare your model using a language called Factual. Here’s a snippet of Factual describing players and moves in a Reversi game:

fact Player {
    pivot User user;
    pivot Game game;
    int index;

    Move* moves {
        Move m : m.player = this

    bool isActive {
        not exists Outcome o : =

fact Move {
    Player player;
    int index;
    int square;

The model is neither relational, nor object oriented. It is historical. It defines historical facts. These facts have fields, relationships, queries, and predicates. All of that is defined in the model so that Correspondence can generate the storage and communications for you.

The development tools

When you get the Correspondence bits, you will pull down two installs. The first is for your development machine. It installs:

  • The library assemblies
  • The Factual compiler
  • Project templates

Once you install this component, you’ll want to go into Visual Studio and hit “File”, “New”, “Visual C#”, “Correspondence”, “Correspondence Model”. This will create a project that references the right assemblies, and has a T4 template that runs the Factual compiler. Using the other project templates, you can create view models, unit tests, and WPF applications that use that model.


The second install is for your server. It installs a Windows service called “Correspondence SyncExpress”. It runs on http://localhost:9119/SyncExpress. Point your clients at that service and they will synchronize.

SyncExpress is licensed for development and test environments. It is not intended for production. I’m working on some production-ready options for you. For now, just use it to experiment with Correspondence.


If you download the source from Codeplex, you will find a Reversi game. Edit the app.config to point the client at your installation of SyncExpress, and you can play a game with a friend.

I am also writing lessons on the Codeplex site taking you step-by-step through building your own Correspondence application. Eventually, I will record screen cast videos of that content.

Please download the bits and follow along with the lessons. I think you’ll find that creating occasionally connected clients has gotten much easier.