MCE Guide Editor source code

I got a few requests for the source code of MCE Guide Editor. I once started working on a new release of it and during the process I discovered that the solution I chose wasn’t going to work. This meant I didn’t have the source of the working version of the tool. What I did was disassemble the executable. I’m currently working on a Windows 7 PC, so I wasn’t able to compile the disassembled code because I’m missing the ehome dll. However, people who know what to do with source code can easily fix the problems that are in there.

Feel free to do with it what you like. If you managed to improve it or made it work on XP or Win7, please drop me a line. Get it below.

Download MCE Guide Editor source code Version 0.1b

Honk twice if you see us!

Today I witnessed the arrival of eight Avanade branded Fiat 500 cars. They arrived in a single line in front of our main office, where they stand now. The orange / black color combination draws a lot of attention and enthousiasm. Together with the branding and racing stripes they form the perfect car for our core services team. Secretly, in our hearts, the customer facing employees, driving our big luxurous lease cars, would die to drive one of these babies ourselves.

*Update* Added a few extra photo’s in better quality.

  

Building Vista Media Center Add-ins (Dutch)

It’s been a while since I wrote an article on developing Vista Media Center Add-ins. A month ago the article was published in the Dutch .Net Magazine and today I found the digital version is available as well. In the article I demonstrate how to use the Viddler.com API to get a list of videos and display them in your add-in. The goal was to build a player for Viddler.com videos, but unfortunately the API method for getting the raw video is still not available. Even though it’s a good read, if you’re Dutch that is.

Read it here.

Day 0: arrived in LA

Yesterday afternoon we (my collegues and I) arrived in LA. Purpose of visit: the Microsoft Professional Developer Conference 2008 (PDC’08). It promises to be a very interesting week with a lot of new stuff from Microsoft, including Windows 7, ‘Oslo’ and ‘Dublin’. After arrival we checked into our rooms, grabbed a slice of pizza, had a drink and went to bed. We tried to join the party by Jeffrey Pallermo, but the waiting time was about 40 minutes and we heard there was no more beer (no problem for me as non-alcohol drinking person, but some of my collegues seemed to mind :) ). Today will be the first real day of the conference which is kicked off by the keynote of Ray Ozzie and others. After the keynote we have plenty of sessions to choose from. Although I’m not yet sure about my planning for the day, it’ll probably look something like:

  • 8:30 AM – 11:00 AM  Keynote
  • 11:00 AM – 12:15 PM  Under the Hood: Advances in the .NET Type System
  • 12:45 PM – 1:30 PM  Microsoft Expression Blend: Tips & Tricks or “Dublin” and .NET Services: Extending On-Premises Applications to the Cloud
  • 1:45 PM – 3:00 PM  Identity: “Geneva” Server and Framework Overview or Developing for Microsoft Surface or The Future of C#
  • 3:30 PM – 4:45 PM  A Lap around Cloud Services Part 2
  • 5:15 PM – 6:30 PM  Developing and Deploying Your First Cloud Service

For the evening we have planned to go to the LA Kings ice hockey match in the Staples Center, next to the conference center. This looks like it’s gonna be a day full of fun and information.

Consume WCF service using Sharepoint Designer

By default the SharePoint Designer is unable to consume WCF services because it fails to recognize the structure of the request messages. There is a workaround if you still need to consume WCF services using the Designer. However, this does not work via the datasource wizard but instead requires some manual intervention. There are two methods to do accomplish this:

  • Modify the datasource
  • Modify the code in the page

The first method is easier to implement and gives you more control over the output. The only downside is that the WCF service must use a wrapped request message contract. This means that you either need full control over the WCF service so you can enable the request message to be wrapped, or you have to be lucky that the WCF service you’re trying to consume uses wrapped message contracts. From the WSDL it’s difficult to see if wrapped message contracts are used. If you’re not sure you can try the first method. If the Designer crashes as soon as you want to use the modified data source, the WCF service probably doesn’t support it. If you have full control over your service, the first method will also describe how te enable wrapped message contracts.

Method 1: Modify the datasource

To consume a WCF service in the Designer by modifying the datasource you perform the following steps:

  • Enable wrapped message contracts
  • Create a datasource using the wizard
  • Obtain request message by calling the service with Webservice Studio
  • Modify the soap envelope of the datasource

1.1 Enable wrapped message contracts

In this step you’ll set the IsWrapped property of the request message contract to True.

If you used Web Service Software Factory for creating your WCF service you can set the request message contract to be wrapped in the service contract model. Open the service contract model and select the request message contract. In the properties window of the message contract you change Is Wrapped to True. Save the model and generate the code for the service contract.

If you didn’t use Web Service Software Factory you can have the request message contract set to wrapped by modifying the MessageContract atribute. Open the file containing the request message contract and locate the MessageContract attribute. Make sure that the attribute does not set IsWrapped to False. If it does you can simply remove the property assignment or you set it to True, which is the default value. You can also give the wrapper a name and namespace if you like, but this is not required. In the end your message contract should look a little similar to the code sample below:

[sourcecode language="csharp"]
///

/// Service Contract Class – HelloWorldRequestMessage
///

[WCF::MessageContract(
WrapperName = "HelloWorldRequestMessage",
WrapperNamespace = "urn:HelloWorldService.ServiceContracts")]
public partial class HelloWorldRequestMessage
{
private string name;

[WCF::MessageBodyMember(Name = "Name")]
public string Name
{
get { return name; }
set { name = value; }
}
}
[/sourcecode]

Whether you changed the wrapped value using WSSF or directly in the code, you should make sure to rebuild your project.

1.2 Create a datasource using the wizard

In this step you’ll create a new datasource using the Sharepoint Designer wizard. Open Sharepoint Designer, connect to your site and go to the Datasource Library tab on the right side of your screen. Click on the Connect to a webservice link underneath the XML Web Services. In de dialog you enter the URL to your services endpoint and click the Connect Now button. The wizard will connect to your web service and present you a list of endpoints and methods. It doesn’t matter which endpoint or method you select here, because we’ll change that later. Click OK to exit the wizard and create the new datasource.

1.3 Obtain request message by calling the service with Webservice Studio

In this step you’ll obtain the appropriate request message for calling your webservice. Because the request message generated by the Sharepoint Designer wizard is incorrect you need to replace that with the correct one. For this purpose we’ll use Webservice Studio (http://www.codeplex.com/WebserviceStudio).

Before calling the web service you should make sure you have the URL to the service’s WSDL and that the service is running.

To call a web service you start Webservice Studio, type the URL to the service’s WSDL in the WSDL Endpoint drop down list and click on the Get button. Webservice Studio attempts to create a proxy for the WSDL it found at the specified URL.

Once the creation of the proxy is finished you are promted with the web service’s methods on the left. By clicking on a method the required input parameters are shown and you are able to specify their values.

Once you’ve specified the required parameters you can call the web service by clicking the Invoke button. The response of the web service is shown in the Output window if the call was successful. We then move to the Request/Response tab to be able to view the raw request message. Copy the soap:Envelope record of the request message and store it somewhere so we can use it in our next step.

1.4 Modify the soap envelope of the datasource

In this step you’ll modify the XML Webservice datasource of the Sharepoint Designer.

To access the datasources you need to be connected to your site using the Sharepoint Designer. In the site’s tree you navigate to _catalogs\fpdatasources. This directory contains xml files with the datasource configurations. Open the xml file that has the name of your service. The contents will look similar to this (reformatted for better reading):

[sourcecode language="xml"]


HelloWorldService












]]>



[/sourcecode]

The soap:Envelope part is what we’re interested in. Replace the complete soap:Envelope with the soap envelope you obtained using Webservice Studio. Now your datasource will look similar to this (reformatted for better reading):

[sourcecode language="xml"]


HelloWorldService








Sander





]]>




[/sourcecode]

Note that the soap:Body is completely different from what the Designer’s wizard gave you. After modifying the soap:Envelope you can save the changes to the datasource. Refresh the list of datasources in the Datasource Library and use the datasource like you would any other. Be careful not to reconnect the datasource using the wizard because that would render it unusable again.

Method 2: Modify the code in the page

To consume a WCF service in the Designer by modifying the code in the page you perform the following steps:

  1. Obtain request message by calling the service with Webservice Studio
  2. Complete DataFormWebPart XML
  3. Paste XML in WebPart

2.1 Obtain request message by calling the service with Webservice Studio

This step is the same as in the previous method.

2.2 Complete DataFormWebPart XML

After obtaining the request message of the web service we can complete the XML of a DataFormWebPart. Below is the basis of the DataFormWebPart. Have a look at the structure and then continue reading on how to complete it.

[sourcecode language="xml"]



WsdlPath="http://localhost:3391/MeteringPointService/MeteringPointService.svc?wsdl"
SelectUrl="http://localhost:3391/MeteringPointService/MeteringPointService.svc"
SelectAction="urn:ASBusinessServices.ServiceContracts.MeteringPointServiceContract.GetMeterDetails"
SelectPort="MeteringPointServiceEndpoint"
SelectServiceName="GetMeteringPointDetails">






{MeteringPointName}
{MeterName}

























'






[/sourcecode]

The SharePoint:SoapDataSource contains a couple of attributes that need to be set. The first is the WsdlPath, which is the same path as you used in Webservice Studio. Then there’s the select path, which in most cases is almost identical to the WsdlPath with ‘?wsdl’ removed from the end. The SelectAction is the soap action of the method you’d like to call. If you’re uncertain what this value should be, you can look it up in Webservice Studio, on the left side of the Request/Response tab. SelectPort is the name of the endpoint of the service. This is specified in the Wsdl as the name of the binding to which the operation belongs. The last attribute is the SelectServiceName attribute. It’s value is the name of the method. If you’re unsure of the values of the latter two attributes, you can use the add XML Webservice wizard to obtain them.

A little below the SharePoint:SoapDataSource you find the SelectCommand. The SelectCommand should contain the soap envelope you’ve obtained using Webservice Studio. You can substiture the values of the parameters by variable names enclosed by braces. This allows the value of the parameter to be set via Web Part connection. In you do this you should also make sure to add the parameter to the SelectParameters and ParameterBindings collections.

The last thing you probably want to do is to modify the XSL for the desired output. This is pretty straightforward if you’re familiar with XSL. If not, there’s a lot of content out on the web to help you get started.

2.3 Paste XML in WebPart

All the hard work is done in the previous steps. The only thing to do now is to copy the completed XML from the previous step and paste it inside a WebPart. The easiest way to do this is by selecting the split view in the SharePoint Designer and then clicking on a WebPart. This selects the code of the WebPart. Find the tags and paste the XML between them. Once you save the document it will update the design and call the WCF service.

Better WSSF solution structure

I’ve done my share of work with the Web Service Software Factory modelling edition, but never have I liked the solution structure it generates for me. Or either the namespaces of the projects are wrong, or the paths became too long because of the fully qualified names I’d use. This time I reserved some time to tackle this once and for all. The result is an easy to apply patch for WSSF: Modelling Edition.

What does it do:

  • Does not add the service name to each project but name them simply BusinessEntities, ServiceImplementation or DataContracts
  • Let the user choose his own namespace, which is then added to each project name. E.g. a user chooses the namespace MyCompany.MyProduct. The BusinessEntities project then gets the namespace MyCompany.MyProduct.BusinessEntities.
  • Names the host application after the service instead of just ‘Host’

What doesn’t it do:

  • It doesn’t change the assembly name. There seems to be a bug in the templating system of Visual Studio so the AssemblyName property of a template project is always set to the project name. I haven’t tested this with Visual Studio 2008 SP1, so I’m interested to know if that service pack solves this.
  • It currently doesn’t work for ASMX implementation project, only for WCF implementation projects. I don’t think ASMX is done with WSSF that much these days, so I didn’t bother to implement it for ASMX.

How to apply the patch:

  • Download the zip file containing the patched files from the bottom of this post.
  • Extract the contents of the zip file to the “C:\Program Files\Microsoft Service Factory Feb 2008\Guidance Package” directory (or other directory where you installed WSSF), replacing the existing files. Create a backup if you want to revert to the existing templates and recipes.

How to use the patch:

  • Choose to generate the WCF implementation projects like you normally do. This means right clicking on the solution and choosing Add > WCF Implementation Projects.
  • Enter the desired name for the service. A simple name will do, do not enter a fully qualified name here becuase you can choose a namespace in the next step. Screenshot
  • In the next screen you supply a desired namespace. Remember that the namespace you enter here will be added to every project that is generated. Screenshot

Download Web Service Software Factory Solution Structure Patch Version 1.0

Viddler.Net on Codeplex

Things are moving fast. Yesterday I released an early first version of Viddler.Net, a wrapper for the Viddle API. Today I was able to post an updated version to Codeplex, which seems more suitable for managing this project than my own blog. The updated version uses HTTP POST instead of GET and includes one extra implemented method to upload videos.

Find the Codeplex project at http://www.codeplex.com/ViddlerDotNet

First release of Viddler.Net

If you read my article in the Dutch .Net Magazine about Vista Media Center add-ins and you came looking on my blog for the Viddler.Net api, you just found it! If you don’t know what I’m talking about, please read on :)

This is my first release of the Viddler.Net api, which is a wrapper for the Viddler api. The Viddler.Net api allows a .Net developer to make use of the videos on the Viddler website through code. At this stage not all methods are implemented, but they will be soon. In the download you’ll find the full source code of the api including the unit tests. To be able to run the unit tests you need to modify the app.config and put in your own username, password and api key. You can request you api key here.

If you want to use Viddler.Net in your own project, you need to add a Viddler.Net configuration section to your app.config or web.config. To do this you first need to declare the configuration section in the <configSections> section in top of the configuration file. Then you need to define the configuration section somewhere below the configSections section, but between the <configuration>elements. You configuration file should look something like this:


  

Download Viddler API wrapper for .Net 2.0 Version v0.1 beta 

Note that not all methods are currently implemented or working correctly. I’m working on getting them all to work, but I thought to release a version now, while I’m still improving it. The current status is represented by the following test results overview (click to enlarge):

On my todo-list is currently:

  • Implement all methods
  • Complete all unit tests
  • Change http method from GET to POST to allow more characters for some parameters

Microsoft BizTalk Server Performance Optimization Guide

From MSDN:

Welcome to the first edition of the Microsoft® BizTalk® Server Performance Optimizations Guide. We created this guide to provide in depth information for optimizing the performance of a BizTalk Server solution. Full end-to-end performance testing is frequently overlooked during enterprise application deployment. Knowing that Microsoft has built a scalable messaging infrastructure, many organizations that use BizTalk Server spend little or no time conducting performance testing of their own applications. BizTalk Server applications consist of many parts, which may include custom-built components as well as those provided by Microsoft. It is impossible for Microsoft to performance test every possible combination of these components. Therefore, fully and properly conducting a performance test of your application is a critical step of any deployment. The purpose of this guide is to consolidate and provide prescriptive guidance on the best practices and techniques that should be followed to optimize BizTalk Server performance.

Read more about it or get it.

Control Windows Media Center with New Windows SideShow BETA Gadgets

From the Windows Experience Blog:

The Windows SideShow Team has announced the availability of 4 BETA Windows SideShow Gadgets that let you control Windows Media Center from a Windows Sideshow device. You can sign-up via Microsoft Connect to gain access to Beta Test these new Windows SideShow Gadgets:

 http://connect.microsoft.com/InvitationUse.aspx?ProgramID=2380&SiteID=312&InvitationID=GPB-79MM-RFJ2

Here is the breakdown of the 4 Windows Media Center BETA Windows SideShow Gadgets and what they do:

  • Now Playing: View what is currently playing in Windows Media Center (includes playback controls)
  • Pictures + Video: Browse your Photos and Videos folders
  • Music: Browse your Music folder and play any song
  • TV: Look at what is on TV via the Windows Media Center Guide, Schedule Recordings, and View Recordings (in a Thumbnail view)