work with WSDL service - why?

IT-AleXIT-AleX RUMember ✭✭

Good day for all!
WSorry for my bad english, but I hope you anderstand me...

I`m new for Xamarin developer... and I try call web service for login... but have a error - System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid. Check InnerException for exc…

I try do all as (video in spoiler)

https :// www. youtube. com / watch ?v= vSxkOuBb8YY

but have a error when press login button ...

my web service - deployed on server on my work example: http :// servername. company. local/ MobileService/ WebService.asmx?wsdl - it`s OK and if test it - all work, but not in android emulator (I use VS2017 Community with Xamarin 4.7.10.22 - all default)...
One what I do - change CSPROJ TargetFrameworkProfile to Profile78 (for adding Web references)

And that is all... got Error...

BUT! If I call http :// www. webservicex. net/ country. asmx?wsdl - THIS WORK!!!

Comment - my service (not work)
` public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
btnLogin.Clicked += BtnLogin_Clicked;
}

    private void BtnLogin_Clicked(object sender, EventArgs e)
    {
        MobileService.WebServiceSoapClient service = new MobileService.WebServiceSoapClient();
        service.LoginCompleted += Service_LoginCompleted;
        service.LoginAsync(usernameEntry.Text, passwordEntry.Text);
        //CountryXService.countrySoapClient client = new CountryXService.countrySoapClient();
        //client.GetCountriesCompleted += Client_GetCountriesCompleted;
        //client.GetCountriesAsync();
    }


    private void Client_GetCountriesCompleted(object sender, CountryXService.GetCountriesCompletedEventArgs e)
    {
        Device.BeginInvokeOnMainThread(() =>
        {
            try
            {
                    DisplayAlert("Mess", e.Result, "Ok"); // IT IS WORK!!!!
            }
            catch (Exception ex)
            {
                DisplayAlert(ex.Message, ex.InnerException.Message, "Ok");
            }
        });
    }

    private void Service_LoginCompleted(object sender, MobileService.LoginCompletedEventArgs e)
    {
        Device.BeginInvokeOnMainThread(() =>
        {
            try
            {
                if (e.Result.ValidUser) // <----- e.Rusult is Error!!!
                {
                    Navigation.PushModalAsync(new Page2());
                }
                else
                {
                    DisplayAlert("Error", "user name or pass is not valid", "Ok");
                }
            }
            catch (Exception ex)
            {
                DisplayAlert(ex.Message, ex.InnerException.Message, "Ok");
            }
        });
    }
}

`

Why it is? :(

Answers

  • IT-AleXIT-AleX RUMember ✭✭

    any ideas? ((

  • IT-AleXIT-AleX RUMember ✭✭

    update!
    I start project as UWP + WebService!
    And can step to webservice code!

    and what I have:

    call void ->
    service.LoginAsync(usernameEntry.Text, passwordEntry.Text);
    usernameEntry.Text, passwordEntry.Text - has values! 111,222
    when step into webservice code
    public Result Login(string userMail, string userPass)
    userMail and userPass - is null!!!!

    why it`s happening?

Sign In or Register to comment.