[英]Mono for android using Web Service with authorization
I am developing an Android app which uses a Web Service. 我正在开发一个使用Web服务的Android应用程序。 I added a web service reference to my project (Right-Click on project -> Add Web Reference).
我为我的项目添加了一个Web服务引用(右键单击项目 - >添加Web引用)。 When I use the web service without authentication everything works fine, but when I set credentials they are just not working.
当我使用没有身份验证的Web服务时,一切正常,但是当我设置凭据时,它们就无法正常工作。 I'm getting this error:
我收到这个错误:
The request failed with HTTP status 401: Unauthorized
请求失败,HTTP状态为401:未授权
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. 当我将代码编译为windows .net应用程序时,一切正常。
你检查了你的代表团吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.