Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Can't add a Web Service

$
0
0

Hello Xamarin Developers,

I wanted to ask if any of you have managed to get your application connected to a Web Service asmx. I get always an TargetInvocation error and i have searched many times but i cant get to a solution. Basically i use it like this: I have followed some tutorials they go and change the targetFrameworkProfile from 259 to 78 in order to make a Service Reference option visible in the Portable options, so we can get the web service connected.

I write the code like this:

    private void btn_Clicked(object sender, EventArgs e)
    {
    myWebService.ServiceWebSoapClient ws = new myWebService.ServiceWebSoapClient();

    ws.LoginAsync();
    ws.LoginCompleted += Ws_LoginCompleted;
    }

    private void Ws_LoginCompleted(object sender, myWebService.LoginCompletedEventArgs e)
    {
    if (e.Result.ValidUser)
    lblTest.Text = " Service works";
    else
    Device.BeginInvokeOnMainThread(() =>
    {
    DisplayAlert("Error", "Username gabinm", "OK");
    });
    }

I checked many other tutorials but it doesnt work. On the e.result i always get the error TargetInvocation error.

And now with the .net Standard and wcf Service it gets another error, it just throws an error in scaffolding where the new option for adding a wcf service has appeared.

There are many discussions about this but i never found a solution.

If anyone could help me i would gladly appreciate it.

P.S. I know how to do it with WEB API. And also it didnt work with TODO asmx.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>