locked
Is there a generic way to pass credentials to any possible web services in the world? RRS feed

  • Question

  • User-155375195 posted

    Hi,

    I am developing a generic ETL platform that is totally configurable. It needs to be able to call any web servcie - a .NET service or a non .NET service such as a PeopleSoft web servcie, a webMethod one, a SAP one, or any other possible web services in the world.

    Following link is a good start - it dynamically gets the WSDL of a given URL and create and compile the web service proxy. From there I can get the Type of the proxy then use standard reflection techniques to interogate and invoke the methods. The URL of the web service and the web method name will be provided as configuration. The list of parameters provided to call the method will be compared with the parameters of the method acquired through reflection, and exception will be thrown if it doesn't match.

    http://blogs.msdn.com/b/kaevans/archive/2006/04/27/dynamically-invoking-a-web-service.aspx

    All seems doable until you think of security! I know to access .NET services we use NetworkCredential. Some suggests setting the HTTP Authorization header explicitly.

    Is there a generic way to pass credentials to any possible web service in the world?

    Thanks!

    Thursday, July 25, 2013 3:51 AM

Answers

All replies

  • User260886948 posted

    Hi,

    In my mind, I do not think we can pass credentials to any possible web services in the world.

    And I see you have post a same question in:
    http://social.msdn.microsoft.com/Forums/en-US/349d8e20-4a1d-4657-a27b-ae9eed9c04ca/is-there-a-welltested-piece-of-generic-code-which-allows-calling-any-web-service-dynamically .

    Best Regards,
    Amy Peng




     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 31, 2013 10:04 PM
  • User-2040576253 posted

    Hi Silly,

    I found a KB related with how to pass current credentials to an ASP.NET Web Service, maybe it will hep you!

    • Start Microsoft Visual Studio .NET. Create a new ASP.NET Web Service project by using Visual C# .NET or Visual Basic .NET. By default, Service1.asmx is created.
    • Name the project MyWebService.
    • In Solution Explorer, right-click Service1.asmx, and then click View Code.
    • In the Service1.asmx.cs file (or the Service1.asmx.vb file if you used Visual Basic .NET), remove the comment on the default WebMethod HelloWorld().
    • On the Build menu, click Build Solution.
    • Type the following URL in your browser to view the Service1Web service description:
      http://localhost/MyWebService/Service1.asmx
    • To test the HelloWorld WebMethod, click the HelloWorld link. Notice that the WebMethod works as expected

    For more information about how to pass current credentials to an ASP.NET Web Service, visit the website http://support.microsoft.com/kb/813834/en-us

    Wednesday, July 31, 2013 10:09 PM
  • User1408399351 posted

    are you looking for something like this:-

    Dim myWebService As New servicename.Service()

    myWebService.Credentials = System.Net.CredentialCache.DefaultCredentials
    myWebService.UseDefaultCredentials = True

    Label1.Text = "User: " + myWebService.functionname

    Friday, August 2, 2013 5:16 AM