I need a way to configure my contract (method) to take a variable number of parameters. Because you should be able to pass 2 or 10 parameters to this end point.
Btw, the reason I return a Stream
is because I serialize my data to XML manually (not important).
ServiceInterface:
[OperationContract]
Stream UpdateAgent(string token, string agentId, string newAgentName, string param1);
Service implementation:
[WebGet(UriTemplate = "/update_agent/{token}/{agentId}/{newAgentName}/{param1}")]
public Stream UpdateAgent(string token, string agentId, string newAgentName, string param1)
{
//do stuff here
}
This method is only available with this URI request:
/update_agent/<long number of chars and numbers>/123456/John Silver/<some ID of associated data>
But I want to be able to pass more params of strings, if I want to. I know that alters the end point of the contract - but is this possible?
To clarify, the following should trigger the same endpoint:
/update_agent/<long number of chars and numbers>/123456/John Silver/dom_81/pos_23
/update_agent/<long number of chars and numbers>/123456/John Silver/dom_120/dat_12/pos_10
/update_agent/<long number of chars and numbers>/123456/John Silver/con_76
Can anyone help me - because clearly I can't make 10,000 methods taking care of each extra parameter...