Hello folks,

The REST example at
http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI  seems to
be working fine to quite some extent.

I retrieved the xwiki.org Main.WebHome page in the XML format. However, the
same code returns empty result if I look for the Main.WebHome on
localhost:8080/xwiki.

Is there something that I need to enable on my localhost XWiki instance. I
see that xwiki.org has been upgraded to version 2.0.2 which is the same
version on my machine.

I am using tomcat 6.0.18 with MySql 5.

 

Also, the URL
http://www.xwiki.org/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome
returns a well formed XML document.

However, the URL
http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome
returns an error :   XML Parsing Error: no element foundLocation:
http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome Line
Number 1, Column 1: in Mozilla FF 

& the error : XML document must have a top level element. Error processing
resource 'http://localhost:8080/xwiki/rest/wikis/xwiki/spaces/... in IE8

 

 

I am retrieving XML info through the following code:

 

import javax.xml.bind.JAXBContext;

import javax.xml.bind.JAXBContext.*;

import javax.xml.bind.JAXBException;

import javax.xml.bind.Unmarshaller;

import org.apache.commons.httpclient.*;

import org.apache.commons.httpclient.methods.GetMethod;

import java.io.IOException;

import java.io.InputStream;

 

public class Main{

 

public static void main(String[] args) throws JAXBException, IOException {

 

HttpClient httpClient = new HttpClient();

JAXBContext context = JAXBContext.newInstance("org.xwiki");

Unmarshaller un = context.createUnmarshaller();

 

GetMethod getMethod = new
GetMethod("http://xwiki.org/xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome
");

getMethod.addRequestHeader("Accept", "application/xml");

httpClient.executeMethod(getMethod);

InputStream is = getMethod.getResponseBodyAsStream();

System.out.println(getMethod.getResponseBodyAsString());

//Page page = (Page) un.unmarshal(getMethod.getResponseBodyAsStream());

    }

}

 

Any help would be greatly appreciated. Thank you.

 

Regards,

Dilipkumar Jadhav

 

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to