none
Call authenticated web service in asp.net MVC RRS feed

  • Question

  • My problem is in calling authenticated ( has username and password)  web service (asmx)  in asp.net mvc

    I did the following

    1.       I added the web service to the project by adding service reference to the solution
    2.       Tried to create proxy class of the service by using wsdl.exe  tool  using the following command  syntax

    wsdl /username:******** /password:************* /domain:********** http://**********.asmx?wsdl

    but it gave me the following error

     There was an error downloading 'http://???.asmx?wsdl'.  The request failed with HTTP status 401: Unauthorized.

    But I can view the service in browser by giving username and password

    3.        When I search for using svcutil.exe to create proxy class I found that it can't be used for authenticated web service

    I want to ask if there is another way to create proxy class , or if we can call authenticated web service  in asp.net mvc application without proxy class

    Thanks 


    Sunday, July 14, 2013 12:37 PM

All replies

  • Hi,

    >>I want to ask if there is another way to create proxy class , or if we can call authenticated web service  in asp.net mvc application without proxy class

    There are two ways I know to generate a proxy class for an XML Web Service, using "Add Web Reference" option or utilize Wsdl.exe.

    >>There was an error downloading 'http://???.asmx?wsdl'.  The request failed with HTTP status 401: Unauthorized.

    Please make sure you have specify the username and password properly when using Wsdl.exe, you can refer the details at http://msdn.microsoft.com/en-us/library/7h3ystb6(v=vs.80).aspx

    Also refer #How to: Generate an XML Web Service Proxy 

    http://msdn.microsoft.com/en-us/library/bbs97dkt(v=vs.80).aspx

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 15, 2013 9:38 AM
    Moderator
  • thank you very much for your response

    I followed the syntax of wsdl exactly and the errors still occured

    ok, I add the service as "add service reference to the solution" and by pass the user name and password it was added successfully, now how can I call the methods in the service without class file that must be created by using wsdl.exe

    can you help me 

    thanks again

    Monday, July 15, 2013 10:31 AM