Bug 194357 - KBlog generates invalid structured XML-RPC requests for the metaWeblog API
Summary: KBlog generates invalid structured XML-RPC requests for the metaWeblog API
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdepimlibs
Classification: Applications
Component: kblog (show other bugs)
Version: 4.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-28 00:26 UTC by Berend Dekens
Modified: 2017-01-07 22:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Berend Dekens 2009-05-28 00:26:41 UTC
Version:            (using KDE 4.2.3)
OS:                Linux
Installed from:    Gentoo Packages

KBlogger and Bilbo both use KBlog as the backend interface to send XML-RPC requests to and from blogging sites (unless I understood something wrong).

When posting a new message using the metaWeblog.newPost the categories are set as a QStringList object. The conversion from this object to the XML structure is done incorrectly: a <array> element should have a <data> element holding multiple <value> elements which should hold the <string> element.

For some reason, the generated XML structure ommits the <value> element and only inserts the <string> elements. According to the XML-RPC specs at http://www.xmlrpc.com/spec , this is not allowed and the PHP XML-RPC library which is used for example in Joomla! refuses to parse the XML structure generated for the XML-RPC communication with a "Invalid request payload xmlrpc element STRING cannot be child of DATA" error.

For example, the KBlog backend sends this to the server:
<member>
   <name>categories</name>
   <value>
      <array>
         <data>
            <string><![CDATA[General blog entries [Blog]]]></string>
         </data>
      </array>
   </value>
</member>

This is not valid markup as it should be:
<member>
   <name>categories</name>
   <value>
      <array>
         <data>
            <value>
               <string><![CDATA[General blog entries [Blog]]]></string>
            </value>
         </data>
      </array>
   </value>
</member>

The wrong format is rejected and results in an error, the 2nd example is accepted by the PHP XML-RPC library and also works for Joomla!.

Perhaps other blog systems are less strict and do not mind the omission of the <value> elements but systems following the specifications to the letter throw errors when KBlog tries to send the messages.

Note: I am assuming KBlog does the actual conversion from QStringList to the XML structure, if I am in error, please let me know which part of KDE handles XML-RPC.
Comment 1 Berend Dekens 2009-05-28 16:54:33 UTC
On the topic of invalid markup, in wordpressbuggy.cpp the generated struct should be enclosed in a <value> element. I reported this on the Bilbo forum as well as they currently use a forked version of KBlog.

In wordpressbuggy.cpp on line 78 change:
xmlMarkup += "<param><struct>";
into:
xmlMarkup += "<param><value><struct>";

On line 123:
xmlMarkup += "</member></struct></param>";
into:
xmlMarkup += "</member></struct></value></param>";

In line 177:
xmlMarkup += "<param><struct>";
into
xmlMarkup += "<param><value><struct>";

And on line 227:
xmlMarkup += "</member></struct></param>";
into
xmlMarkup += "</member></struct></value></param>";

The resulting XML is now XML-RPC compliant.

This does not solve the category error in the metaWeblog API but since wordpressbuggy.cpp generates its own XML, it does not seem to share the functionality that metaweblog.cpp uses. The result is that the WordPress API generates the correct category syntax while the metaWeblog API does not.

Or should I open a seperate bug report for the suggested fix for wordpressbuggy.cpp?
Comment 2 Berend Dekens 2010-02-09 00:20:32 UTC
Any updates on this? KDE 4.4 is about to be released and my Blogilo 4.3.98 is throwing the same errors as before...
Comment 3 Christian Weilbach 2010-02-10 19:34:02 UTC
Should be fixed for 4.4.1 and 4.5. WordpressBuggy should be already fixed but for all other APIs which use kxmlrpcclient I have not fixed it there.
Comment 4 Christian Weilbach 2010-02-10 19:35:57 UTC
I mean of course that I have fixed it there (in kxmlrpcclient), sorry.
Comment 5 Denis Kurz 2016-09-24 20:56:15 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kdepim (version 5.0 or later, as part of KDE Applications 15.08 or later), it gets closed in about three months.
Comment 6 Denis Kurz 2017-01-07 22:20:59 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.