title: C# - xml-rpc with a single method and 2 named param
body: <p>This is a refined and focused question that I asked last week about a project I am working on to use the web service <a href="http://www.upcdatabase.com" rel="nofollow">http://www.upcdatabase.com</a> via xml-rpc .net. I am working in c#.  The request requires a named method (“lookup”) as well as 2 named parameters (“rpc_key”) and (“upc”), both types are stings. My initial thought was to create an interface like this:</p>
  
  <pre><code>[XmlRpcUrl("http://www.upcdatabase.com/xmlrpc")]
     public interface UPChelp : IXmlRpcProxy
    [XmlRpcMethod("lookup")]
    upcLookupValues lookupUPC(string rpc_key, string upc);
  
  upcLookupValues is a struct that is returned defined as:
  public struct upcLookupValues
      {
          public string upc;
          public int pendingUpdates;
          public string status;
          public string ean;         
          public string issureCountryCode;
          public bool found;
          public string description;
          public string message;
          public string size;
          public string issureCountry;
          public string noCacheAfterUTC;
          public string lastModifiedUTC;
      }
  </code></pre>
  
  <p>The proxy generation I have been working with is</p>
  
  <pre><code>UPChelp upcObj = XmlRpcProxyGen.Create&lt;UPChelp&gt;();
  upcLookupValues myLookup = upcObj.lookupUPC("000000000000000000000000000000000000000000”, "639382000393");
  </code></pre>
  
  <p>I get a response of invalid parameters..  So while reading the xml-rpc faq I came across:</p>
  
  <blockquote>
    <p>“2.20 How do I call an XML-RPC method
    with a variable number of parameters?
    The params keyword can be used to call
    an XML-RPC method which take a
    variable number of parameters. For
    example, if an XML-RPC method takes a
    variable number number of integer
    parameters it could be defined like
    this: 
    [XmlRpcUrl("http://www.cookcomputing.com/notimpl.rem")]
    public interface IParams :
    IXmlRpcProxy {    [XmlRpcMethod]<br>
    int UseNumbers(params int[] numbers);
    }  And called like this:  IFoo proxy =
    (IFoo)XmlRpcProxyGen.Create(typeof(IFoo));
    proxy.SendMultipleParameters(1);
    proxy.SendMultipleParameters(1, 2,
    3);”</p>
    
    <p>Alternatively the parameters in this
    example can be supplied as an array of
    type int[]:  int[] parameters = new
    int[] { 1, 2, 3 };
    proxy.SendMultipleParameters(parameters);"</p>
  </blockquote>
  
  <p>My problem is I don’t understand how to apply this concept to my project, (I am a newbie), I tried upcLookupValues[]  parameters = new string[] { "rpc_key", "upc" };
  But I get a cant implicitly convert string[] to readUPC.upcLookupvalues[].  I also don’t understand how to define the new proxy for submission.  My fingers are crossed this post makes sense. I am sure you C# xml-rpc folks are laughing right now.</p>