atrijitdasgupta / wordpress-java

Automatically exported from code.google.com/p/wordpress-java
Other
0 stars 0 forks source link

Error while getting PageList #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new WordPress object
2. Call method getPageList
3. Go through the PageList and print out PageTitle

What is the expected output? What do you see instead?
I expected to see the title of all the pages but got exception instead

What version of the product are you using? On what operating system?
0.4

Please provide any additional information below.
Exception:
[Fatal Error] :57:154: Attribute "type" was already specified for element 
"link".
Exception in thread "main" redstone.xmlrpc.XmlRpcException: The response could 
not be parsed.
    at redstone.xmlrpc.XmlRpcClient.handleResponse(Unknown Source)
    at redstone.xmlrpc.XmlRpcClient.endCall(Unknown Source)
    at redstone.xmlrpc.XmlRpcClient.invoke(Unknown Source)
    at redstone.xmlrpc.XmlRpcProxy.invoke(Unknown Source)
    at net.bican.wordpress.$Proxy0.getPageList(Unknown Source)
    at net.bican.wordpress.Wordpress.getPageList(Wordpress.java:434)
    at com.vnguyen.helloandroid.TestWordPress.main(TestWordPress.java:20)
Caused by: redstone.xmlrpc.XmlRpcException: A problem occured during parsing
    at redstone.xmlrpc.XmlRpcParser.parse(Unknown Source)
    ... 7 more
Caused by: org.xml.sax.SAXParseException: Attribute "type" was already 
specified for element "link".
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    ... 8 more

Original issue reported on code.google.com by vnguyen972 on 3 Dec 2010 at 4:09

GoogleCodeExporter commented 9 years ago
I couldn't reproduce the problem, maybe we're doing different things. That's 
what I tried:

Wordpress wp = new Wordpress("username", 
"pass","http://www.blog.com/xmlrpc.php");
 for (PageDefinition pageDefinition : wp.getPageList()) {
  System.out.println(pageDefinition.getPage_title());
}

And I'm using the latest version of wordpress. Can you let me know if you're 
doing something else, and what version of Wordpress you're using?

Original comment by can.bican@gmail.com on 4 Dec 2010 at 10:19

GoogleCodeExporter commented 9 years ago
That's exactly what I did. I suspect that there was something wrong with the 
site I'm accessing. I have wordpress 3.00 installed on the site. The reason I 
said that because I even tried the XmlRpcAPI using some other lib and gets the 
same error... I can't call any data from Wordpress

Original comment by vnguyen972 on 4 Dec 2010 at 7:35

GoogleCodeExporter commented 9 years ago
Did you make sure you allow xmlrpc requests via the wordpress admin interface?

Original comment by can.bican@gmail.com on 4 Dec 2010 at 9:23

GoogleCodeExporter commented 9 years ago
Hmmm... I am not sure... let me check.

Original comment by vnguyen972 on 4 Dec 2010 at 9:41

GoogleCodeExporter commented 9 years ago
Okay, I saw that in the admin tool, under Writing settings... it was off so I 
enable it but still got the same error why calling getPageList... Isn't that 
setting only for Posting (writing) to the blog?

[Fatal Error] :83:154: Attribute "type" was already specified for element 
"link".
What does it really mean? I googled the error and found nothing... apparently 
no one has encountered it... 

Original comment by vnguyen972 on 4 Dec 2010 at 9:46

GoogleCodeExporter commented 9 years ago
Please quote your code, maybe you're overseeing a mistake, or I am.

Original comment by can.bican@gmail.com on 4 Dec 2010 at 9:49

GoogleCodeExporter commented 9 years ago
Here is my code, very basic test:

    public static void main(String[] args) {
        try {
            Wordpress wp = new Wordpress("userName","password","http://www.bluelightpictures.com/");
            List<PageDefinition> pages = wp.getPageList();
            System.out.println("Here are the pages:");
            for (PageDefinition pageDefinition : pages) {
              System.out.println(pageDefinition.getPage_title());
            }
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (XmlRpcFault e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

Original comment by vnguyen972 on 4 Dec 2010 at 10:49

GoogleCodeExporter commented 9 years ago
Might it be that the url is http://www.bluelightpictures.com/xmlrpc.php and not 
http://www.bluelightpictures.com/ only?

Original comment by can.bican@gmail.com on 5 Dec 2010 at 9:12

GoogleCodeExporter commented 9 years ago
That's it. I'm new to this so I didn't know about the URL to call :) Thanks.
I'm running into another issue, when I try to call wp.getPages(); It gives me 
some warnings and No IDs to be printed. Not sure what it means... the code is 
below the warnings:

Warning: value "15" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "115" is invalid for "page_id", setting it to "null"
Warning: value "4020" is invalid for "wp_page_order", setting it to "null"
Warning: value "15" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "93" is invalid for "page_id", setting it to "null"
Warning: value "4010" is invalid for "wp_page_order", setting it to "null"
Warning: value "15" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "82" is invalid for "page_id", setting it to "null"
Warning: value "6000" is invalid for "wp_page_order", setting it to "null"
Warning: value "0" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "34" is invalid for "page_id", setting it to "null"
Warning: value "2000" is invalid for "wp_page_order", setting it to "null"
Warning: value "0" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "30" is invalid for "page_id", setting it to "null"
Warning: value "3000" is invalid for "wp_page_order", setting it to "null"
Warning: value "0" is invalid for "wp_page_parent_id", setting it to "null"

    public static void main(String[] args) {
        try {
            Wordpress wp = new Wordpress("userName",
                    "password","http://www.bluelightpictures.com/xmlrpc.php");
            List<Page> pages = wp.getPages();
            System.out.println("Here are the pages:");
            for (Page page : pages) {
              System.out.println(page.getTitle()+ ":" + page.getPage_id());
            }
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (XmlRpcFault e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

Original comment by vnguyen972 on 6 Dec 2010 at 12:57

GoogleCodeExporter commented 9 years ago
Now we're talking about a bug :) I either didn't test fields that issued the 
warnings or wordpress became more picky about their types. Anyway, I changed to 
code to run without warnings and set correct values. Please check it from svn 
and let me know if it works.

Thanks.

Original comment by can.bican@gmail.com on 7 Dec 2010 at 9:37

GoogleCodeExporter commented 9 years ago
Sorry if I sound like a n00b :) but what is svn? :)

Original comment by vnguyen972 on 7 Dec 2010 at 9:45

GoogleCodeExporter commented 9 years ago
Svn is the way I store the code on googlecode. Contrary to downloading a 
snapshot of my code from downloads, you can get the latest sources from there. 
Have a click at it:

http://code.google.com/p/wordpress-java/source/checkout

If you're using eclipse or similar, you can easily find a plugin for using svn 
with your IDE. I'm sorry but this text box is just not sufficient to explain it 
all, so please see if you can make it - I don't know what OS you're using but 
if it's OSX or Unix/Linux you can use it from command line, just one command in 
the link I mentioned above:

svn checkout http://wordpress-java.googlecode.com/svn/trunk/ wordpress-java

Original comment by can.bican@gmail.com on 7 Dec 2010 at 9:54

GoogleCodeExporter commented 9 years ago
I'm using Eclipse on Windows ... okay, let me check that out... and see if I 
could get it

Original comment by vnguyen972 on 7 Dec 2010 at 10:02

GoogleCodeExporter commented 9 years ago
Oh and thank you!!! :)

Original comment by vnguyen972 on 7 Dec 2010 at 10:02

GoogleCodeExporter commented 9 years ago
I'll be releasing precompiled packages from time to time, so stay tuned.

Original comment by can.bican@gmail.com on 7 Dec 2010 at 10:06

GoogleCodeExporter commented 9 years ago
Sorry the status says "fixed", but the bug still exists, as of what copy i 
have..
It gives..

Warning: value "15" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "115" is invalid for "page_id", setting it to "null"
Warning: value "4020" is invalid for "wp_page_order", setting it to "null"
Warning: value "15" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "93" is invalid for "page_id", setting it to "null"
Warning: value "4010" is invalid for "wp_page_order", setting it to "null"
Warning: value "15" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "82" is invalid for "page_id", setting it to "null"
Warning: value "6000" is invalid for "wp_page_order", setting it to "null"
Warning: value "0" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "34" is invalid for "page_id", setting it to "null"
Warning: value "2000" is invalid for "wp_page_order", setting it to "null"
Warning: value "0" is invalid for "wp_page_parent_id", setting it to "null"
Warning: value "30" is invalid for "page_id", setting it to "null"
Warning: value "3000" is invalid for "wp_page_order", setting it to "null"
Warning: value "0" is invalid for "wp_page_parent_id", setting it to "null"

I am not able to retrieve the Page ID , which is very crucial, for other tasks, 
like comments, edits, drafts...

Any other way to get Page ID's....?
Post ID's work fine..

Original comment by vipulnsw...@gmail.com on 10 Feb 2011 at 3:55

GoogleCodeExporter commented 9 years ago
Can you check that

1. You check out from svn, not download the files (I haven't released changes 
yet)
2. You provide the correct url for xmlrpc.php

Original comment by can.bican@gmail.com on 21 Feb 2011 at 12:35

GoogleCodeExporter commented 9 years ago
I assume this is over by now.

Original comment by can.bican@gmail.com on 27 Feb 2011 at 9:29

GoogleCodeExporter commented 9 years ago
Issue 28 has been merged into this issue.

Original comment by c...@bican.net on 11 Feb 2012 at 9:42