[xwiki-users] [XML/RPC] trying execute "confluence1.search" without success
Hi all, i'm trying to create a Java XML-RPC Client of my Xwiki instance (for now i'm using xwikie1_6m2) Documentation used : - Xwiki XML/RPC doc : http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPC - Confluence API Specification : http://confluence.atlassian.com/display/DOC/Remote+API+Specification I success with this methods : confluence1.login, confluence1.logout, confluence1.getPage, confluence1.storePage, confluence1.renderContent but i got a problem with this one : confluence1.search Confluence API talk about two ways to use search : 1) Vector search(String token, String query, int maxResults) - return a list of SearchResults which match a given search query (including pages and other content types). This is the same as a performing a parameterised search (see below) with an empty parameter map. 2) Vector search(String token, String query, Map parameters, int maxResults) - (since 1.3) like the previous search, but you can optionally limit your search by adding parameters to the parameter map. If you do not include a parameter, the default is used instead. The second way (with parameters) is not implemented on Xwiki (cf. http://jira.xwiki.org/jira/browse/XWIKI-1559 ) So how must we use the first search method (without Map parameters) ? I'm trying this : Vector searchResult = (Vector) client.execute("confluence1.search", new Object[] { p_token, p_query,new Integer(p_maxResults) }); This code return a "ClassCastException" : it's like the returned object were not a "Vector".. If then what is it ? Could you help me ? It's a great feature ! Regards Brice Vandeputte
VANDEPUTTE Brice ITLABS wrote:
Hi all,
i'm trying to create a Java XML-RPC Client of my Xwiki instance (for now i'm using xwikie1_6m2)
Documentation used : - Xwiki XML/RPC doc : http://platform.xwiki.org/xwiki/bin/view/Features/XMLRPC - Confluence API Specification : http://confluence.atlassian.com/display/DOC/Remote+API+Specification
I success with this methods : confluence1.login, confluence1.logout, confluence1.getPage, confluence1.storePage, confluence1.renderContent
but i got a problem with this one : confluence1.search
Confluence API talk about two ways to use search : 1) Vector search(String token, String query, int maxResults) - return a list of SearchResults which match a given search query (including pages and other content types). This is the same as a performing a parameterised search (see below) with an empty parameter map.
2) Vector search(String token, String query, Map parameters, int maxResults) - (since 1.3) like the previous search, but you can optionally limit your search by adding parameters to the parameter map. If you do not include a parameter, the default is used instead.
The second way (with parameters) is not implemented on Xwiki (cf. http://jira.xwiki.org/jira/browse/XWIKI-1559 )
So how must we use the first search method (without Map parameters) ?
I'm trying this : Vector searchResult = (Vector) client.execute("confluence1.search", new Object[] { p_token, p_query,new Integer(p_maxResults) }); This code return a "ClassCastException" : it's like the returned object were not a "Vector".. If then what is it ?
I don't know what it is. In Java, the method returns List<String>. To see what you have there, just use reflection: Object searchResult = client.execute... System.out.println(searchResult.getClass()) // Or whatever logging method you use This will print the exact classname, and from there you can procede further. -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Sergiu Dumitriu -
VANDEPUTTE Brice ITLABS