none
Web Service Access using WSDL.exe accessing cs file generates Unauthorized 401 error RRS feed

  • Question

  • Web Service Access using WSDL.exe  accessing cs file generates Unauthorized 401 error

    ServiceDescription wsdl = ServiceDescription.Read("<network wsdl location>");
    ABCServiceDesk WServiceDesk = new ABCServiceDesk();

    WebProxy proxy = new WebProxy("<network wsdl location>", true);
    proxy.Credentials = new NetworkCredential("<user>", "<password>", "<domain>");

    WServiceDesk.Proxy = proxy;
    WServiceDesk.PreAuthenticate = true;

    Could you please let me know why its giving the issue?

    Thursday, November 7, 2013 12:13 PM

Answers

All replies

  • Hello,

    If it is that you are using the ASP.NET Development Server (that is, your web applications are hosted on the local file system not IIS)

    If it is, we may get a 401: Unauthorized error.

    For fix this, please have a look at links below for detail and search for ‘Note that if you are using the ASP.NET Development Server’:

    http://blogs.wrox.com/article/web-services-with-aspnet/

    We will find that we need to add codes like below:

    myService.Credentials = System.Net.CredentialCache.DefaultCredentials;

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 8, 2013 7:41 AM
    Moderator
  • it is not the ASPNet development server also i have tried with default credentials it does not work.

    I have used soapUI to hit the wsdl and it works, however the above code does not.

    Saturday, November 9, 2013 4:14 PM
  • Have a check link below:

    http://stackoverflow.com/questions/1969800/web-service-fails-401-unauthorized-on-one-server-but-not-on-the-other

    Hope this will hope to you.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 11, 2013 9:31 AM
    Moderator