Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Help need using Web Service

I am developing Android app witch uses Web Service. I add web service reference to my project (Right-Click on project -> Add Web Reference).
When i use Web service without authentication everything works fine, but when i set credentials they just not working. I'm getting error "The request failed with HTTP status 401: Unauthorized"
Maybe someone can help me?

This is button click event function:

button.Click += delegate {

            WebReference.WebPhysInvPocess client = new WebReference.WebPhysInvPocess(); //this is my web service
            client.Credentials = new NetworkCredential("username", "password");   //adding crediantials
            //client.Url = @"http://localhost:7053/DynamicsNAV-NAV6R2Prototype/WS/NVB%20Prototype/Codeunit/WebPhysInvPocess";

            string blabla = "";
                client.CratePhysInvBatch("S001", "RAUDONAS", ref blabla, "test");
                TextView txt = FindViewById<TextView>(Resource.Id.textView1);

            catch (Exception e)
                TextView txt = FindViewById<TextView>(Resource.Id.textView1);
                txt.Text = e.Message;



  • YamilBrachoYamilBracho VEMember

    I think tou have to add the domain name when create the NetworkCredentials


Sign In or Register to comment.