Consume Web Service, WCF dynamically

1

Normally you add a Web Reference in the project and you're ready to consume it from there. But it turns out that I need to do it in the following way.

In my App.Config I will be adding the WebService ( .asmx ) and WCF ( .svc ) that I need to consume, I do not know what methods they have, I do not know what parameters they ask for. What I need is to do something similar to what SoapUI does, where "download" the definitions and build the Resquest to send, the user fills the parameters and makes the request.

At the moment for the request I think HttpWebResquest , but to download the definition and put together the Resquest no. Has anyone done, read something similar to what I plan to do?

Greetings.

    
asked by Archer_A 02.06.2016 в 19:30
source

1 answer

2

The truth is a bit complicated what you request. To reach a good port, you would need to do the following:

  • Retrieve the description of the service (wsdl) given your uri.
  • Generate the proxy code dynamically from the downloaded definition.
  • Compile the code and expose it in your application (using Reflection)
  • You can review this article in which the process is explained and has source code for you to carry out your tests. Generate proxy code for a web service dynamically

        
    answered by 10.09.2016 в 19:02