4

I am developing an Android app which uses a Web Service. I added a web service reference to my project (Right-Click on project -> Add Web Reference). When I use the web service without authentication everything works fine, but when I set credentials they are just not working. I'm getting this 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;
        }

    };

When I compile the code as a windows .net application everything works.

Alex Peck
  • 4,603
  • 1
  • 33
  • 37

1 Answers1

0

Have you checked your delegation?

Gmorken
  • 311
  • 1
  • 6
  • 13