Help need using Web Service

Hello.
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 = "";
            try
            {
                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;
            }

        };

Answers

  • YamilBrachoYamilBracho VEMember

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

    HTH

Sign In or Register to comment.