Mr Andersson

Posts Tagged ‘wcf

How to inject XSL stylesheet reference in WCF service response using a Message encoder

leave a comment »

In order to shape up the presentation of the responses from a RESTful WCF web service to clients such as Firefox, you’ll need to add an XSL stylesheet reference.
In order to do this, the most straight forward thing to do is to hack into your XML serializable classes and implement this using IXmlSerializable.
Since we want to control this in our service, based on the endpoint URI, this approach was not suitable for our needs.
Also, we don’t like cluttering down our serializable entity classes with “presentation logic”/encoding stuff. 🙂

I posted a question about this in MSDN Forums and got a pretty nice answer from Marco Zhou. He has written a message encoder which injects the XSL stylesheet reference on a lower level which is exactly what we wanted to do.

Thanks Marco!


Written by anderssonjohan

May 7, 2009 at 16:13

Posted in programming

Tagged with , ,

MSDN Update: WCF

leave a comment »

Today was a day covered up from the beginning to the end. Starting the day at work with upgrading to the February CTP of WinFX and messing around some more with MSBuild.
Took a nice lunch at the Microsoft office building with long-time-no-see-previous-Qbranch-collegue Niklas Nihlén, which by the way now is an Microsoft Services employee.

Going cross the city just for a lunch isn’t my thing, the actual reason for being at the Microsoft office was the afternoon MSDN update session with Johan Lindfors.
The focus of the day was to get deeper in WCF, so Johan decided to do a more complete solution by example, instead of just doing another HelloWorld-service-over-SOAP.
This sample covered a couple of things that I haven’t had the time (yet) to investigate . I.e. how easy it is to set up monitoring and tracing in WCF, both using performance counters and trace files (using the SvcTraceViewer utility).
Also I’m very interested in seeing samples using the MSMQ transport for services.

Especially working with MSMQ on NETCF on my Pocket PC that communicates over GPRS with my WCF service. That would really be something.

Although the demo solution presented today was covering most of the features in WCF, it lacked the sample of using a WCF service with BizTalk 2006.
The last days I’ve been wondering how Biztalk 2006 works out, over a longer period in time, with it’s strict schema validation together with the data contracts in WCF.
Data contracts supports versioning with both forward- and backward-compatibility. However, the schemas being generated by the WCF runtime for different versions of data contracts are not compatible with each other. And after all, it’s the schema that is used in Biztalk. So if I deploy a new Data Contract in my service, will the already deployed Biztalk 2006 application still work with the new data being sent on the wire?
My standpoint is that if you are going to do service and data contract versioning, you should preferably support that in the schema as well as in the implementation. Not one or the other; it should be both or nothing. If you have another opinion, please leave me a comment on your thoughts.

Also Johan was mentioning that he planned to hold a WCF workshop eventually. I hope that will be (at least) on the same level as the level of today’s session.

Written by anderssonjohan

April 19, 2006 at 20:27

Posted in programming

Tagged with ,