- a service implemented with libxmlrpc-c3 chokes on a request content type
authorMichael Wallner <mike@php.net>
Tue, 10 Oct 2006 19:34:52 +0000 (19:34 +0000)
committerMichael Wallner <mike@php.net>
Tue, 10 Oct 2006 19:34:52 +0000 (19:34 +0000)
  other than sole "text/xml"

lib/XmlRpcClient.php

index c7abb2a..488e1cf 100644 (file)
@@ -54,7 +54,7 @@ class XmlRpcClient
         * @param string $namespace RPC namespace
         * @param array  $options HttpRequest options
         */
         * @param string $namespace RPC namespace
         * @param array  $options HttpRequest options
         */
-       public function __construct($url, $namespace = '', array $options = null)
+       public function __construct($url, $namespace = '', array $options = array())
        {
                $this->__request = new HttpRequest($url, HttpRequest::METH_POST, $options);
                $this->__namespace = $namespace;
        {
                $this->__request = new HttpRequest($url, HttpRequest::METH_POST, $options);
                $this->__namespace = $namespace;
@@ -70,15 +70,14 @@ class XmlRpcClient
         */
        public function __call($method, array $params)
        {
         */
        public function __call($method, array $params)
        {
-               if ($this->__namespace) {
+               if (strlen($this->__namespace)) {
                        $method = $this->__namespace .'.'. $method;
                }
                        $method = $this->__namespace .'.'. $method;
                }
-               $this->__request->setContentType("text/xml; charset=". $this->__encoding);
+               $this->__request->setContentType("text/xml");
                $this->__request->setRawPostData(
                        xmlrpc_encode_request($method, $params, 
                                array("encoding" => $this->__encoding)));
                $this->__request->setRawPostData(
                        xmlrpc_encode_request($method, $params, 
                                array("encoding" => $this->__encoding)));
-               $this->__request->send();
-               $response = $this->__request->getResponseMessage();
+               $response = $this->__request->send();
                if ($response->getResponseCode() != 200) {
                        throw new Exception(
                                $response->getResponseStatus(), 
                if ($response->getResponseCode() != 200) {
                        throw new Exception(
                                $response->getResponseStatus(),