Message.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // System.Web.Services.Description.Message.cs
  3. //
  4. // Author:
  5. // Tim Coleman ([email protected])
  6. //
  7. // Copyright (C) Tim Coleman, 2002
  8. //
  9. using System.Collections;
  10. using System.Web.Services;
  11. using System.Xml.Serialization;
  12. namespace System.Web.Services.Description {
  13. public sealed class Message : DocumentableItem {
  14. #region Fields
  15. string name;
  16. MessagePartCollection parts;
  17. ServiceDescription serviceDescription;
  18. #endregion // Fields
  19. #region Constructors
  20. public Message ()
  21. {
  22. name = String.Empty;
  23. parts = new MessagePartCollection (this);
  24. serviceDescription = null;
  25. }
  26. #endregion // Constructors
  27. #region Properties
  28. [XmlAttribute ("name", DataType = "NCName")]
  29. public string Name {
  30. get { return name; }
  31. set { name = value; }
  32. }
  33. [XmlElement ("part")]
  34. public MessagePartCollection Parts {
  35. get { return parts; }
  36. }
  37. [XmlIgnore]
  38. public ServiceDescription ServiceDescription {
  39. get { return serviceDescription; }
  40. }
  41. #endregion // Properties
  42. #region Methods
  43. public MessagePart FindPartByName (string partName)
  44. {
  45. return parts [partName];
  46. }
  47. public MessagePart[] FindPartsByName (string[] partNames)
  48. {
  49. ArrayList searchResults = new ArrayList ();
  50. foreach (string partName in partNames)
  51. searchResults.Add (FindPartByName (partName));
  52. int count = searchResults.Count;
  53. if (count == 0)
  54. throw new ArgumentException ();
  55. MessagePart[] returnValue = new MessagePart[count];
  56. searchResults.CopyTo (returnValue);
  57. return returnValue;
  58. }
  59. internal void SetParent (ServiceDescription serviceDescription)
  60. {
  61. this.serviceDescription = serviceDescription;
  62. }
  63. #endregion
  64. }
  65. }