Hello everyone,
I've got a problem when calling to a function of a codeunit published as a WebService. This is the past of the code where I call the function, and the error:
Have to say, that I have other codeunit published, and I execute every day functions from that CU, calling them from Console Applications, scheduled periodically in the server.
So, basically, the difference between the 2 scenarios, is that in the case that generates a 401 error:
1- I'm calling the function from a ASP.net WebApp instead of a Console application
2-The functions return a value to the app
Any hint about this issue?
Thank you very much!
Answers
I would start to investigate based on the http error code. 401 represents an error in authorisation.
https://httpstatuses.com/401
Good luck.
Thank you for your answer Hannes, I understand what that error means. But I'm quite lost becasuse has I've said, I already have console apllications running function from another CoudeUnit without any problem. So the problem probably will lie on the differences I exposed before. If the problem has to do with the task of returning a value from the codeunit, I think i should gave some autorization to the server instance, am I right? Because I'm quite sure it's not an ASP or console application issue...
ws.Credentials = new System.Net.NetworkCredential("user", "pwd", "domain");
Hi Aitor,
Using user/password is one solution. If you do not want to handle the password security inside your code then you can try to configure your web server for windows authentication (disable anonymous authentication) and, if needed, configure delegation between your NAV server and your web server.
I hope this will help someone