Dynamically invoke XML Web Services - significantly improved

GotDotNet User Sample: Dynamically invoke XML Web Services - significantly improved: "It is pure reflection prgramming in .NET.
E.g.
DynamicWebServiceProxy ws = new DynamicWebServiceProxy();
string ns = 'eYesoft.Tools.Web.Services.DynamicProxy.';

ws.WSDL = 'http://localhost/CTWS/Service1.asmx?WSDL';
ws.TypeName = 'Service1';
ws.MethodName = 'GetOrder';

// get all types of the dynamic assembly
Type[] types = ws.ProxyAssembly.GetTypes();
// get a certain type by name - watch out for fully qualified name
Type t = ws.ProxyAssembly.GetType(ns + 'Order');
...

Then create an instance of the type by using reflection.

object result = Activator.CreateInstance(t);
result = ws.InvokeCall();

Christian "

No comments:

Ramadan - What is it?

  Ramadan is one of the most important and holy months in the Islamic calendar. It is a time of fasting, prayer, and spiritual reflection fo...