Thursday, August 16, 2007

WCF RESTful GET queries using custom entity input parameters

I am looking to map RESTful GET queries to custom objects in my WCF service layer and asked the folks over at Microsoft how to do it. To my surprise i got the reply that:
An HTTP GET request may come from a web browser, and all parameters that are
sent to the operation need to be specified in the URL. There isn't any set
way to represent a list of locations in the URL. [link]

Now, I am no expert in REST architecture, but I think of the URI template mapping stuff Microsoft are adding as much the same as RegEx which we have all used for years. I can think of a number of ways that you could map URL parameters to a custom object... even an option allowing you to define a custom mapping layer would be neat. I like the idea of using XPath, but anything that maps an input pattern to a custom object would do me.

Otherwise i need to define all my GET interfaces using simple value types rather than my custom entity objects - which can be returned fine, just not passed in...

I'm in view of flexibility and not having to think of REST interfaces in WCF as something special - other than the attributes you need to apply. I don't think anything i am asking for is difficult in any sense so i'd be interested in where any issue in doing this would lie?!

1 comment:

Anonymous said...

Have you tried .net 3.5? There exists a class named UriTemplate.