I am trying to call a Java based service that uses a Jackson object mapper from a PHP(Magento) application. In both of them I am sending the same headers and same parameters, but the CURL call works fine where as PHP call fails with following message,
'No content to map to Object due to end of input'
My curl is as follows,
curl -v -k -X POST -H "Content-Type:application/json;charset=UTF-8" -d '{"name":"john","email":"john@doe.com"}' https://localhost:8080/webapps/api/
The PHP Request is code is as follows,
$iClient = new Varien_Http_Client();
$iClient->setUri('https://localhost:8080/webapps/api/')
->setMethod('POST')
->setConfig(array(
'maxredirects'=>0,
'timeout'=>30,
));
$iClient->setHeaders($headers);
$iClient->setParameterPost(json_encode(array(
"name"=>"John",
"email"=>"john@doe.com"
)));
$response = $iClient->request();
I am not the owner of the java service that uses jackson object mapper so I have no idea what happens on other side
Any suggestions on debugging or fixing this would be appreciated