开发者

WCF method sending POST instead of GET

开发者 https://www.devze.com 2022-12-16 18:16 出处:网络
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. 开发者_如何学GoHowever when I

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. 开发者_如何学GoHowever 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消