Questions tagged [webget]

45 questions
23
votes
4 answers

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)] …
mgamer
  • 13,580
  • 25
  • 87
  • 145
14
votes
2 answers

WebGet with No Parameters or UriTemplate Fails

I have a RESTful WCF web service with the following API: [WebGet(ResponseFormat = WebMessageFormat.Json)] MyResponseContract GetFileInfo(); When attempting to hit endpoint (using SOAPUI) I see the following error message: The server encountered an…
Will Custode
  • 4,576
  • 3
  • 26
  • 51
14
votes
1 answer

Return html format on wcf service instead of json or xml

I have the operation contract: [System.ServiceModel.Web.WebGet( UriTemplate = "c" , BodyStyle = WebMessageBodyStyle.Bare )] [OperationContract] string Connect ( ); and I have it implemented as: public string Connect ( ) { return "
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
9
votes
3 answers

Can't find [WebInvoke] and [WebGet]

I can't find [WebInvoke] and [WebGet]. I have already add System.ServiceModel reference. what is the problem? I use .NET Framwork 4
Darshana
  • 2,462
  • 6
  • 28
  • 54
9
votes
2 answers

WCF WebGetAttribute vs WebInvokeAttribute

Is the WebGetAttribute just syntactic sugar for the WebInvokeAttribute with Method = "GET"? Or is there an underlying difference?
puffpio
  • 3,402
  • 6
  • 36
  • 41
5
votes
1 answer

WCF WebGet Capture HTTP Referrer?

I have a self-hosted WCF app using Basic HTTP Binding, no SSL, running in a console app on .NET Framework 4.0. I have a WebGet Attribute on a method to which returns a human-readable string as a "smoke test". If I had an ASP.NET webforms page, I…
Snowy
  • 5,942
  • 19
  • 65
  • 119
4
votes
1 answer

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 SplitString(string text) { if (text == null)…
Toad
  • 15,593
  • 16
  • 82
  • 128
4
votes
2 answers

Is WebGet functionally equivalent to WebInvoke(Method = "GET")?

This question already asks what I'm asking, but I want some clarification on the answer. The answer states that WebGet and WebInvoke are similar, and that the primary difference is the Method parameter. But if the Method parameter is set to "GET",…
David says Reinstate Monica
  • 19,209
  • 22
  • 79
  • 122
4
votes
0 answers

WFF WebGet vs. WebInvoke(Method = "GET")

All posts I have seen regarding these two attributes focus on the different HTTP verbs available with WebInvoke. But when GET is specified as the method, is there any difference between these two, is there any benefit of one over the other, or is it…
Chad Schouggins
  • 3,440
  • 2
  • 23
  • 29
3
votes
1 answer

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…
mattw
  • 71
  • 1
  • 4
3
votes
1 answer

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…
JoeGaggler
  • 1,207
  • 1
  • 13
  • 28
3
votes
2 answers

Serializing data using IEnumerable 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…
Jim
  • 14,952
  • 15
  • 80
  • 167
2
votes
1 answer

WCF Web Api optional parameters in UriTemplate

How to declare optional parameters in UriTemplate in WCF Web Api ? For example : [WebGet(UriTemplate = "?culture={culture}")] HttpResponseMessage> GetAll(); I need culture to be optional parameter. If culture is not passed I…
Radenko Zec
  • 7,659
  • 6
  • 35
  • 39
2
votes
1 answer

c# string arguments in attributes

Is it possible somehow to move out the string value declaration in an attribute usage? Specifically I have: [WebGet(UriTemplate = "/myResource/{id}")] But I would rather have something like: [WebGet(UriTemplate =…
tycom iplex
  • 131
  • 1
  • 8
2
votes
1 answer

GET works, but POST fails when calling WCF from JQuery on remote server

I have two OperationContracts on my test WCF service, when I test it locally both CheckGet and CheckPost work. When I call them both on the web server from the web server they both work, but when I call them from the remote server from my local…
user1904444
  • 23
  • 1
  • 5
1
2 3