SoapServerMessage.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. #endregion
  41. #region Constructors
  42. internal SoapServerMessage (HttpRequest request, object server, Stream stream)
  43. : base (stream, null)
  44. {
  45. this.action = request.Headers ["SOAPAction"];
  46. if (this.action != null)
  47. this.action = action.Trim ('"',' ');
  48. this.server = server;
  49. this.url = request.Url.ToString();
  50. ContentEncoding = request.Headers ["Content-Encoding"];
  51. }
  52. internal SoapServerMessage (HttpRequest request, SoapException exception, SoapMethodStubInfo stubInfo, object server, Stream stream)
  53. : base (stream, exception)
  54. {
  55. this.action = request.Headers ["SOAPAction"];
  56. if (this.action != null)
  57. this.action = action.Trim ('"',' ');
  58. this.stubInfo = stubInfo;
  59. this.server = server;
  60. this.url = request.Url.ToString();
  61. ContentEncoding = request.Headers ["Content-Encoding"];
  62. }
  63. #endregion
  64. #region Properties
  65. public override LogicalMethodInfo MethodInfo {
  66. get { return stubInfo.MethodInfo; }
  67. }
  68. public override string Action {
  69. get { return action; }
  70. }
  71. internal SoapMethodStubInfo MethodStubInfo {
  72. get { return stubInfo; }
  73. set { stubInfo = value; }
  74. }
  75. public override bool OneWay {
  76. get { return stubInfo.OneWay; }
  77. }
  78. public object Server {
  79. get { return server; }
  80. }
  81. public override string Url {
  82. get { return url; }
  83. }
  84. #if NET_2_0
  85. [MonoTODO]
  86. [System.Runtime.InteropServices.ComVisible(false)]
  87. public override SoapProtocolVersion SoapVersion {
  88. get { throw new NotImplementedException (); }
  89. }
  90. #endif
  91. #endregion // Properties
  92. #region Methods
  93. protected override void EnsureInStage ()
  94. {
  95. EnsureStage (SoapMessageStage.AfterDeserialize);
  96. }
  97. protected override void EnsureOutStage ()
  98. {
  99. EnsureStage (SoapMessageStage.BeforeSerialize);
  100. }
  101. #endregion // Methods
  102. }
  103. }