[wp-xmlrpc] About usage of mw_newMediaObject

Peter Westwood peter.westwood at ftwr.co.uk
Thu Jul 9 12:22:08 UTC 2009


> On Wed, Jul 8, 2009 at 12:15 PM, Peter
> Westwood<peter.westwood at ftwr.co.uk> wrote:
>
>> Could you share the XML as seen on the wire so we can see exactly what
>> you
>> are sending.
>
>
> send: 'POST /xmlrpc.php HTTP/1.0\r\nHost:
> kushaldas.wordpress.com\r\nUser-Agent: xmlrpclib.py/1.0.1 (by
> www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length:
> 3190\r\n\r\n'
> send: "<?xml
> version='1.0'?>\n<methodCall>\n<methodName>wp.uploadFile</methodName>\n<params>\n<param>\n<value><int>1</int></value>\n</param>\n<param>\n<value><string>myusername</string></value>\n</param>\n<param>\n<value><string>mypassword</string></value>\n</param>\n<param>\n<value><struct>\n<member>\n<name>bits</name>\n<value><string>iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADdgAAA3YBfdWCzAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAcvSURBVFiFpVdLaxTbFv72rkeqqtvuGJKckEcnkAQ70cnRVgcXhMQgguLhioM4CQQnkgTPDwhkIAQdS8wkE52pE/F6DQavBsHJxQNKbPMgBkHkGJO06fSr3nvfgdl1qxKjcs6GTVV3Ve3vW99ae+21COccPxqEEDI6Oqpvbm72AThHCOkC8AuAhu1XVgF85pwvAPjX/v37/zM+Pm7yn1icfO8dQggZGhpqJoSMAeiXZTkuyzIkSYIkSSCEAAA45/B9H77vw/M8eJ5XAnCHc351cnLy4/eI7ElgZGTE4JyPUUqvKIqiJxIJdHd3o7a2FtXV1Ugmk4jH4wCAUqmEra0t5PN5bGxsYH5+HoVCAa7rmoyxG4SQqxMTE5WfJjA8PNwM4L6iKJn6+npkMhl0dXVB0zQQQgLLwwqIK+cctm1jYWEBL1++xNraGnzf/4Mx9s+bN29+/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QJnDv3j2sr6+js7MTnZ2dSCaTu86U7XVWZc75oud5/xByCQLv37/Ho0ePAktzuRyWlpaQTqcDUMZY5J4xhsXFRczPzwMA1tbW8OLFC5w7dw5NTU1gjMF1Xdi2LXLDIgXwwPM8OI4Dx3ECK1paWgLmYj58+BBLS0ui7ILneXBdN7hfWFjAgwcPIrsimUwilUoFlgucbbc+kE6dOvXRNM3fJUlSxR5VFAWUUiSTSaysrESCMpvN4vPnz0in05Fz/+7du3j69Ckcx4lsyb6+PiSTSbiui0qlgnw+j3w+D9M0S9XV1UN0fHzcZIzdsSwLlUoFpmnCdV34vo/W1lYcPnx4V8m1vr4eWC8UWF9fj6gFAJlMBm1tbYHllUoF5XIZlmWBMXZnfHzcpJxzTgi56rquWS6XUSwWUalUAnccPXoUR44cCVTgnKOzszMAF7OjoyN4LsCPHz8eAS8WiyiVSnAcxySEXOWccwoA26XzDdM0USgUUCwWYZpmQOLYsWM4ffo0EokEOOdob2//JgHh8zNnzuwCLxQK2Nragmma4JzfmJyc/CjyADjnfGRk5KrjOCdLpVImXIAKP6dSKbS1teHDhw9IJBJwXTeyvxOJBM6ePYuWlpYgXoTft7a28OXLFxSLRdi2/YewHtijKNV1vTGZTKK6uhqJRAKGYUBRlKAh2Vkd70wyvu8H4IVCAZubmyLwdhWle5blmqY1xuPxoAHRdR2apkVIfCvDicNHBFw+n0exWIRlWT8uy8NKUErvS5KUMQwDsVgMsVgMhmFAVdVAjbCbRC4Qh0+5XEa5XBbH8M83JiElIq2ZpmkQU1EUKIqy67xwHAe2bcOyLFiWBcdx/lprFjzcozkNNyuCQKgxhe/7Jc7532tOdxLZ2Z4TQn7hnDdsP1/lnP+l9vx/UpiIvWvw+IUAAAAASUVORK5CYII=
 </
>  string></value>\n</member>\n<member>\n<name>type</name>\n<value><string>image/png;
> charset=binary</string></value>\n</member>\n<member>\n<name>name</name>\n<value><string>draft.png</string></value>\n</member>\n</struct></value>\n</param>\n</params>\n</methodCall>\n"
> reply: 'HTTP/1.1 200 OK\r\n'
> header: Server: nginx
> header: Date: Thu, 09 Jul 2009 08:29:07 GMT
> header: Content-Type: text/xml;charset=utf-8
> header: Connection: close
> header: Vary: Host,Accept-Encoding
> header: X-hacker: If you're reading this, you should visit
> automattic.com/jobs and apply to join the fun, mention this header.
> header: Content-Length: 528
> body: '<?xml version="1.0"?>\n<methodResponse>\n  <params>\n
> <param>\n      <value>\n        <struct>\n
> <member><name>file</name><value><string>/home/wpcom/public_html/wp-content/blogs.dir/523/1124198/files/2009/07/draft5.png</string></value></member>\n
>  <member><name>url</name><value><string>http://kushaldas.files.wordpress.com/2009/07/draft5.png</string></value></member>\n
>  <member><name>type</name><value><string>image/png;
> charset=binary</string></value></member>\n</struct>\n      </value>\n
>   </param>\n  </params>\n</methodResponse>\n'
> {'url': 'http://kushaldas.files.wordpress.com/2009/07/draft5.png',
> 'type': 'image/png; charset=binary', 'file':
> '/home/wpcom/public_html/wp-content/blogs.dir/523/1124198/files/2009/07/draft5.png'}
>

base64 data should be inside a <base64> tag not a <string> tag (
http://www.xmlrpc.com/spec)

Hope that helps

Peter




More information about the wp-xmlrpc mailing list