1

我尝试在 windows phone 通用应用程序中使用 AX 动态安全 Web 服务。但我无法这样做,因为 windows phone 运行时不支持服务模型(即它不提供添加服务引用的选项)。因此,微软提出了一个使用 HttpClient 类的工作。

所以我做了以下事情:

using (HttpClient client = new HttpClient())
        {
            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://xxxxx/xppservice.svc/GetData");
            HttpResponseMessage response = await client.SendAsync(request);
            string data = await response.Content.ReadAsStringAsync();
            var dialog = new MessageDialog(data);
            await dialog.ShowAsync();
        }

但这里的问题是,我使用的服务是安全的,并且我拥有身份验证凭据。但我无法弄清楚在发送请求时如何提供它们。你能帮我么?一个

4

0 回答 0