2 // System.Web.Services.Protocols.WebServiceHandlerFactory.cs
5 // Tim Coleman (tim@timcoleman.com)
6 // Dave Bettin (dave@opendotnet.com)
7 // Gonzalo Paniagua Javier (gonzalo@ximian.com)
8 // Lluis Sanchez Gual (lluis@ximian.com)
10 // Copyright (C) Tim Coleman, 2002
11 // Copyright (c) 2003 Ximian, Inc. (http://www.ximian.com)
15 using System.Web.Services;
16 using System.Web.Services.Configuration;
18 using System.Collections.Specialized;
20 namespace System.Web.Services.Protocols
22 class DummyHttpHandler : IHttpHandler
24 bool IHttpHandler.IsReusable {
28 void IHttpHandler.ProcessRequest (HttpContext context)
34 public class WebServiceHandlerFactory : IHttpHandlerFactory
39 public WebServiceHandlerFactory ()
43 #endregion // Constructors
47 public IHttpHandler GetHandler (HttpContext context, string verb, string url, string filePath)
49 Type type = WebServiceParser.GetCompiledType (filePath, context);
51 WSProtocol protocol = GuessProtocol (context, verb);
52 IHttpHandler handler = null;
54 if (!WSConfig.IsSupported (protocol))
55 return new DummyHttpHandler ();
58 case WSProtocol.HttpSoap:
59 handler = new HttpSoapWebServiceHandler (type);
61 case WSProtocol.HttpPost:
62 handler = new HttpPostWebServiceHandler (type);
64 case WSProtocol.HttpGet:
65 handler = new HttpGetWebServiceHandler (type);
67 case WSProtocol.Documentation:
68 handler = new SoapDocumentationHandler (type, context);
75 static WSProtocol GuessProtocol (HttpContext context, string verb)
77 if (context.Request.PathInfo == null || context.Request.PathInfo == "")
79 if (context.Request.RequestType == "GET")
80 return WSProtocol.Documentation;
82 return WSProtocol.HttpSoap;
86 if (context.Request.RequestType == "GET")
87 return WSProtocol.HttpGet;
89 return WSProtocol.HttpPost;
93 public void ReleaseHandler (IHttpHandler handler)