Connecting to multiple web services via soap in C#

佐手、 提交于 2020-01-06 04:20:06

问题


I'm building a service that aggregates a bunch of data from multiple soap web services. There's a standard on what the web service call and soap package is supposed to look like. But of course, everybody's version is just a little bit different primarily in namespace usage. Is there any why in c# to dynamically fetch a wsdl and create the soap package based on it at runtime? I don't want to have to run the wsdl utility statically for every new service that comes online.


回答1:


It is possible to do what you are talking about, but it would be very expensive (system resources) and slow. Look into creating a provider based model where you have all your services already referenced and then route the request to the correct service.

The provider model will let you load new providers using reflection just like you are asking.

Here is an example.

http://dotnetslackers.com/articles/designpatterns/HowToWriteAProviderModel.aspx

it can be adapted to services.



来源:https://stackoverflow.com/questions/735077/connecting-to-multiple-web-services-via-soap-in-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!