Message.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. public ServiceDescription ServiceDescription {
  38. get { return serviceDescription; }
  39. }
  40. #endregion // Properties
  41. #region Methods
  42. public MessagePart FindPartByName (string partName)
  43. {
  44. return parts [partName];
  45. }
  46. public MessagePart[] FindPartsByName (string[] partNames)
  47. {
  48. ArrayList searchResults = new ArrayList ();
  49. foreach (string partName in partNames)
  50. searchResults.Add (FindPartByName (partName));
  51. int count = searchResults.Count;
  52. if (count == 0)
  53. throw new ArgumentException ();
  54. MessagePart[] returnValue = new MessagePart[count];
  55. searchResults.CopyTo (returnValue);
  56. return returnValue;
  57. }
  58. internal void SetParent (ServiceDescription serviceDescription)
  59. {
  60. this.serviceDescription = serviceDescription;
  61. }
  62. #endregion
  63. }
  64. }