Hacker News new | ask | show | jobs
by beagle3 4053 days ago
WCF is passable iff both your sides are .NET - in which case it is an overkill, slow and unneededly complex. If your other endpoint is not .NET, it's all of that and also horribly broken.

Have enumerations somewhere? WCF will encode them as integers. Have or need a date/time value in a format that isn't what WCF generates or expects - e.g. JSON Date() expressions? Doable, but error prone, slow and unintuitive (and ... In that case - why use WCF at all?)

WTF would have been a better name for this library.

2 comments

I remember so much pain trying to get a .NET WCF and Java SOAP service to work together when they should have been compatible. This is an amusing read: http://harmful.cat-v.org/software/xml/soap/simple :)

The UK National Rail API is a WCF SOAP endpoint so I wrote this open source proxy with Web API to make it easier for non-.NET developers more familiar with restful JSON: https://github.com/jpsingleton/Huxley

Strangely that's the one area where I've always had success with WCF.
> Have enumerations somewhere? WCF will encode them as integers.

Can you give an example of this? I have never had this problem.

> Have or need a date/time value in a format that isn't what WCF generates or expects

In my experience this is a data-interchange problem that will always exist. It is not unique to WCF.

I do agree that if you are using REST/Json then you should avoid WCF.

On phone, can't copy/paste.

But e.g. Enum Direction { East, West, North, South };

Put that as a field in a structure that's sent/received through WCF; on JSON it will encode as numbers, regardless on any annotation you put. On XML iirc too - though I don't remember for sure. Want them as strings? You have to encode/decode yourself. But if you use .NET on both sides , you wouldn't notice unless you sniff the connection - until you change the enumeration order, for example, and all help breaks loose. Which is to be expected of a binary protocol, but completely unexpected for verbose text formats like JSON or XML.

> On XML iirc too

It serializes correctly.

For JSON you need an appropriate converter but as I said I would not use WCF with JSON.