February 2008 Archives

WebHttpBinding - my unexpected Hack Week outcome

| No Comments | No TrackBacks

Novell had the second "Hack Week". At the beginning I never thought that I was going to implement WebHttpBinding from .NET 3.5 WCF (I was planning to play around some XSLT stuff but soon changed my mind). Actually I have to say, it is not an outcome from just a week - from our patch mail lists I seem to have spent about two weeks. So, I'm cheating ;-)

Anyhow, the Hack Week is over, and now I have partly implemented WebHttpBinding and its family, with a (simple) sample pair of a client and a server that sort of work.

Note that it is (and our WCF classes are) immature and not ready to fly yet.

For details

Want to know the details? Are you serious? OK ... so we have:

  • JsonReaderWriterFactory and JSON reader and writer implementations (which supports "__type" as runtime type)
  • DataContractJsonSerializer, which is JSON reader/writer-friendly implementation of XmlObjectSerializer
  • WebHttpBinding and WebMessageEncodingBindingElement which are to create MessageEncoder that 1) reads stream of JSON or XML into a Message, and/or 2) writes Message into JSON or XML
  • UriTemplate and family, which are 1) to retrieve request parameters from its requested HTTP GET URL and/or 2) to generate HTTP GET request URL.
  • WebHttpBehavior, which is to provide HTTP GET support by overwriting IClientMessageFormatter and IDispatchMessageFormatter (they are used for example to convert GET URL from and to the parameters for the runtime method (MethodInfo) call.
  • QueryStringConverter, which is used to convert request parameter string (retrieved by UriTemplate) to its expected Type.
  • WebHttpDispatchOperationSelector, which works as IDispatchOperationSelector and makes use of UriTemplateTable to find out matching a service operation based on the HTTP request.

... and couple of other bits (such as WebChannelFactory or WebServiceHost, which are really cosmetic).

We still don't have couple of things (I am enthusiastic for explaining how we are incomplete :/) :

  • configuration support
  • JsonQueryStringConverter. It's just not done yet.
  • WebScriptEnablingBehavior (and hence ASP.NET AJAX integration)
  • WebOperationContext and its helpers. I'm not sure how I can use them (especially when to instantiate IExtension<OperationContext>).

Here I haven't mentioned everything in System.ServiceModel.Syndication namespace, which is already done.

I also have current class status of System.ServiceModel.Web.dll in Olive.