tags:

views:

3480

answers:

4

Before I venture down the path of creating one, I was wondering if anyone knows of a utility program which will take the REST Help page of a WCF Rest Service and create the relevant Client for C# consumption.

Similar to what svcutil.exe does for WCF Services or what wsdl.exe did for web services but for WCF REST Services

Kind Regards,

Andrew

EDIT Some more detail:

Please see this link: http://msdn.microsoft.com/en-us/library/dd203052.aspx

In the restful service using the WCF Rest Starter Kit Preview 2, they supply types which will be serialized. But My intention is be able to create clients form the help page which describes schemas. Clients could then be created for C#, JavaScript, ActionScript etc.. shearly as a strongly typed version of the restful service, not a requirement or necessity. It is a program or uitlity I am wondering exists which does this

A: 

Why would you create clients for a RESTful service? You don't need one - you just need to be able to initial HTTP requests. If you would like to call the same operations via SOAP or some other method then create a new endpoint for the service and a new contract and expose mex for it so that svcutil can consume it.

Andrew Hare
If I create the restful service which accepts types, I would want to create a client library containing those types for example, for PUT and POST requests
REA_ANDREW
And I ask only with an intention to obtain a helper class, I did not mean as a necessity, :-) thanks
REA_ANDREW
You could definitely create a helper class to do the HTTP requests for you - unfortunately there is no tool from MS to do it :)
Andrew Hare
A: 

Well, there will not be any use even if you would like to abstract. ALL Rest services can use HTTP verbs like GET, POST, PUT, DELETE

So, basically what your client can have is only a static class which can accept the end point, network credentials, a name value collection which needs to be passed and the verb to use.

This would be more of a utility class rather than a client.

I don't remember seeing WSDL or some contract based on which we can write clients for the REST services.

Ramesh
When I say a client, may be the wrong temrinology, but it is this static class, which I am wondering of a tool to generate for different platforms. You can supply data with requests obviously and prior to serialization a strongly typed object is very user friendly
REA_ANDREW
Well, you can implement an Interface on all types which would return the byte data of the type which you can use in your webrequest.
Ramesh
"can only use 4 verbs" - I'm not so sure that's 100% true, any system that uses the verb system is RESTful, eg WebDAV adds LOCK and MOVE verbs. The principle is the same.
gbjbaanb
@gbjbaanb - Updated my answer.
Ramesh
A: 

I hope you don't spend too much time basing your code on the current help page of a pre-release piece of code. Are you even sure this help page provides all the information you would need to produce clients?

Also, have you seen Prerelease 2 of the WCF REST Starter kit yet? If no, go look. There's new client-side technology in there.

John Saunders
Yes working with pore release 2 and also the help page is just an XML page with an XSLT Style Sheet. They have gone into a lot of detail and something which they claim they want to roll into the framework in the not too distant future. I am working the the second pre release yes. Thanks
REA_ANDREW
+1  A: 

I think you might be looking for the WebChannelFactory. It can generate a channel class based on a WCF-attributed REST interface.

GuyBehindtheGuy