【发布时间】:2014-06-18 20:09:14
【问题描述】:
热烈的问候。
我想知道如何在我的 windows phone 8.1 应用程序中使用使用 java 开发的 restful web 服务(http://192.168.10.113:8087/cisms/mobilews/)。我正在使用带有 c# 的 Visual Studio 2013。
更新:我的网络服务 (http://192.168.10.152:8087/cisms/mobilews/login/userNameCheck?userName=supervisor) 中的一种 GET 方法存在另一个问题。当我根据给定的 URL 创建以下示例代码时,它引发了另一个异常。
static string UserValidation()
{
HttpWebRequest req = WebRequest.Create("http://192.168.10.113:8087/cisms/mobilews/login/userNameCheck?userName=supervisor") as HttpWebRequest;
string result = null;
using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
{
StreamReader reader =
new StreamReader(resp.GetResponseStream());
result = reader.ReadToEnd();
}
return result;
}
http://rest.elkstein.org/2008/02/using-rest-in-c-sharp.html
下面给出了例外情况
'System.Net.HttpWebRequest' does not contain a definition for 'GetResponse' and no
extension method 'GetResponse' accepting a first argument of type
'System.Net.HttpWebRequest' could be found (are you missing a using directive or an
assembly reference?)
注意:我只在 Windows_Phone_application 中收到此错误;不在 Desktop_Application 中。
如果有人能进一步帮助我,那就太好了
提前致谢 塞巴斯蒂安
【问题讨论】:
标签: rest windows-phone-8