【发布时间】:2018-02-05 17:32:15
【问题描述】:
我有一个带有 GET webinvoke 的 Authenticate Rest Service。我必须在我的服务中发送用户名和密码。我必须在我的项目中使用 AsyncTask 调用它,但我不知道如何将 json 类型的参数(用户名和密码)发送到服务器。我可以这样做吗?如果是,如何?
我的网络服务:
[OperationContract]
[WebGet(UriTemplate = "/Authenticate",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped)]
Test<Person> Authenticate(string user,string password)
在我的android项目代码中,我将jsonObject转换为字符串,我想发送到服务器:
HttpGet request = new HttpGet("my URL");
response = httpClient.execute(request);
我知道 Authenticate 最好使用 POST 来确保安全,但我想测试和教育;)
谢谢
【问题讨论】:
标签: android rest web-services wcf get