Honk twice if you see us!

November 28th, 2008 by Sander Schutten

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.

  

Posted in General | 1 Comment »

Day 0: arrived in LA

October 27th, 2008 by Sander Schutten

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.

Posted in General | No Comments »

Consume WCF service using Sharepoint Designer

October 23rd, 2008 by Sander Schutten

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:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// <summary>
/// Service Contract Class - HelloWorldRequestMessage
/// </summary>
[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; }
	}
}

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):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!-- Original data source (not working) -->
<udc:DataSource xmlns:udc="http://schemas.microsoft.com/data/udc" MajorVersion="2" MinorVersion="0">
  <udc:Name>HelloWorldService</udc:Name>
  <udc:ConnectionInfo>
    <DataSourceControl>
      <![CDATA[<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
      <SharePoint:SoapDataSource runat="server" id="SoapDataSource" AuthType="None" WsdlPath="http://localhost:3055/HelloWorldService/HelloWorldService.svc?WSDL" SelectUrl="http://amsdc1-s-7150:3055/HelloWorldService/HelloWorldService.svc" SelectAction="HelloWorld" SelectPort="HelloWorldServiceEndpoint" SelectServiceName="HelloWorldService">
        <SelectCommand>
          <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <soap:Body>
              <HelloWorld>
                <parameters></parameters>
              </HelloWorld>
            </soap:Body>
          </soap:Envelope>
        </SelectCommand>
      </SharePoint:SoapDataSource>
    ]]></DataSourceControl>
  </udc:ConnectionInfo>
  <udc:Type MajorVersion="1" MinorVersion="0" Type="Soap"/>
</udc:DataSource>

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):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!-- Modified data source with correct soap envelope -->
<udc:DataSource xmlns:udc="http://schemas.microsoft.com/data/udc" MajorVersion="2" MinorVersion="0">
  <udc:Name>HelloWorldService</udc:Name>
  <udc:ConnectionInfo>
    <DataSourceControl>
      <![CDATA[<%@ Register tagprefix="SharePoint" namespace="Microsoft.SharePoint.WebControls" assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
      <SharePoint:SoapDataSource runat="server" id="SoapDataSource" AuthType="None" WsdlPath="http://localhost:3055/HelloWorldService/HelloWorldService.svc?WSDL" SelectUrl="http://amsdc1-s-7150:3055/HelloWorldService/HelloWorldService.svc" SelectAction="HelloWorld" SelectPort="HelloWorldServiceEndpoint" SelectServiceName="HelloWorldService">
        <SelectCommand>
          <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <soap:Body>
              <HelloWorldRequestMessage xmlns="urn:HelloWorldService.ServiceContracts">
                <Name>Sander</Name>
              </HelloWorldRequestMessage>
            </soap:Body>
          </soap:Envelope>
        </SelectCommand>
      </SharePoint:SoapDataSource>
    ]]>
    </DataSourceControl>
  </udc:ConnectionInfo>
  <udc:Type MajorVersion="1" MinorVersion="0" Type="Soap"/>
</udc:DataSource>

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!-- Set values for WsdlPath, SelectUrl, SelectAction, SelectPort and SelectServiceName -->
<WebPartPages:DataFormWebPart runat="server" IsIncluded="True" NoDefaultStyle="TRUE" ViewFlag="0" Title="Test Service" __markuptype="vsattributemarkup" partorder="1" __WebPartId="{1AE4A625-99D4-470E-9DCB-91412F2A364E}" id="g_1ae4a625_99d4_470e_9dcb_91412f2a364e">
  <DataSources>
    <SharePoint:SoapDataSource runat="server" id="Test_x0020_Service1" AuthType="None"
          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">
      <SelectCommand>
        <!-- Replace soap envelope with the one derived from web service studio -->
        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <soap:Body>
            <Request xmlns="urn:ASBusinessServices.ServiceContracts">
              <!-- Parameters within braces can be set via Web Part connection -->
              <MeteringPointName xmlns="urn:AFBusinessServices.ServiceContracts">{MeteringPointName}</MeteringPointName>
              <MeterName xmlns="urn:AFBusinessServices.ServiceContracts">{MeterName}</MeterName>
            </Request>
          </soap:Body>
        </soap:Envelope>
      </SelectCommand>
      <SelectParameters>
        <!-- Add parameters that could be set via Web Part connection -->
        <WebPartPages:DataFormParameter Name="MeteringPointName" ParameterKey="MeteringPointName" PropertyName="ParameterValues" DefaultValue="FR-150"/>
        <WebPartPages:DataFormParameter Name="MeterName" ParameterKey="MeterName" PropertyName="ParameterValues" DefaultValue="Meter1"/>
      </SelectParameters>
    </SharePoint:SoapDataSource>
  </DataSources>
  <ParameterBindings>
    <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
    <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
    <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
    <ParameterBinding Name="MeteringPointName" Location="None" DefaultValue="FR-150"/>
    <!-- Also add parameters that could be set via Web Part connection here -->
    <ParameterBinding Name="MeteringName" Location="None" DefaultValue="Meter1"/>
  </ParameterBindings>
  <datafields></datafields>
  <XSL>
    <!-- Modify the XSL for the desired output -->
    <xsl:stylesheet xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ddw1="http://tempuri.org/" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal">
      <xsl:output method="html" indent="no"/>
      <xsl:decimal-format NaN=""/>
      <xsl:param name="dvt_apos">&apos;</xsl:param>
      <xsl:template match="/">
        <xsl:value-of select="//*[local-name()='Id']" />
      </xsl:template>
    </xsl:stylesheet>
  </XSL>
</WebPartPages:DataFormWebPart>

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.

Posted in General, SOA | 1 Comment »

Better WSSF solution structure

October 15th, 2008 by Sander Schutten

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

Downloaded a total of 327 times

Posted in General, SOA | No Comments »

Viddler.Net on Codeplex

August 22nd, 2008 by Sander Schutten

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

Posted in General | 1 Comment »

First release of Viddler.Net

August 20th, 2008 by Sander Schutten

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:

1
2
3
4
5
6
7
8
9
10
11
12
<configuration>
  <configSections>
    <section
      name="viddlerNetSettings"
      type="Avanade.ViddlerNet.Settings, Avanade.ViddlerNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
      />
  </configSections>
 
  <viddlerNetSettings
    apiKey="yourApiKeyHere"
    baseUrl="http://www.viddler.com/rest/v1/?method={0}&api_key={1}" />
</configuration>

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

Downloaded a total of 294 times

 

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

Posted in General, Media Center | 3 Comments »

Home Server campaign

July 2nd, 2008 by Sander Schutten

in case you haven’t seen this yet, Microsoft has a rather interesting marketing campaign around Windows Home Server. One of the parts of the campaign is a book about Home Server which looks like it’s written for kids. The book explains what the magic ‘Server’ in the house is all about.

Microsoft went so far with this campaign that it actually looks like you can buy the book from Amazon! Absolutely hilarious!

If you would like to know more about that weird ‘Server’ that suddenly appeared in your house and what it does, you should definitely read the book!

Posted in General, Media Center | No Comments »

How-To: New ASP.NET 3.5 Extensions Video Screencasts

July 2nd, 2008 by Sander Schutten

From the almighty Scott Hanselman:

Released today are four new screencasts about the ASP.NET 3.5 Extensions by various members of the ASP.NET team. Every video is available in numerous formats, and note that this also includes re-encoded versions of my Intro to MVC Screencast in a pile of formats including an iPod/iTouch compatible format, as well as ones for the Zune and PSP and a utterly unwatchable ;) 40 meg 3GP one for 3G Phones.

Continue reading here (includes links to the videos).

Posted in General | 1 Comment »

Ext JS

July 1st, 2008 by Sander Schutten

Although I rarely develop front-end applications, let alone web applications, during my day-to-day job, I’m still practicing the skill in my personal time. Before my interests in application integration started to arise I was very much intrigued by all what is currently known as web 2.0 and Ajax. In the time we would simply call it DHTML, but that term was superseded by the more catchy ones.

So if I see someting passing by that really looks cool and is built using simply Javascript and HTML I always take a quick look at it. This time I was following an e-mail thread on Ajax libraries until Ext JS was suggested. As I’d never heard of it, I went out and looked at the samples. And I must say I’m really impressed with the style, smoothness and functionality of the library. Now I only have to check out how to incorporate this with .Net.

Please do check out the samples at http://extjs.com/deploy/dev/examples/samples.html.

Posted in General | 1 Comment »

Jonas Butt, the new IT-talent?

February 27th, 2008 by Sander Schutten

IT-talent is an internship project which offers IT-talents an exclusive assignment with a prominent IT company. The goal is to create an unique experience and a solid basis for a successful career in IT. Check out www.it-talenten.nl (Dutch) for more information on this project.

One of the eight participating students is Jonas Butt, who’s doing his internship at Avanade Netherlands. During his internship he’ll try to answer the following research question:

How can Avanade promote the reuse of products (like code, patterns and domain knowledge) from similar projects within the same domain to reduce costs and shorten the run time?

If Jonas manages to make his blog the most interesting and entertaining of all eight he’ll be awarded the IT-talent of the year award. For more information please continue to read his blog.

Posted in General | No Comments »

« Previous Entries