简体   繁体   中英

Connecting to multiple web services via soap in C#

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM