我正在使用Zend_HTTP_Client对Web服务进行REST调用。该服务是支持通常的CRUD嫌疑人的数据服务。Zend_HTTP_Client - 如何在PUT上设置内容类型?
服务本身运行正常。我可以使用Zend客户端连接到该服务,但有一个例外:
Web服务的“创建”方面要求要通过PUT HTTP请求中的字符串发送要创建的资源ID。当我让使用Zend客户端请求时,我得到以下异常:
Error: exception 'Exception' with message 'Object was not created. Server returned status code: 500 for URL [the service url], body: Class: Zend_Http_Client_Exception Message: Cannot handle content type '' automatically. Please use Zend_Http_Client::setRawData to send this kind of content.
我犹豫使用setRawData这个功能,因为我只发送一个文本字符串值,所以它不是就像我发送原始二进制数据或任何东西。解决此问题的最佳方法是什么,以便客户可以将PUT呼叫转到我的服务?