开发者

how to build web service that get post method

I am regular to send from my iphone to a web service a URL with开发者_StackOverflow all the data and i want to know if there is any way to get this stuff by sending this data with post method.


since you don't give much detail on your needs, or what you have, I'll give you some broad resources:

Consuming WCF / REST service using JQuery ajax post

WebInvoke Method=“POST” or "GET" for a REST Service on WCF

Get raw xml from POST method in service implemented using WCF WebHttp API

If you need more specific help, please include more details regarding your needs and what code you have now.


I personally find MVC to provide a nice and organized way of publishing REST APIs. for example if you want a REST method that returns the time base on an offset on post you would create something like this

public class TimeController: Controller
{
        [HttpPost]
        public JsonResult GetTime(int offset)
        {
           return new JsonResult { Time= DateTime.Now().AddHours(offset) };
        }
}

you can access that action if you post to http://appurl/TimeController/GetTime

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜