XmlRpcBoxcarRequest.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. namespace Nwc.XmlRpc
  2. {
  3. using System;
  4. using System.Collections;
  5. using System.IO;
  6. using System.Xml;
  7. using System.Net;
  8. using System.Text;
  9. using System.Reflection;
  10. /// <summary>Class that collects individual <c>XmlRpcRequest</c> objects and submits them as a <i>boxcarred</i> request.</summary>
  11. /// <remarks>A boxcared request is when a number of request are collected before being sent via XML-RPC, and then are sent via
  12. /// a single HTTP connection. This results in a speed up from reduced connection time. The results are then retuned collectively
  13. /// as well.
  14. ///</remarks>
  15. /// <seealso cref="XmlRpcRequest"/>
  16. public class XmlRpcBoxcarRequest : XmlRpcRequest
  17. {
  18. /// <summary>ArrayList to collect the requests to boxcar.</summary>
  19. public IList Requests = new ArrayList();
  20. /// <summary>Basic constructor.</summary>
  21. public XmlRpcBoxcarRequest()
  22. {
  23. }
  24. /// <summary>Returns the <c>String</c> "system.multiCall" which is the server method that handles boxcars.</summary>
  25. public override String MethodName
  26. {
  27. get { return "system.multiCall"; }
  28. }
  29. /// <summary>The <c>ArrayList</c> of boxcarred <paramref>Requests</paramref> as properly formed parameters.</summary>
  30. public override IList Params
  31. {
  32. get {
  33. _params.Clear();
  34. ArrayList reqArray = new ArrayList();
  35. foreach (XmlRpcRequest request in Requests)
  36. {
  37. Hashtable requestEntry = new Hashtable();
  38. requestEntry.Add(XmlRpcXmlTokens.METHOD_NAME, request.MethodName);
  39. requestEntry.Add(XmlRpcXmlTokens.PARAMS, request.Params);
  40. reqArray.Add(requestEntry);
  41. }
  42. _params.Add(reqArray);
  43. return _params;
  44. }
  45. }
  46. }
  47. }