Adding Web Refrence at runtime
-
Hello All I have a group of applications that working on a LAN and there was another application -reporting tool- that may use the databases of all other applications through web services -each application provide a web service to give access to its database-, and this is working good, the problem is that I had to make a new build for the reporting tool each time a new application added to the group, this is absolutely not happening every day, but I was think in an optimized solution, which I think is to make the reporting tool call the IIS in every machine on the network to get the web services that is available, and then provide the admin by a list of the web services then prompt him to add reference to the web services that he wish to connect with, this means that I should add web references at the runtime. I don’t know if I can call the IIS to do that, or if I can add web references at runtime, but I thought on the problem as a logic which I don’t know if it can be done or not. my question is, is this can be done?, and how to do it?
-
Hello All I have a group of applications that working on a LAN and there was another application -reporting tool- that may use the databases of all other applications through web services -each application provide a web service to give access to its database-, and this is working good, the problem is that I had to make a new build for the reporting tool each time a new application added to the group, this is absolutely not happening every day, but I was think in an optimized solution, which I think is to make the reporting tool call the IIS in every machine on the network to get the web services that is available, and then provide the admin by a list of the web services then prompt him to add reference to the web services that he wish to connect with, this means that I should add web references at the runtime. I don’t know if I can call the IIS to do that, or if I can add web references at runtime, but I thought on the problem as a logic which I don’t know if it can be done or not. my question is, is this can be done?, and how to do it?
If the methods you use in the reporting tool, are the same in each of the web services, you can create your own (single) proxy. The easiest way is to use WSDL tool and possibly strip off everything you don't need from the generated file. Now you can better control the change of the URL and also other properties of the proxy. Also when you add the generated class to you code, you don't need to add web references anymore. Hope this helps you, Mika
The need to optimize rises from a bad design. My articles[^]
-
If the methods you use in the reporting tool, are the same in each of the web services, you can create your own (single) proxy. The easiest way is to use WSDL tool and possibly strip off everything you don't need from the generated file. Now you can better control the change of the URL and also other properties of the proxy. Also when you add the generated class to you code, you don't need to add web references anymore. Hope this helps you, Mika
The need to optimize rises from a bad design. My articles[^]
-
Few links I quickly found: - Web Services Description Language Tool (Wsdl.exe)[^] - Creating an XML Web Service Proxy[^] - Reverse Engineering Through WSDL.EXE[^] - Invoking a Web Service Without Web Reference[^] I hope these would help you. The idea is that the services you call contain the same web methods (at least the ones you use). So when you add a new service or want to change the service, you actually use the same proxy and change the url.
The need to optimize rises from a bad design. My articles[^]