webget

WCF ResponseFormat For WebGet

WCF offers two options for ResponseFormat attribute in WebGet annotation in ServiceContract. [ServiceContract] public interface IService1 { [OperationContract] [WebGet(UriTemplate = "greet/{value}", BodyStyle = WebMessageBodyStyle.Bare)] string GetData(string value); [OperationContract] [WebGet(UriTemplate = "foo", ...

WCF WebGetAttribute vs WebInvokeAttribute

Is the WebGetAttribute just syntactic sugar for the WebInvokeAttribute with Method = "GET"? Or is there an underlying difference? ...

WCF WebGet and ICollection<>

I'm attempting to return a generic ICollection from a REST WCF service. Should the following be possible? [ServiceContract] public class WebConfigurationManager { [WebGet] [OperationContract] public ICollection<string> GetStrings() { return new string[] { "A", "B", "C" }; } } When I attempt to execute this o...

Serializing data using IEnumerable<T> with WebGet

possible duplicate: Cannot serialize parameter of type ‘System.Linq.Enumerable… ’ when using WCF, LINQ, JSON Hi, If my method signiature looks like this, it works fine. [WebGet] MyClass[] WebMethod() If the signiature looks like this [WebGet] IEnumerable<T> WebMethod() I get the following error: Cannot serialize parameter...

Passing network path in URL

Hi, I am creating a WCF Service with a method [OperationContract] [WebGet(UriTemplate = "acl/f={fullFileName}")] string GetACL(string fullFileName); fullFileName is a full path to a network file, or a file on the host. The host is a Windows Service with webHttpBinding and behavior configuration. I want to call this from a browser us...

Ado.net dataservices BeginExecuteBatch call works on development fails on production server with Object does not match target type

We have an ado.net dataservices 1.0 call that is being passed to a [WebGet] service operation as a batch through BeginExecuteBatch. Everything works perfectly on our development server - we have the project configured to use IIS instead of the cassini web server to make it as close to our production server as we can. When we publish t...

OData and custom WCF WebGet methods

I've created an OData endpoint (using entity framework, WCF data service) and added a custom test WebGet test method like so: [WebGet(UriTemplate = "{text}")] public IQueryable<string> SplitString(string text) { if (text == null) throw new DataServiceException("text not specified"); var result = (from s in t...

Can't pass in "%26" to a WebGet UriTemplate variable in a WCF service?

I have a WCF service with this declared operation: [WebGet(UriTemplate = "Test/{*testString}")] public String Test(String testString) { return testString; } However when attempting to invoke the URL Test/You%26Me, IIS returns an error: A potentially dangerous Request.Path value was detected from the client (&). My goal is to al...

WCF: How to pass a variable number of parameters to a WebGet enabled service

We're trying to pass a variable number of key-value-pairs to our service by using the WebGetAttribute and the UriTemplate to expose a REST interface. What we want to do: [WebGet(UriTemplate="/Query/Select?{query}"] Response Query(string query); At client-side we want to specify some keys several times, e.g.: hllp://localhost/MyService...

REST methods not accessible when hosting wcf service in IIS

I have a WCF REST service that exposes a method in class GreetService: [ServiceContract] public class GreetService { [WebGet(UriTemplate = "greet/{name}")] public String GreetName(string name) { return "Hello " + name; } } Also, I registered a route in Global.asax: RouteTable.Routes.Add(new ServiceRoute("Greet...

WCF RequestFormat for WebGet and WebInvoke

I have WCF services exposed using WebGet and WebInvoke that require the data to be wrapped in xml. I would prefer to be able to return raw data without it being wrapped in xml and also allow clients the ability to invoke my service without needing to wrap the request in xml. I'm serializing the data using protocol buffers and convertin...

WCF Method that receive GET AND SOAP Requests

i created a WCf service with a method that can receive GET requests using WebGET attribute, i want the same method to receive Soap calls too (that when the programmer does a Service reference to the WCF, he will be able to call the method). my interface is: [ServiceContract] public interface IService1 { [OperationContract] [Web...