Devi Prasad
Devi Prasad

Reputation: 839

How to add Service References in Windows Phone 8.1

Service References are Added in WP8.1(Silverlight) But when comming to WP8.1(Runtime Apps) there is no option to add Service Reference. There is an option to add service references in that is Add Connected Services, in that it requires Cradit card Details. Is there any other way to add Service References to WP8.1(Runtime Apps).

Upvotes: 0

Views: 1746

Answers (2)

Sunil Kumar S C
Sunil Kumar S C

Reputation: 304

As Windows 8.1 does not support System.ServiceModel we haveto achieve it using REST

   private async void CallService()
            {
                HttpClient httpClient = new System.Net.Http.HttpClient();
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:18362/Service1.svc/GetData");
                HttpResponseMessage response = await httpClient.SendAsync(request);
                string data = await response.Content.ReadAsStringAsync();
                var dialog = new MessageDialog(data);
                await dialog.ShowAsync();
            }

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222582

Windows Phone Store apps in Windows Phone 8.1 do not support the System.ServiceModel namespace.

There is a workaround you can write your own code to wrap the WCF conversation.

Read here.

Upvotes: 2

Related Questions