views:

472

answers:

2

I have become quite frustrated of WCF as I just want to use this simple scenario:

  1. Provide a webservice using REST, with a UriTemplate like /method/{param1}/{param2}/ and a 3th parameter that is sent to the service as XML as POST data.
  2. Use just plain XML, no SOAP overhead.
  3. Be able to generate a proxy in Visual Studio so a .Net using client can easily use the service (don't care about SOAP overhead here).

I can create 1. and 2. but no way I can use 3. I tried adding both webHttpBinding and basicHttpBinding endpoints in my services config; I fooled around with the <services/> tag, but I just can't get this working. What am I missing here?!

N.B. I checked out this article: http://stackoverflow.com/questions/186631/rest-soap-endpoints-for-a-wcf-service but nothing what is described there seems to work here?!

+1  A: 

You cannot generate a client proxy for a webHttpBinding and basicHttpBinding uses SOAP. There is no way around this. The question you are referring to enables both bindings. You cannot cherry-pick the features you like from each binding.

However, why would you want to create a client proxy? Using the Microsoft.Http library, calling your service is as simple as,

var client = new HttpClient();
var content = HttpContent.Create(myXmlDocument);
client.Post("http://example.org/param1/param2",content)
Darrel Miller
I want VS to handle generating the entity-types etc. I managed to get something working using a basicHttpBinding for REST and a wsHttpBinding for SOAP.
Jan Jongboom
In the WCF REST Start Kit there is a function called "Paste XML as Type" that allows you to generate classes based on returned XML that is in the clipboard.
Darrel Miller
oops, that should have read "WCF REST Starter Kit Preview 2"
Darrel Miller
Yes, I saw, but it's not an internal API. .Net based customers should just be able to plug their application in, and a service reference is by far the most easy.
Jan Jongboom
If you use WCF Data Services (aka Astoria) in .Net 4 and VS2010 you will be able to "Add Service Reference" to it. I don't agree with the practice, but people want to do it.
Darrel Miller
A: 

I think this post will help u

http://blog.flair-systems.com/2010/05/how-to-consume-rest-based-services.html

Waleed Mohamed
This doesn't address the op's question which was based around generating proxies and service references and is the same 'generic' answer posted on several WCF questions with no explanation and just a link. If you are going to paste links, make them useful and include why you think the link will be useful.
Joshua Hayes