Dynamically call the webservices from .NET Core

Garlapati Sai Ram Suman 1 Reputation point
2022-08-29T03:58:19.783+00:00

Hi Team

I want to provide a GUI to the end user , where the user can provide the URL for his WSDL or the Web service End point.
With this as the inpout the method to be invoked , how can I dynalicall generated the required proxy classes

How can I achive this in .Net Core. I head WSE was used long back but it is no longer under support. Any URLS and leads to help me with this query

User enters a WSDL or a web service URL , the name of the method to invoke in the GUI ,
Internally I create a instance and invoke this method

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,274 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lan Huang-MSFT 25,716 Reputation points Microsoft Vendor
    2022-08-29T08:09:39.657+00:00

    Hi @Garlapati Sai Ram Suman ,
    In the case that the service information such as interface and address is unchanged, no matter how the server changes the implementation of the service,
    it can dynamically invoke the service through the channel factory(Core 1.0, Core 1.1). It does not affect the client's calls.
    https://learn.microsoft.com/en-us/dotnet/api/system.servicemodel.channelfactory-1?view=netcore-1.1

    You can also try using System.Net and SOAP to dynamically call a Web service
    You can use HttpWebRequest and HttpWebResponse in the System.Net namespace to build dynamic client-invoked Web services.
    https://learn.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest?view=net-6.0
    https://learn.microsoft.com/en-us/dotnet/api/system.net.httpwebresponse?view=net-6.0

    You can also try using the WCF dotnet-svcutil tool for .NET Core.
    dotnet-svcutil tool is a .NET tool that retrieves metadata from a web service on a network location or from a WSDL file, and generates a WCF class containing client proxy methods that access the web service operations.
    https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-svcutil-guide?tabs=dotnetsvcutil2x
    Best regards,
    Lan Huang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments