Hi,
I am writing a microcontroller project which uses an ethernet controller (with a TCPIP Stack) to send HTTP Post requests.
The nature of the project means the number of parameters to be passed to the webmethod will vary (i.e. some of the Parameter names will vary as well as the total number of parameters to be sent).
I understand that a normal webmethod requires a fixed number of arguments to be passed to the webmethod.
i.e - The webmethod below requires TWO parameters to be passed.
[WebMethod]
public string save(string Parameter1, string Parameter2)
{
return "Hello World";
}
I am aware that one can use "overloaded" webmethods (Messagename) to allow for a different number of [pre-defined] parameters to be sent but this seems inflexible and would require a lot of duplication.
I discovered a snippet of code that allows for an XML string to be passed to a Webmethod as a single parameter (to be manually parsed).
[WebMethod]
public string save(string saveXml)
{
return "Hello World";
}
My question is - Is the second method I mention acceptable practice and is there a JSON equivalent?
NOTE: I am already sending JSON for the OUTGOING response, I am looking for a JSON solution for INCOMING parameters.