alexjamesbrown / JoeBlogs

Wordpress / Metaweblog API Wrapper
53 stars 40 forks source link

With v4.4 of Wordpress, no longer able to pull categories #48

Open ottadvantage opened 8 years ago

ottadvantage commented 8 years ago

After upgrading our sites to v4.4 of Wordpress, our application that uses JoeBlogs dll is failing with the following error:

response contains int value where string expected [response : array mapped to type XmlRpcCategory[] : element 0 : struct mapped to type XmlRpcCategory : member categoryId mapped to type String]

This occurs when trying to get the list of categories available on a site using following:

IEnumerable wpcats = wp.GetCategories();

Any thoughts on fixing this would be greatly appreciated.

thompjake commented 8 years ago

wordpress use to return the ID as a string, now its returned as an int. Same with parentId.

The XmlRpcCategory needs the types changed for those... Should look like this:

public struct XmlRpcCategory
{
    public int categoryId;
    public int parentId;
    public string categoryDescription;
    public string categoryName;
    public string title;
    public string htmlUrl;
    public string rssUrl;
}

notice description is now categoryDescription also...

EDIT: Just saw you made the changes already :)

ottadvantage commented 8 years ago

Yeah, ended up adjusting the XmlRpcCategory struct to reflect the int.

Also discovered that the tag_id in XmlRpcTagInfo is also now an int as well.

Ended up needing to make changes to mapper.cs as well to reflect these changes.

Didn't catch the categoryDescription change in that structure. Thanks so much, I'll make that change in my fork.

Humbledonk commented 8 years ago

Thanks thompjake, your solution worked right away!