I actually figured it out. You basically pass in a json script to match the class in the parameter. For example:
{"Name": "John Smith", "Race": "White", "IsBold": false}
That needs to be in a string format of course. You send it using the following way:
xhr3.onreadystatechange = getUniqueID;
xhr3.open('GET', 'WallService.asmx/GetUniqueID', true);
xhr3.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr3.send(null);
xhr.onreadystatechange = OnSuccessFunction;
xhr.open('GET', 'WebService.asmx/AddPerson?person={"Name": "John Smith", "Race": "White", "IsBold": false}', true);
xhr.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhr.send(null);
The WebService should of course have a method defined to receive the request, such as
[WebMethod]
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json, UseHttpGet = true)]
public void AddPerson(Person person)
{
SomeColletion.Add(Person);
}
And of course you must have a person class(structure may work too, not sure) with the corresponding properties as defined in the json with a default constructor
public class Person
{
public Person(){}
private string _name;
public string Name
{
get{return _name;}
set{_name = value;}
}
private string _race;
public string Race
{
get{return _race;}
set{_name = _race;}
}
private bool _bold;
public bool Bold
{
get{return _bold;}
set{_bold = value;}
}
}
Now the web service method above has the script method attribute, I am not 100% sure if you need it, I didn't try without it. Maybe I should.