Monday, June 29, 2009

SOAP Header in a RESTful Service

I have a new project I am working on and need to integrate with several other systems. I have been in the SOAP camp up until a recent project made me pull my hair out with all the complexity of SOAP + WSDL + WS-* and all the different versions of each.

So, for my new system, I decided to bite the bullet and try my hand at a RESTful architecture...i thought, just make a schema for my types and send it. No WSDL hell, no WS-* hell. WOW. I can not believe how easy it was to get something up and running with Apache CXF. I mean....WOW.

So, my next thoughts were around how to pass things like a messageId or sourceSystemId...things i would have normally used the SOAP header for. Well, HTTP has this thing called the HTTP Header. A quick search put me on Wikipedia for a "List of HTTP Headers".

Wow, there are some "standard" ones I can use and I can also make my own! The naming convention is to prefix with a "x-". This is all too easy. Why did I ever use SOAP + WSDL + WS-* before!>!?!??!!?!?!?!??!