WebServiceHandler.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // System.Web.Services.Protocols.WebServiceHandler.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. // Lluis Sanchez Gual ([email protected])
  7. //
  8. // Copyright (C) Tim Coleman, 2002
  9. //
  10. using System;
  11. using System.Reflection;
  12. using System.Web;
  13. using System.Web.Services;
  14. using System.Web.SessionState;
  15. namespace System.Web.Services.Protocols
  16. {
  17. internal class WebServiceHandler: IHttpHandler
  18. {
  19. Type _type;
  20. HttpContext _context;
  21. HttpSessionState session;
  22. public WebServiceHandler (Type type)
  23. {
  24. _type = type;
  25. }
  26. public Type ServiceType
  27. {
  28. get { return _type; }
  29. }
  30. public virtual bool IsReusable
  31. {
  32. get { return false; }
  33. }
  34. protected HttpContext Context {
  35. set { _context = value; }
  36. }
  37. protected HttpSessionState Session {
  38. set { this.session = value; }
  39. }
  40. internal virtual MethodStubInfo GetRequestMethod (HttpContext context)
  41. {
  42. return null;
  43. }
  44. public virtual void ProcessRequest (HttpContext context)
  45. {
  46. }
  47. protected object CreateServerInstance ()
  48. {
  49. object ws = Activator.CreateInstance (ServiceType);
  50. WebService wsi = ws as WebService;
  51. if (wsi != null) {
  52. wsi.SetContext (_context);
  53. }
  54. return ws;
  55. }
  56. }
  57. }