* ProtocolImporter.cs: Moved some code to ServiceDescriptionImporter.
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Description / HttpGetProtocolImporter.cs
1 // 
2 // System.Web.Services.Description.HttpGetProtocolImporter.cs
3 //
4 // Author:
5 //   Lluis Sanchez Gual (lluis@ximian.com)
6 //
7 // Copyright (C) 2003 Ximian, Inc.
8 //
9
10 using System;
11 using System.CodeDom;
12 using System.Web.Services;
13 using System.Web.Services.Protocols;
14 using System.Xml.Serialization;
15 using System.Xml;
16 using System.Collections;
17 using System.Configuration;
18
19 namespace System.Web.Services.Description 
20 {
21         internal class HttpGetProtocolImporter : HttpSimpleProtocolImporter
22         {
23                 #region Constructors
24         
25                 public HttpGetProtocolImporter ()
26                 {
27                 }
28                 
29                 #endregion // Constructors
30
31                 #region Properties
32
33                 public override string ProtocolName {
34                         get { return "HttpGet"; }
35                 }
36
37                 #endregion // Properties
38
39                 #region Methods
40                 
41                 protected override CodeTypeDeclaration BeginClass ()
42                 {
43                         CodeTypeDeclaration codeClass = base.BeginClass ();
44                         CodeTypeReference ctr = new CodeTypeReference ("System.Web.Services.Protocols.HttpGetClientProtocol");
45                         codeClass.BaseTypes.Add (ctr);
46                         return codeClass;
47                 }
48                 
49                 protected override Type GetInMimeFormatter ()
50                 {
51                         HttpUrlEncodedBinding bin = OperationBinding.Input.Extensions.Find (typeof(HttpUrlEncodedBinding)) as HttpUrlEncodedBinding;
52                         if (bin == null) throw new Exception ("Http urlEncoded binding not found");
53                         return typeof (UrlParameterWriter);
54                 }
55
56                 protected override bool IsBindingSupported ()
57                 {
58                         HttpBinding bin = (HttpBinding) Binding.Extensions.Find (typeof(HttpBinding));
59                         if (bin == null) return false;
60                         return bin.Verb == "GET";
61                 }
62                 
63                 #endregion
64         }
65 }