简体   繁体   English

如何在C#.net中调用Rest Web服务并返回json字符串

[英]How to call a Rest Webservice and return json string in c#.net

I created a Rest Webservice with WebApi. 我使用WebApi创建了一个Rest Webservice。 This have 4 HTTP verbs. 这有4个HTTP动词。 That is Get,Post,Put,Delete . 那就是Get,Post,Put,Delete I want to call all these methods in webservice in C# window form application. 我想在C#窗口表单应用程序的Web服务中调用所有这些方法。 It is not possible to add service reference for this Webservcie. 无法为此Webservcie添加服务引用。 How could i call GET,Post,put and delete method? 我如何调用GET,Post,put和Delete方法? I want to pass json string with POST request. 我想通过POST请求传递json字符串。 Please help 请帮忙

如果只想调用该服务并手动传递POST数据,并手动解析结果,则可以使用System.Net.Http.HttpClient

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM