Click here to Skip to main content
12,823,984 members (44,224 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Telerik
Hi all,
I developed a wcf service by using windows Azure Cloud service.
Now i need to call that wcf service into my application. I am using Rad center windows phone application. I added wcf service in service reference but not possible to create
a reference in page1.xaml.cs . any suggestions appreciate.

Note: I already goggled i got below link but not useful to my concept.

thanks in advance.
Posted 21-Jun-12 19:47pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you've successfully created a service reference in the same project as that code, then it shouldn't be too hard to code it. Getting your config file correct is fiddly, but the code probably goes something like this:

Say my Service Reference is called MyServiceReference and the web service itself is called MyWebService. We'll say that you have a method called Get42 which returns the number 42 as an int.

public Page1()
    this.Loaded += new RoutedEventHandler(Page1_Loaded);

void Page1_Loaded(object sender, RoutedEventArgs e)
    // Instantiate a web service client
    // Note that the name MyWebService gets the word Client appended
    MyServiceReference.MyWebServiceClient proxy = new MyServiceReference.MyWebServiceClient();
    // Create a handler for the webservice - note it has the word Completed on the end of the web service operation included 
    proxy.Get42Completed += new
    // Make the call to the webservice, note it has the word Async appended

void Get42Completed(object sender,
    MyServiceReference.Get42CompletedEventArgs e)
    // Always check for errors before examining the result
    if(e.Error != null)
    // Read the result

Here are a few things to watch out for...

Your service reference should be set to allow Async calls, so right click it, and choose "Configure service reference" and check that. Also check that your web service hasn't got its operations marked as static as that makes them invisible to the client.

Hope that helps.

Please mark as the answer if this answers your question.
Sandeep Mewara 24-Jun-12 4:37am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170308.1 | Last Updated 23 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100