title: How to encode xml doc as a base64 binary object
body: <p>I'm trying to call an xml-rpc web service method that takes 1 parameter (an array of values) key and leads. </p>
  
  <p>Key must be named 'key' and must have a value of type string.
  Leads is an xml document containing the leads data.This must be packaged as a binary object. This value must be named leads and must be of type base64.</p>
  
  <p>Alright so the SINGLE parameter for this method call in python is:</p>
  
  <pre><code> r = proxy.leads({'key': key, 'leads': doc})
  </code></pre>
  
  <p>My first question is how can I do this in c#? The closest thing .net has to that is a dictionary object which won't work for this. </p>
  
  <p>Secondly, how do I make the xml doc a binary object of type base64? Is that the same as converting a byte[] array to base64 string? Like this:</p>
  
  <pre><code> Convert.ToBase64String(byteArray)
  </code></pre>
  
  <p>Here is what the request should look like:</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="iso-8859-1"?&gt;
   &lt;methodCall&gt;
   &lt;methodName&gt;leads&lt;/methodName&gt;
   &lt;params&gt;
   &lt;param&gt;
   &lt;value&gt;
   &lt;struct&gt;
    &lt;member&gt;
    &lt;name&gt;key&lt;/name&gt;
   &lt;value&gt;
   &lt;string&gt;XXXXXXXXXXX&lt;/string&gt;
   &lt;/value&gt;
   &lt;/member&gt;
   &lt;member&gt;
   &lt;name&gt;leads&lt;/name&gt;
   &lt;value&gt;
   &lt;base64&gt;PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGxlYWRzPgogICA8bGVhZD4K
        ICAgICAgPGlkPjM5OTk3PC9pZD4KICAgICAgPEZpcnN0TmFtZT5Cb2IgSmltPC9GaXJzdE5hbWU+
        CiAgICAgIDxMYXN0TmFtZT5TbWl0aDwvTGFzdE5hbWU+CiAgICAgIDxBZGRyZXNzPjEyMzQgV2Vz
        :
        :
        ICAgICA8UmVjZWl2ZUFkZGxJbmZvPlllczwvUmVjZWl2ZUFkZGxJbmZvPgogICAgICA8bG9wX3dj
        X3N0YXR1cz5ObzwvbG9wX3djX3N0YXR1cz4KICAgPC9sZWFkPgo8L2xlYWRzPg==
   &lt;/base64&gt;
   &lt;/value&gt;
   &lt;/member&gt;
   &lt;/struct&gt;
   &lt;/value&gt;
   &lt;/param&gt;
   &lt;/params&gt;
   &lt;/methodCall&gt;
  </code></pre>
  
  <p>I'm completely stuck on this problem. Any help would be much appreciated. </p>