Demo Cloud

Demo Cloud

  • NA
  • 140
  • 11.8k

Getting error after consuming a asmx webservice in Xamarin

May 10 2020 2:26 AM
Hello Sir,
 
I'm getting below error after consuming the asmx Webservice in xamarin froms(cross platform)
 
Unhandled Exception:
System.Reflection.TargetInvocationException:
Please help me how to resolve this error
I have hosted the asmx webservice on godaddy account and using the same link while consuminng.
 
Below is the code,
private void BtnLogin_Clicked(object sender, EventArgs e)
{
ServiceReference1.WebService1SoapClient ws = new ServiceReference1.WebService1SoapClient();
ws.LoginAsync(usernameEntry.Text, PasswordEntry.Text);
ws.LoginCompleted += Ws_LoginCompleted;
}
private async void Ws_LoginCompleted(object sender, ServiceReference1.LoginCompletedEventArgs e)
{
try
{
if (e.Result.ValidUser)
await Navigation.PushAsync(new Page2());
else
await DisplayAlert("Error", "Username or password invalid", "Ok");
}
catch(Exception ex)
{
throw ex;
}
}
Please help 
Thanks 

Answers (3)