2010年7月16日星期五

[fw-webservices] Zend Rest Client PUT request

An existing API is based on Zend_Rest_Controller and a separate zend
application (1.10.6) connects to it using Zend_Rest_Client.

$data = array('var' => 'text', 'num' => 1);
// path to rest controller with a putAction(){}
$path = '/core/public/rest';
$client = new Zend_Rest_Client('http://localhost:8888');
return = $client->restPut($path,$data);

When an array is passed 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)

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

--
View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Rest-Client-PUT-request-tp2291514p2291514.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

没有评论: