SoapServerMessage.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. //
  2. // System.Web.Services.Protocols.SoapServerMessage.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. // Lluis Sanchez Gual ([email protected])
  7. //
  8. // Copyright (C) Tim Coleman, 2002
  9. //
  10. //
  11. // Permission is hereby granted, free of charge, to any person obtaining
  12. // a copy of this software and associated documentation files (the
  13. // "Software"), to deal in the Software without restriction, including
  14. // without limitation the rights to use, copy, modify, merge, publish,
  15. // distribute, sublicense, and/or sell copies of the Software, and to
  16. // permit persons to whom the Software is furnished to do so, subject to
  17. // the following conditions:
  18. //
  19. // The above copyright notice and this permission notice shall be
  20. // included in all copies or substantial portions of the Software.
  21. //
  22. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  26. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  27. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  28. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  29. //
  30. using System.Web.Services;
  31. using System.IO;
  32. namespace System.Web.Services.Protocols {
  33. public sealed class SoapServerMessage : SoapMessage {
  34. #region Fields
  35. string action;
  36. SoapMethodStubInfo stubInfo;
  37. object server;
  38. string url;
  39. object[] parameters;
  40. #if NET_2_0
  41. SoapProtocolVersion soapVersion;
  42. #endif
  43. #endregion
  44. #region Constructors
  45. internal SoapServerMessage (HttpRequest request, object server, Stream stream)
  46. : base (stream, null)
  47. {
  48. this.action = request.Headers ["SOAPAction"];
  49. if (this.action != null)
  50. this.action = action.Trim ('"',' ');
  51. this.server = server;
  52. this.url = request.Url.ToString();
  53. ContentEncoding = request.Headers ["Content-Encoding"];
  54. }
  55. internal SoapServerMessage (HttpRequest request, SoapException exception, SoapMethodStubInfo stubInfo, object server, Stream stream)
  56. : base (stream, exception)
  57. {
  58. this.action = request.Headers ["SOAPAction"];
  59. if (this.action != null)
  60. this.action = action.Trim ('"',' ');
  61. this.stubInfo = stubInfo;
  62. this.server = server;
  63. this.url = request.Url.ToString();
  64. ContentEncoding = request.Headers ["Content-Encoding"];
  65. }
  66. #endregion
  67. #region Properties
  68. public override LogicalMethodInfo MethodInfo {
  69. get { return stubInfo.MethodInfo; }
  70. }
  71. public override string Action {
  72. get { return action; }
  73. }
  74. internal SoapMethodStubInfo MethodStubInfo {
  75. get { return stubInfo; }
  76. set { stubInfo = value; }
  77. }
  78. public override bool OneWay {
  79. get { return stubInfo.OneWay; }
  80. }
  81. public object Server {
  82. get { return server; }
  83. }
  84. public override string Url {
  85. get { return url; }
  86. }
  87. #if NET_2_0
  88. [MonoTODO]
  89. [System.Runtime.InteropServices.ComVisible(false)]
  90. public override SoapProtocolVersion SoapVersion {
  91. get { return soapVersion; }
  92. }
  93. #endif
  94. #endregion // Properties
  95. #region Methods
  96. protected override void EnsureInStage ()
  97. {
  98. EnsureStage (SoapMessageStage.AfterDeserialize);
  99. }
  100. protected override void EnsureOutStage ()
  101. {
  102. EnsureStage (SoapMessageStage.BeforeSerialize);
  103. }
  104. #if NET_2_0
  105. internal void SetSoapVersion (SoapProtocolVersion value)
  106. {
  107. soapVersion = value;
  108. }
  109. #endif
  110. #endregion // Methods
  111. }
  112. }