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
and the web service itself is called
. We'll say that you have a method called
which returns the number 42 as an int.
this.Loaded += new RoutedEventHandler(Page1_Loaded);
void Page1_Loaded(object sender, RoutedEventArgs e)
MyServiceReference.MyWebServiceClient proxy = new MyServiceReference.MyWebServiceClient();
proxy.Get42Completed += new
void Get42Completed(object sender,
if(e.Error != null)
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.