On Nov 5, 2009, at 2:35 AM, Dilipkumar Jadhav wrote:
Hello friends,
I am really stuck on retrieving a list of pages based on tags
associated to
them using the XWiki RESTful service.
The regular page fetch works fine & so do some other API calls.
However,
when I retrieve a list of pages based on tags the code returns an
empty
result. But when I lookup the same URL in a browser I can see number
of
pages listed for that tag.
Any Tags object is a complex type which returns Pages & PageSummary
objects
as output.
Could someone please help me out with just the few crucial lines
that I am
missing here. I would have to write an XML parser if this does not
work out.
However, I was really hoping that I would be able to implement this
in JAXB
itself. Thank you for your time guys.
Your code is correct (except the method getPageSummary() which doesn't
exist in my generated JAXB model classes, but this could be due to the
fact that you are generating them without the simple bindings)
I think the problem is from where you get your JAXB generated model
classes (which is not clear from the code you posted)
Anyway I tried your code and it works perfectly (modulo a renaming of
getPageSummary() to getPageSummaries()).
Since I am not able to spot the problem from your mail, I attach to
this reply the project I used to do the test. You can look at it and
find where are the differences wrt what you wrote. You could also use
it as a template for writing JAXB-clients for the XWiki RESTful API.
To execute do this:
touch pom.xml (this will ensure the re-generation of the JAXB files)
mvn install
mvn exec:java -Dexec.mainClass="org.test.App"
You will see as the output the number of pages tagged with the "admin"
tag.
Hope this help.
-Fabio