I have a WCF REST service made with the rest starter kit. Using WWWForm I get no error from the www.error but my server is responding that the parametrized query was not correctly formed (missing parameters)
In Fiddler the following works as a POST (but I have to specify the Content-Length header):
http://servername.com/Players/AddPlayer?name=Pedro&email=pedro@pedro.com&phone=1231231234
Here is the code that gives me the above parameter missing issue:
string url = "http://servername.com/Players/AddPlayer";
WWWForm form = new WWWForm();
form.AddField("name", "value1");
form.AddField("email", "value2");
form.AddField("phone", "value2");
WWW www = new WWW(url, form);
StartCoroutine(WaitForRequest(www));
IEnumerator WaitForRequest(WWW www)
{
yield return www;
//
if(www.error == null)
{
Debug.Log("WWW OK: " + www.text + www.error);
}
else
{
Debug.Log("WWW NO: " + www.error);
}
}
if I change the url to be the full url (http://servername.com/Players/AddPlayer?name=Pedro&email=pedro@pedro.com&phone=1231231234
) then I get a response 400 bad request, probably because it is sending as a GET and not a POST. I’ve been at this for hours and can’t figure out what the problem is… Thanks in advance for any help!