HttpGetProtocolImporter.cs 1.5 KB

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