I'm having issues connecting to an ASP.Net web service using PHP.
The web service is known to be operational, since it's returning data when we connect using Javascript from the same domain, but when I attempt to connect using PHP I receive the following error:
HTTP/1.1 500 Internal Server Error Content-Type: application/json; charset=utf-8 Server: Microsoft-IIS/7.5 jsonerror: true X-Powered-By: ASP.NET Date: Tue, 17 May 2011 03:40:17 GMT Connection: close Content-Length: 819
{"Message":"Invalid JSON primitive: birthday.","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\
[etc]
The Content-Type is set to "application/json; charset=utf-8" in PHP, and we are trying to send a parameter called "birthday" using the following POST data in PHP:
$post_data = array(
'birthday' => 'none'
);
I think the ASP web service is not able to parse the 'birthday' parameter for some reason, but I'm not sure why.
Do I need to explicitly encode the POST data as JSON from PHP before calling the web service?
Thanks.
FiddlerorWireSharkcomparing the working code to the non-working code, and see if there are any differences.