I'm consuming WCF soap web services in xamarin.forms. I've added the service reference from the visual studio which generated the asynchronous operations. I've used the following code for consuming the web service
Service1Client dataCommunicator = new Service1Client();
dataCommunicator.GiveFeedbackCompleted += new EventHandler<GiveFeedbackCompletedEventArgs>(GiveFeedbackCallback);
dataCommunicator.GiveFeedbackAsync(editPhoneF.Text, monuments[pickerMonument.SelectedIndex], editRemarks.Text, imei);
}
private async void GiveFeedbackCallback(object sender, GiveFeedbackCompletedEventArgs e)
{
if (e.Result)
{
await DisplayAlert("Success", "Thank you for your valuable comments", "Ok");
}
else
{
await DisplayAlert("Oops!!", "Internal server error, please try again later", "Ok");
}
}
When I test it on simulator, I just sit and wait for the reply and when I try to use a phone like an android phone then there is an error i.e. targetinvocationexception. What should I do to resolve the issue?