Zend Rest Client PUT request

For programming and general questions on Zend Framework
Post Reply
Posts: 1
Joined: Wed Jul 14, 2010 2:31 pm

Zend Rest Client PUT request

Post by nchochkov » Wed Jul 14, 2010 2:38 pm

Hello I have a rest interface based on Zend_Rest_Controller and another zend application (10.6) connects to it using Zend_Rest_Client.

All methods work fine and as expected apart from PUT:

When I pass an array as a second argument to Zend_Rest_Client::restPut($path, $data) I get this exception instead of the expected response from my server app.

Message: Cannot handle content type '' automatically. Please use Zend_Http_Client::setRawData to send this kind of content.

Stack trace:

#0 /web/b2c_bank/library/Zend/Http/Client.php(957): Zend_Http_Client->_prepareBody()
#1 /web/b2c_bank/library/Zend/Rest/Client.php(159): Zend_Http_Client->request('PUT')
#2 /web/b2c_bank/library/Zend/Rest/Client.php(187): Zend_Rest_Client->_performPost('PUT', Array)
#3 /web/b2c_bank/library/My/Service/Rest/ClientCore.php(48): Zend_Rest_Client->restPut('/api/', Array)

can anyone help my with finding out what might be wrong with it?

p.s. all other REST methods (GET, DELETE, POST) work fine in the same configuration

Posts: 2
Joined: Fri Jun 11, 2010 6:29 pm

Re: Zend Rest Client PUT request

Post by toddrimes » Tue Jul 20, 2010 5:58 am

just had this issue myself. Instead of passing in the $_POST array you should use $request->getRawBody() as per http://framework.zend.com/manual/en/zen ... quest.html ("Note: Retrieving the Raw POST Data").


Post Reply