Blog Home  Sign In RSS 2.0 Atom 1.0 CDF  

  def Softwaremaker() :
         return "William Tay", "<Challenging Conventions />"

  knownType_Serialize, about = Softwaremaker()
 

 Monday, September 26, 2005

Back to more Windows Communication Foundation (WCF, previously - Indigo), or previously known as Indigo, postings...

I dont think a lot of people know about one of the aspects of WCF, which pertains to how WCF serializes incoming messages before it sends it to the dispatcher and onto your .NET typed code.

In .NET 1.*, ASMX disregards the ordering of the data elements in the received messages. This means that for a XML Schema such as this:

[s:complexType name="CreditCard"]
[s:sequence]
[s:element name="AccountName" type="s:string" /]
[s:element name="CreditCardType" type="s:string" /]
[s:element name="CreditCardNo" type="s:string" /]
[s:element name="CreditCardExpiryDate" type="s:string" /]
[/s:sequence]
[/s:complexType]

If you send a (W3C) SOAP Message such as this (Take note that the ordering of [AccountName] is not in-line with the above schema):

  [soap:Envelope]
    [soap:Header /]
    [soap:Body]
      [SubmitCreditCard]
        [crdcard]
          [CreditCardType]AMEX[/CreditCardType]
          [CreditCardNo]1234567890[/CreditCardNo]
          [CreditCardExpiryDate]08082088[/CreditCardExpiryDate]
          [AccountName]William Tay[/AccountName]
        [/crdcard]
      [/SubmitCreditCard]
    [/soap:Body]
  [/soap:Envelope]

ASMX will allow the message to go through.

In WCF, there is strict enforcing of the ordering of the data elements. Lets take a quick look:

WCF Code:
[DataContract()] _
Public Class CreditCard
  [DataMember(Name:="CreditCardExpiryDate")] Private _CreditCardExpiryDate As String
  [DataMember(Name:="CreditCardType")] Private _CreditCardType As String
  [DataMember(Name:="CreditCardNo")] Private _CreditCardNo As String
  [DataMember(Name:="AccountName")] Private _AccountName As String

  Public Property CreditCardType() As String
    Get
      Return _CreditCardType
    End Get
    Set(ByVal value As String)
      _CreditCardType = value
    End Set
  End Property

  Public Property CreditCardNo() As String
    Get
      Return _CreditCardNo
    End Get
    Set(ByVal value As String)
      _CreditCardNo = value
    End Set
  End Property

  Public Property CreditCardExpiryDate() As String
    Get
      Return _CreditCardExpiryDate
    End Get
    Set(ByVal value As String)
      _CreditCardExpiryDate = value
    End Set
  End Property

  Public Property AccountName() As String
    Get
      Return _AccountName
    End Get
    Set(ByVal value As String)
      _AccountName = value
    End Set
  End Property
End Class

This will generate the schema:
[xs:complexType name="CreditCard"]
[xs:sequence]
[xs:element name="AccountName" nillable="true" type="ser:string" /]
[xs:element name="CreditCardExpiryDate" nillable="true" type="ser:string" /]
[xs:element name="CreditCardNo" nillable="true" type="ser:string" /]
[xs:element name="CreditCardType" nillable="true" type="ser:string" /]
[!-- I omitted some WCF-specific elements here for simplicity.--]
[!--I will blog more about this on a later date. See Below **--]
[/xs:complexType]

There is a reason I put the Public Property AccountName last in my .NET 2.0/Indigo code above. I wanted to show that how you place the property/field in code has no effect on the schema. If you keep a strong observant eye on the resultant schema, you will notice that it is Alphabetical-Ordering dependent and if I send the below message to it:

[s:Envelope]
[s:Header /]
[s:Body]
[SubmitCreditCard xmlns="http://demos.softwaremaker.net/SchemaDataOrdering"]
[crdcard]
[CreditCardExpiryDate]08082088[/CreditCardExpiryDate]
[CreditCardNo]1234567890[/CreditCardNo]
[CreditCardType]AMEX[/CreditCardType]
[AccountName]William Tay[/AccountName]
[/crdcard]
[/SubmitCreditCard]
[/s:Body]
[/s:Envelope]

It will result in a HTTP Error Code: 500 (Internal Server Error). What this means is that you have to keep the ordering of the dispatched message to the published schema or else WCF will reject it.

The consensus from the field (I felt) is that while most of the projects doesnt even feel the lack of schema-ordering enforcements in .NET 1.*, there may be certain advanced validation scenarios that may need order checking at the schema level. While I welcomed this extra checking, I hope it doesnt come with a performance penalty.

The good news is that the Service.Runtime.Serialization.XMLFormatter, which is used in WCF, is a lot better performer than its predecessor: the XMLSerializer. It does, however, give the developer less control of the XML Schema though. **WCF will add in its own special elements into the schema**. This will aid in better message versioning and control that comes with the evolutionary nature of distributed loosely-coupled messaging systems such as WCF. I will explain more in a later blog post.

From what I understand, the WCF team is considering of adding an Order property to the DataMemberAttribute to allow for added customization of this order. Again, I feel that this is a good move as Alphabetical-Ordering dependency will mean that developers may have to consider their naming conventions in code should they require a validation check at the schema level.

What I would like is an attribute for me to turn-off schema data elements ordering validation and checking should I choose to. In this case, the developers on the field will be comfortable of the options they have at hand if validation / performance tradeoffs becomes an issue.

P/S: I used my own Manual SOAP Post tool to create some of the scenarios here. You may want to download it here.

Monday, September 26, 2005 5:44:16 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Friday, September 23, 2005

    The British Computer Society came up with this very interesting piece which I recommend a STRONG read.

    A couple of points which I find very interesting (and many people may not know and how true it is) and I take the liberty to quote from the above-referenced article here:

    "... In most industrialized nations, intellectual property (IP) generated by an employee through the course of his or her employment legally belongs to the employer. In the UK, this is embodied in the Patents Act 1977 and the Copyright, Designs & Patents Act 1988. Of course, if you are employed as a janitor and happen to write software in your spare time, you could argue that the IP that you are generating is entirely unconnected with your normal duties as an employee and therefore belongs to you. However, when it comes to software professionals, there is no such argument. Any software that they write, irrespective of whether it is during or outside normal working hours, legally belongs to their employer. Self-employed and contract software engineers are not usually bound by employer's IP rights but are unlikely to be strongly motivated to write OSS code unless they can earn a living from doing so, and the unpaid volunteer nature of OSS development tends to rule out this possibility ..."

    "... There are uncomfortable similarities between the OSS development process and the situation that arose in the computer games industry in the early 1980s, where legions of 'bedroom programmers' produced video console games of such poor quality that, despite selling in tens of thousands, they nearly destroyed the industry. The games industry learned a valuable lesson from this experience and is now arguably the most highly trained and disciplined software development community in the world. This professionalism in software development is cited as a major contributory factor to the explosive growth that the computer games industry has enjoyed over the last 10 years. The open source movement, with its hacker ethic, doesn't promote professionalism ..."

    I did spend some time pondering over the member's remark:

    "... Without prompt action, my fear is that a further move towards OSS could result in the nightmare scenario of OSS at one extreme and Microsoft at the other with nothing else in between. Where would our freedom of choice be then? ..."

    Friday, September 23, 2005 1:04:37 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Tuesday, September 20, 2005

    I remember while I was chatting about one of the article I was working on for MSDN with some folks from MSFT Corp during lunch at and I said that most of my code snippets are written in Visual Basic and for once ever, no-one sniggered and laughed. That moment was priceless.

    This was because we just came off a fantastic talk on Visual Basic 9: Future Directions in Language Innovations. In fact, someone echoed how cool Visual Basic 9 IS now. I dont know how long was it when "Cool" and "Visual Basic" got along together until today. WOW ! What can I say ? It is standing proud.

    There is a piece here that gives a brief overview on Visual Basic 9. What do I love most ? Its built-in deep XML Support. I cannot wait. Give it to me now !!!

    It was a great day.

    Tuesday, September 20, 2005 6:23:25 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Friday, September 16, 2005

    This is hilarious. The closed captioning on Bill Gates keynotes, which was also broadcast over the internet, had some real funny inconsistencies that can make Jay Leno's Headlines any time. Instead of writing down what I saw, fellow Microsoft Regional Director, Benjamin Mitchell has documented it well here. I took the liberty to quote him on this funny paragraph.

    Funny things that came up on the closed captions on the video screen as Bill spoke:

    'Intel a mir a cash mode' -  'IntelliMirror cache mode'
    'Things like our asses are driving up to do this' (RSS)
    Sin yer jistic (synergistic)
    Overall I was incredible impressed that the subtitles kept pace and did such an accurate job.

     

    Friday, September 16, 2005 3:06:39 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Thursday, September 15, 2005

    I just moderated at wonderful BOF session at 2100 hours last night. As expected, the turnout was not that great since it is really an advanced topic and because of the lack of carity and lack of implementation evidence, that is why I brought up the idea in the first place.

    However, the handful of people who showed up including a couple of guys wearing the blue-shirts really engaged in a lively discussion thrashing out the merits and cons of WS-AtomicTransactions VS those of WS-BusinessActivity.

    It was really a good thing and I gathered a lot from what the floor threw up and I am sure the rest of the floor gained as much as well.

    Oh yeah --- I finally got the chance to meet up with Mr Brains-and-Brawn, Casey Chestnut who showed up during my session. I also managed to get a glimpse of the piece of application that got Casey his ticket to PDC. All I can say is that, you are unreal, Casey. Awesome and excellent piece of work with the TablePC and DirectX.



    Wednesday, September 14, 2005 10:26:44 PM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  • I was asked to write a small article piece for Commnet @  about what I thought of Bill Gates's keynote. I wrote it. They published it. 10,000++ attendees can read it. You can view the pdf of it here.

    Wednesday, September 14, 2005 9:52:41 PM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Tuesday, September 13, 2005

    I finally made the long trip to but it wasn't without its events.

    1) Bad Bad Bad, oh did I mention Bad turbulence from Narita to Los Angeles. Quite a lot of people puked and my face was green pretty much for the whole journey

    2) LAPD and the Airport Police were called onto the plane right upon its arrival to remove a suspicious character on the plane. Everyone has to remain seated 30 mins even after the plane docked. I noticed this man just walking up and down the aisle of the aircraft during the entire journey. I dont know if he was drunk or something. This effect caused a connected delay in everything including getting our luggage from the luggage claim conveyor belt.

    3) Got caught in massive jams throughout the city because of this. Everyone thought it was a terrorist attack.

    I attended a side-meeting in the Convention Center and met up with fellow peers and folks. I was given a glimpse of what Bill Gates will unveil tomorrow - Day 1 of the PDC 2005 event. So keep your eyes glued to this spot for that.

    Oh, BTW: Now I can say that I have been to Hollywood and made it as screen-part of a LA-produced video movie ... and I didnt even have to take off my clothes to do it  What am I talking about ? Stay tuned during the week of Nov 7 for more of when that movie video will be shown and what it is all about.

    Tuesday, September 13, 2005 4:36:48 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Saturday, September 10, 2005

    Taken from the "Lets Go" Guide-Book Series for Los Angeles, California:

    "Downtown, an uneasy truce exists prevails between the bustling financiers and the street population, but visitors should be cautious - the area is especially unsafe after business hours and on weekends."

    "Cheap accommodations in Los Angeles are often unsafe ... Downtown has public transportation connections, but is unsafe after dark. Even those with cars should choose lodgings close to their interests to keep car-bound time to a minimum."

    "Once the sun sets, those on foot, especially outside west LA and off well-lit main drags, should exercise caution, particularly when alone. Plan your pedestrian routes very carefully - it is worth a detour to avoid passing through heavily crime-ridden areas. If you hitchhike, you will probably die. It is exceptionally dangerous, not to mention illegal. Do not even consider it."

    Nuff said.

    Saturday, September 10, 2005 8:01:54 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  • Everyone I meet that knows about  is asking me this question ... and I have no idea. This is the first time in a long time I will be attending a major conference as an attendee and I am super-excited about the absence of the pressures of presenting.

    I have no idea what will be announced in PDC although I expect it to rival that was announced in the same event 2 years back. I even thought WinFS was a major announcement that could have made PDC 2005 headlines. Apparently not --- It was released and made public a couple of weeks back so this new IUnknown is even bigger, I guess...

    Robert Scoble (Chief Blog Officer at MSFT Corp) has prepared us to be amazed at what will be unveiled in PDC 2005 next week via the Channel 9 thread. Stay tuned and subscribe to this blog or other PDC-related blogs here.

    On another note: One thing that escaped a lot of people with the recent tussle between the 2 tech giants that I have posted here, is that Christian Lindholm (a key whiz at Nokia) has joined Yahoo!. Via Scoble's blog here, he seems to think that Yahoo! is the dark horse to watch out for in the future of social software engineering, which by the way Google and Microsoft are trying so hard to own or is it control ? a big piece of the pie in recent times.

    The key ? Maps. Nothing but Maps --- which reminds me I have to invest in a nice piece of GPRS hardware / software soon. Hopefully with the mass release of Windows Mobile 5 by the hardware vendors.

    Saturday, September 10, 2005 12:23:07 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Friday, September 09, 2005

    While preparing and packing to travel 14114.658437372207 km / 8770.442141252713 miles to LA, California for PDC 2005, I watched some news on the court fights between MSFT Corp and Google. As I have already pointed out to the personal ill-feelings that seems to have harboured between the 2 technology companies, more seems to have emerged as shown here and here.

    While the world is watching, Google hired an old-timer, Vinton Cerf, who is well known as the pioneer of the internet as well as his work in TCP/IP, as their Chief Internet Evangelist. Looks like they have taken a page off Microsoft's books as well in hiring evangelistic roles in their drives forward or is it the church that eveyone stole from ?

    I dont know what to make out of these news, other than is it rather inconsequential to what I do at work or at home. All I know is that Google better not come up with a new Control Protocol or something which the world doesnt need.

    Talking about inconsequential events, something of 128 bits caught my eye. That is funny.

    Now if only someone can explain to me how come the surface distance measurements from Singapore to LA, California (14114.658437372207 km / 8770.442141252713 miles) is more than Singapore to Seattle, Washington (12972.651413630075 km / 8060.831875366655 miles) when my little book-end globe and my travel air tickets is saying otherwise.

    Friday, September 09, 2005 5:21:17 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Wednesday, September 07, 2005

    With further regards to this, I have just received principle approval from INETA (who is the chair of the Birds-of-a-Feather (BOF) sessions in PDC 2005) that my session: Distributed Atomic Transactions - Wishful Thinking? is voted in as one of the 7 BOF Sessions in .

    This is good news indeed. The date and time is listed as: Tuesday, September 13, 2005 at 2100 hours (9:00 PM)

    I really hope I dont get a serious case of the jet-lag (hence, I better heed these tips) when I reach LA across thousands of miles and multiple time-zones that will prevent me from moderating a good session.

    Hope to see you there soon.

    Wednesday, September 07, 2005 2:29:09 PM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Tuesday, September 06, 2005

    Microsoft intends to offer an "adapter" under its shared source license for linking its BizTalk integration broker with Windows Communication Foundation (WCF, previously - Indigo), formerly known as Indigo.

    Monday, September 05, 2005 9:41:48 PM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Sunday, September 04, 2005

    Obviously, to rile Steve Ballmer to say that, he must also have been reading the Sun Tzu's Art of War: Chapter 2 --- Waging War

    ... and I quote ...

    16. Now in order to kill the enemy, our men must be roused to anger; that there may be advantage from defeating the enemy, they must have their rewards.

    Sunday, September 04, 2005 5:51:13 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  •  Friday, September 02, 2005

    It is sure great to know that Casey has used his brains instead of his brawn to win a ticket to PDC 2005. This dude is one who constantly churns out amazing stuff.

    Besides his contributions to putting WS-Security Specifications on the .NET Compact Framework via cfWse2, he is actively going into Artifical Intelligence, Tablet Speech Technologies, DirectX Programming and other stuff that mere mortals like me wouldnt even go near.

    On top of that, he has the sense to get his priorities right by promising to take PDC Booth Babe pictures on his blog and creating a category for it. Now, you cannot ask for a better geek.

    Since this is my first PDC as well, I am just as interested to catch those booth babes in PDC and I will be sure to post them here as well. One of the interesting comments on Casey's blog has me ROTFL and I take the liberty to re-produce it here:

    "Past experience has taught me that anything MSFT has better booth babes than just about any open source convention. The diference is that at open source conventions many times the booths are staffed by the ones writing the technology and at MSFT ones it's just some babe hired by a corporation to put tits on a product.(cont.)

    And of course I'm with the rest of the guys - Mmmmmmmm Boothbabes....*drool*"

    I hope to be able to catch you there, Mr Brains and Brawn.

    Friday, September 02, 2005 5:23:44 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions

  • Besides the BOF which I may be moderating, I am also involved in the Ask-The-Experts (ATE) sessions in PDC 2005. This time around, I will be placed in the APAC regional table, where I hope I can meet up with a lot of customers or like-minded people from my region and hopefully answer some questions based on my expertise with issues with regards to Web Services (SOAP), Security-Interoperability, Indigo (or I prefer to call it the ServiceModel, not WCF) and the likes.

    So, you are from APAC and are going to be at the PDC, I hope to see you at my table.

    Friday, September 02, 2005 12:00:20 AM (Malay Peninsula Standard Time, UTC+08:00)  #    Disclaimer 
  • Blog reactions