<p>We are trying to create a web-service that we plan to pass a variable amount of variables to it.</p>

<p>Can this be done?</p>

<p>Basically instead of pass all possible parameters we wish to pass only the set values and use the defaults set in the web-service.</p>

<p>Here is an example of the XML we are looking to send, we would sent an unknown amount of functions depending on the needed return.</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;soap:Body&gt;
    &lt;WebMethod xmlns="http://tempuri.org/"&gt;
      &lt;domains&gt;
        &lt;function1&gt;
        &lt;title&gt;Some Title&lt;/title&gt;
        &lt;type&gt;25&lt;/type&gt;
        &lt;/function1&gt;
    &lt;function2 /&gt;
    &lt;function3&gt;
        &lt;param&gt;13&lt;/param&gt;
    &lt;/function3&gt;
      &lt;/domains&gt;
    &lt;/WebMethod&gt;
  &lt;/soap:Body&gt;
&lt;/soap:Envelope&gt;
</code></pre>

<p>Will this work or should we do a different way?</p>

[{'answer_id': 34132, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 0, 'selected': False, 'text': '<p>You can simply pass a variable-length array as a parameter.</p>\n'}, {'answer_id': 34138, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': 0, 'selected': False, 'text': "<p>If you dont like the idea of an Array (this is not slating Konrad's answer - you may have differing param types) you can pass complex objects (i.e. objects that you made yourself).. The downside is that you cannot then test using the ASMX page, but would need to do it all in code (which isn't really a bad thing, especially if you are used to it).</p>\n"}, {'answer_id': 34150, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 4, 'selected': True, 'text': '<p>I would pass in an xml document instead of doing concreate functions for this.  </p>\n\n<p>The webservice in your example is leaky - the consumer needs to know too much about this interface and the implementation of the webservice internally.  </p>\n\n<p>XML Document and then tie that with an XSD. That way you can prevalidte the input to the webservice.  </p>\n\n<p>Take a look at these</p>\n\n<p><a href="http://www.ibm.com/developerworks/webservices/library/ws-docstyle.html" rel="nofollow noreferrer">IBM Developer</a>\n<a href="http://forums.asp.net/p/1253455/2323689.aspx#2323689" rel="nofollow noreferrer">ASP.NET Forum</a></p>\n\n<p>I would also recommend using this for testing webservices and its free\n<a href="http://www.codeplex.com/wsstudioexpress" rel="nofollow noreferrer">WSStudio</a></p>\n'}, {'answer_id': 34229, 'author': 'icelava', 'author_id': 2663, 'author_profile': 'https://Stackoverflow.com/users/2663', 'pm_score': 0, 'selected': False, 'text': '<p>I agree with littlegeek. Do not make your web service is hard method. Make it a receiving end point to receive <em>messages</em>. Particularly, a Command Message.</p>\n\n<p><a href="http://www.eaipatterns.com/CommandMessage.html" rel="nofollow noreferrer">http://www.eaipatterns.com/CommandMessage.html</a></p>\n'}]
['https://Stackoverflow.com/questions/34128', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3582/']