Started a SQL Azure database

After developing a WCF service for the cloud i started developing a simple database for the cloud. After creating my database i was able to connect with SQL Server 2008 R2 to my database in the cloud. Once i got my database up and running with multiple database objects i connected my WCF service with the database. So far so good. I like the cloud solution of Microsoft! You don’t have to work very differently when you take a look at the development we are used to, so this is great. I am still hoping for a project soon where i can develop a real business application for the cloud.

Advertisements

Deployed my first service in the cloud

Whoohoo i deployed my first service in the cloud. I got excited when i left the Teched 2010 in Berlin, so i had to create an account and deploy my first WCFservice in the cloud. I think the excitement will stay for a while and hopefuly i will be able to develop some real stuff for the cloud.

The only thing i didn’t like about Azure is the time it takes to deploy a webrole. I know Microsoft is working on this issue, so i am happy with it!

The next thing to do is connecting my service to SQL Azure. I am looking forward to it.

Windows phone 7

Yesterday i received my first Windows phone 7. The first experience is AWESOME!!

  • Responsive UI
  • Nice screen resolution (480 x 800 WVGA)
  • Great voice dailing
  • Great mail integration
  • 1GHZ processor
  • 8 GB phone storage
  • etc

For more detailed information: http://www.htc.com/www/product/7trophy/overview.html

Regards,

Dennis

Teched 2010

Hi,

Last week I joined the teched 2010 in Berlin. It was a week full of useful presentations. If you haven’t been there you can watch the presentations online. The one that i like the most are:

  • IASA’s five pillars of architecture – by Jim wilt
  • Windows server AppFabric, what is it and when should ou use it – by Jon Flanders
  • Windows Azure AppFabric Service Bus a deepdive: Code, Patterns, Code – by Clemens Vasters
  • Architecture in Agile projects: How to do it right – by Mitch Lacey
  • Agile estimation – by Stephen Forte

http://www.msteched.com/2010/europe/

I am sure there are a lot more good videos. So enjoy!

Regards,

Dennis

Designing WCF services

Hi all,

I have been working for a while with WCF and still want to learn more about how to design better WCF services. I found a great post i would like to share with you: patterns for flexible wcf services. I hope you like the post as much as i do.

Regards,

Dennis

WCF and IsWrapped MessageContracts

The IsWrapped property on a messagecontract is keeping me busy. When working with WSSF it’s forcing you to set the IsWrapped property to true when you have more than one element in your message contract. This is because this required by the WS-I Basic profile1.1 standard. So you set the property to true and don’t have any idea what this will do to the proxy which is generated for you. In this post i will describe four possible scenarios and there effect on the proxy which is influenced by the choice you make. The possible scenarios are summarized in the table below:

  Request IsWrapped  Response IsWrapped 
Scenario 1 True  False 
Scenario 2  False True 
Scenario 3 False False
Scenario 4 True True

 

Well I desgined a simple service called CaseService. This service implements the ICaseService interface. This interface contains one operation RetrieveCase which accepts a casenumber (string) as input paramter and returns a Case object.

The messagecontract I used are: RetrieveCaseRequest and RetrieveCaseResponse.

Scenario 1

In this scenario I set the property IsWrapped of the RetrieveCaseRequest to true and the IsWrapped property of the RetrieveCaseResponse to false. When I build this service and generate a proxy for this service this will give me the following code (I stripped code which is irrelevant for this post):

public WCFService.Client.Proxy.Case RetrieveCase(WCFService.Client.Proxy.RetrieveCaseRequest RetrieveCaseRequest)
        {
            WCFService.Client.Proxy.RetrieveCaseRequest1 inValue = new WCFService.Client.Proxy.RetrieveCaseRequest1();
            inValue.RetrieveCaseRequest = RetrieveCaseRequest;
            WCFService.Client.Proxy.RetrieveCaseResponse retVal = ((WCFService.Client.Proxy.CaseService)(this)).RetrieveCase(inValue);
            return retVal.Case;
        }

The extra generated messagcontract

[System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
    public partial class RetrieveCaseRequest1
    {

There are two Request MessageContracts generated: RetrieveCaseRequest and RetrieveCaseRequest1. The RetrieveCaseRequest1 is a wrapper for the RetrieveCaseRequest. It looks like that the proxy will balance the request and response to the same IsWrapped setting. They are both send over the line with IsWrapped set to false.

The proxy will send the RetrieveCaseRequest1 (IsWrapped=false) and will receive RetrieveCaseResponse (IsWrapped=false). The RetrieveCaseRequest method in the proxy will accept a request messagecontract as input.

Scenario 2

In this scenario we will switch the IsWrapped settings. For the Request it will be set to false and for the response it will be set to true. Scenario 2 will give us the situation which is vica versa of scenario 1. There is one Request MessageContract and there are two Response MessageContracts: RetrieveCaseResponse and RetrieveCaseResponse1. The RetrieveCaseResponse1 is used as a wrapper contract for the RetrieveCaseResponse. Also notice the input parameter of the method RetrieveCase in the proxy. It’s a CaseNumber (string) and not a messagecontract like in scenario 1. It will wrap it into a messagecontract before sending it to the service.

public WCFService.Client.Proxy5.RetrieveCaseResponse RetrieveCase(string CaseNumber)
        {
            WCFService.Client.Proxy5.RetrieveCaseRequest inValue = new WCFService.Client.Proxy5.RetrieveCaseRequest();
            inValue.CaseNumber = CaseNumber;
            WCFService.Client.Proxy5.RetrieveCaseResponse1 retVal = ((WCFService.Client.Proxy5.CaseService)(this)).RetrieveCase(inValue);
            return retVal.RetrieveCaseResponse;
 }

Scenario 3

In the third scenario i have set both message contracts (request and response) to false. This results in the following proxy method:

public WCFService.Client.Proxy3.Case RetrieveCase(string CaseNumber)
        {
            WCFService.Client.Proxy3.RetrieveCaseRequest inValue = new WCFService.Client.Proxy3.RetrieveCaseRequest();
            inValue.CaseNumber = CaseNumber;
            WCFService.Client.Proxy3.RetrieveCaseResponse retVal = ((WCFService.Client.Proxy3.CaseService)(this)).RetrieveCase(inValue);
            return retVal.Case;
        }
As you can see, it will  accept a casenumber as input and a case object as return parameter. The proxy will wrap a messagecontract around the type before sending it to the service and strips the messagecontract before returning the response to the consumer of the proxy. Remember that you don’t always have the option to set the iswrapped property to false. When your messagecontract has multiple elements it will need the iswrapped property set to true.

Scenario 4

In this scenario I will set for both the Request and Response messages the IsWrapped property to true.

public WCFService.Client.Proxy2.Case RetrieveCase(string CaseNumber)
{
            WCFService.Client.Proxy2.RetrieveCaseRequest inValue = new WCFService.Client.Proxy2.RetrieveCaseRequest();
            inValue.CaseNumber = CaseNumber;
            WCFService.Client.Proxy2.RetrieveCaseResponse retVal = ((WCFService.Client.Proxy2.CaseService)(this)).RetrieveCase(inValue);
            return retVal.Case;
        }

As you can see this scenario contains the same proxy method as scenario 3.

I have experienced three of the four scenarios on projects and i was wondering how is it possible that my proxy is looking different when i am switching the iswrapped properties. I hope that this post will give you some information about the iswrapped property and will give you some ideas when you are running in the same kind of proxies with different faces.

Regards,

Dennis

Programming WCF services

The last few days i’ve been reading the book “Programming WCF Services” by Juval Lowy. I was looking for a book which isn’t a representation of msdn, like training kits. Just a book which describes how to write good quality WCF services. I think that Juval Lowy did a great job with his book. He is sharing his knowledge and experiences through out the whole book. Even though i think this book isn’t for starters of WCF. Juval starts with an introduction about the framework and tells more about the basics like Datacontracts, Messagecontracts, Faults and Operations. Chapters I really liked were Instance management, Transactions and Concurrency Management. These three chapters have a lot do with each other. When you already have experience with WCF and you want to read a book which still can learn you more about programming WCF services, this book is highly recommended.

Regards,

Dennis