Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF method sending POST instead of GET

I'm trying to create a WCF client that accesses a REST API. The API requires that a GET be used for a certain call, so I'm using the [WebGet] attribute for the method. However when I call the method, the actual call that is produced is a POST (viewed by using Fiddler). My contract is as below:

[OperationContract]
[WebGet(UriTemplate = "/statuses/public_timeline.json",
BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
List<Status> PublicTimeline();

I've also tried using [WebInvoke] with a method of GET but with no success.

like image 871
Steve Johnstone Avatar asked Jan 15 '10 16:01

Steve Johnstone


1 Answers

I was using a WCF service to do some work and then call another WCF service. It was the second service that had the issue mentioned above. The problem turned out to be how the first service was implemented.

Solution is here: http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/03a2b109-c400-49d4-891e-03871ae0d083/#416d8cbc-b855-46aa-8a6d-5d6b09db97b6

like image 60
Steve Johnstone Avatar answered Sep 28 '22 08:09

Steve Johnstone