Difference between revisions of "Java client - OpenKM 6.2"
From OpenKM Documentation
Line 3: | Line 3: | ||
First, we need to generate the client stuff using this command. Keep on mind that you need JDK 1.6 to run it: | First, we need to generate the client stuff using this command. Keep on mind that you need JDK 1.6 to run it: | ||
− | $ wsimport -d client -s client http://localhost:8080/OpenKM/ | + | $ wsimport -d client -s client http://localhost:8080/OpenKM/OKMAuth?wsdl |
You can use the following script to generate a complete OpenKM webservices client library: | You can use the following script to generate a complete OpenKM webservices client library: | ||
Line 10: | Line 10: | ||
#/bin/bash | #/bin/bash | ||
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMAuth?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMDocument?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMFolder?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMSearch?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMNotification?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMRepository?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMPropertyGroup?wsdl |
− | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/ | + | wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMWorkflow?wsdl |
jar cvf okm-ws-client-2.1.jar com | jar cvf okm-ws-client-2.1.jar com | ||
rm -rf com | rm -rf com | ||
+ | </source> | ||
+ | |||
+ | == Authentication == | ||
+ | |||
+ | <source lang="java"> | ||
+ | package com.openkm.ws.test; | ||
+ | |||
+ | import com.openkm.ws.client.Auth; | ||
+ | import com.openkm.ws.client.Auth_Service; | ||
+ | |||
+ | public class Authentication { | ||
+ | public static void main(String[] args) { | ||
+ | try { | ||
+ | Auth_Service authService = new Auth_Service(); | ||
+ | Auth auth = authService.getAuthPort(); | ||
+ | |||
+ | // Login | ||
+ | String token = auth.login("okmAdmin", "admin"); | ||
+ | System.out.println("Es: " + token); | ||
+ | |||
+ | // Logout | ||
+ | okmAuth.logout(token); | ||
+ | } catch (Exception e) { | ||
+ | e.printStackTrace(); | ||
+ | } | ||
+ | } | ||
+ | } | ||
</source> | </source> | ||
[[Category: Webservices Guide]] | [[Category: Webservices Guide]] |
Revision as of 15:07, 5 June 2012
Contents |
First, we need to generate the client stuff using this command. Keep on mind that you need JDK 1.6 to run it:
$ wsimport -d client -s client http://localhost:8080/OpenKM/OKMAuth?wsdl
You can use the following script to generate a complete OpenKM webservices client library:
#/bin/bash
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMAuth?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMDocument?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMFolder?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMSearch?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMNotification?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMRepository?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMPropertyGroup?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMWorkflow?wsdl
jar cvf okm-ws-client-2.1.jar com
rm -rf com
Authentication
package com.openkm.ws.test;
import com.openkm.ws.client.Auth;
import com.openkm.ws.client.Auth_Service;
public class Authentication {
public static void main(String[] args) {
try {
Auth_Service authService = new Auth_Service();
Auth auth = authService.getAuthPort();
// Login
String token = auth.login("okmAdmin", "admin");
System.out.println("Es: " + token);
// Logout
okmAuth.logout(token);
} catch (Exception e) {
e.printStackTrace();
}
}
}