Using reflection to call an ASP.NET web service

前端 未结 8 1440
一向
一向 2021-02-04 17:25

Say I have an ASMX web service, MyService. The service has a method, MyMethod. I could execute MyMethod on the server side as follows:

MyService service = new          


        
8条回答
  •  无人及你
    2021-02-04 18:01

    // Try this ->

        Type t = System.Web.Compilation.BuildManager.GetType("MyServiceClass", true);
        object act = Activator.CreateInstance(t);                
        object o = t.GetMethod("hello").Invoke(act, null);
    

提交回复
热议问题