-1
我有一个GET webinvoke的Authenticate Rest服务。我必须通过我的服务发送用户名和密码。我必须在我的项目中使用AsyncTask调用它,但我不知道如何使用json类型将我的参数(用户名和密码)发送到服务器。我可以这样做吗?如果是,如何?在Android项目中调用获取WebService
我的web服务:
[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);
我知道身份验证时最好使用POST为了安全,但我想测试和教育;)
谢谢
谢谢但我的请求方法是“GET”,您使用“POST”。 – Fahim
用GET替换POST –