Thanks.
I tried following code in Eclipse on Friday, with this site:
-
http://wiki.openkm.com/index.php/SDK_for_Java_2.2
Code: Select allpackage openkm;
import java.io.IOException;
import com.openkm.sdk4j.OKMWebservices;
import com.openkm.sdk4j.OKMWebservicesFactory;
import com.openkm.sdk4j.bean.Document;
import com.openkm.sdk4j.bean.Folder;
import com.openkm.sdk4j.exception.*;
public class Main {
public static void main(String[] args) {
new Main();
}
public Main() {
connection();
}
private void connection() {
String host = "http://myIP:8080/OpenKM/";
String user = "myUser";
String password = "myPass";
OKMWebservices ws = OKMWebservicesFactory.newInstance(host, user, password);
getDocuments(ws);
}
public void getDocuments(OKMWebservices ws) {
try {
for (Folder fld : ws.getFolderChildren("/okm:root")) {
System.out.println(fld.getPath());
for (Document doc : ws.getDocumentChildren(fld.getPath())) {
String uuid = doc.getUuid();
System.out.println("\t" + uuid);
String extractedText = ws.getExtractedText(uuid);
System.out.println("\t\t" + extractedText);
}
}
} catch (DatabaseException e) {
e.printStackTrace();
} catch (WebserviceException e) {
e.printStackTrace();
} catch (PathNotFoundException e) {
e.printStackTrace();
} catch (UnknowException e) {
e.printStackTrace();
} catch (RepositoryException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Now i get the Document id's, but i can`t get the extracted text. I get this error in tomcat cmd:
Code: Select all2015-02-23 07:36:10,511 [http-bio-0.0.0.0-8080-exec-12] INFO org.springframework.ldap.core.LdapTemplate- The returnObjFlag of supplied SearchControls is not set but a ContextMapper is used - setting flag to true
2015-02-23 07:36:10,714 [http-bio-0.0.0.0-8080-exec-12] INFO org.springframework.ldap.core.LdapTemplate- The returnObjFlag of supplied SearchControls is not set but a ContextMapper is used - setting flag to true
2015-02-23 07:36:10,854 [http-bio-0.0.0.0-8080-exec-12] INFO org.springframework.ldap.core.LdapTemplate- The returnObjFlag of supplied SearchControls is not set but a ContextMapper is used - setting flag to true
2015-02-23 07:36:10,870 [http-bio-0.0.0.0-8080-exec-12] WARN org.apache.cxf.jaxrs.utils.JAXRSUtils- No operation matching request path "/OpenKM/services/rest/document/getExtractedText" is found, Relative Path: /getExtractedText, HTTP Method: GET, ContentType: application/xml, Accept: text/plain;charset=UTF-8,. Please enable FINE/TRACE log level for more details.
2015-02-23 07:36:10,870 [http-bio-0.0.0.0-8080-exec-12] WARN org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper- WebApplicationException has been caught : no cause is available
In Eclipse i get this error:
Code: Select all/okm:root/Lieferscheine
3ef7d162-21ed-43ad-9027-e1e22c5ace9d
com.openkm.sdk4j.exception.UnknowException: HTTP error code 404:
at com.openkm.sdk4j.impl.DocumentImpl.getExtractedText(DocumentImpl.java:1886)
at com.openkm.sdk4j.OKMWebservice20.getExtractedText(OKMWebservice20.java:523)
at openkm.Main.getDocuments(Main.java:38)
at openkm.Main.connection(Main.java:27)
at openkm.Main.<init>(Main.java:18)
at openkm.Main.main(Main.java:14)