t

LMS API

IBM Learning Management Systems ve IBM Workplace Collaborative Learning uygulamalarında çok sayıda kullanıcıyı LMS API lerini kullanarak kaydetmek için aşağıdaki kod kullanılabilir.

Kaydedilecek kullanıcı adlarını ve kaydedilecek kursların kodlarını text dosyasından okuyup lms deki kurs atamasını hayata geçiren koddur.

Diğer LMS API lerini kullanmak için ibm in sitesinden apidoc incelenip geliştirilebilir.

import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.client.*;
/**
* Kullanıcıyı bir kursa kaydeder…
* örneği : userid:00000000002f9200CTEN
* @author Cem DOGAN Aralik 2008
*
*/
public class Register_to_courseWCL {
public static String[] users;
public static int total=0;
public static void main(String[] args) {

try {
File file = new File(“kullanicilar_kurslar.txt”);
FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader buff = new BufferedReader(isr);
String inputLine = “”;

ArrayList<String> list = new ArrayList();
while ((inputLine = buff.readLine()) != null) {
list.add(inputLine);
}
buff.close();

users = new String[list.size()];
File roster_log=new File(“kursatama.log”);
FileOutputStream fos=new FileOutputStream(roster_log,true);
OutputStreamWriter out=new OutputStreamWriter(fos);
BufferedWriter buf=new BufferedWriter(out);
try{
for (int i = 0; i < list.size(); i++) {
users[i] = list.get(i);
String satir[] = users[i].split(“:”);

kaydet(satir[0],satir[1]);
out.write(satir[0]+”:”+satir[1]+” tamam\r”);
}
}catch(Exception e){
e.printStackTrace();
}
buf.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

public static void kaydet(String kullaniciadi, String kurskodu) throws Exception{
URL url;
try {
url = new URL(“http://IBMLMSadresiniz/lms-lmm/services/LMSRosterAPI”);
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setUsername(“admin”);
call.setPassword(“sifresi”);
String NS_XSD = “http://www.w3.org/2001/XMLSchema”;
QName QNAME_TYPE_STRING = new QName(NS_XSD, “string”);
call.addParameter(“user_id”, QNAME_TYPE_STRING, ParameterMode.IN);
call.addParameter(“offering_id”, QNAME_TYPE_STRING,
ParameterMode.IN);
String[] params = { kullaniciadi, kurskodu };
call.setReturnType(QNAME_TYPE_STRING);
call.setOperationName(new QName(“LMSEnrollmentAPI”,
“enrollCourseForUser”));
call.invoke(params);

} catch (Exception e) {
throw new Exception(“Bir hata oluştu”);
}
}
}

Jun132009

Published by at 11:44 am under java

Tags

awk axis bash bat batch big files birlikte aç db2 delete disk autorun disk open with dreambox du edg-nemesis find hidden mp3 ibm lms ibm wcl ibm wcs learning management system lmsapi LMSRosterAPI maildir maildir size mp3 mysql nabilo open with passwd password remove all remove space in file rename reset reset password reset root root skybox ssh ssh push vi vim vimproved workplace workplace collaborative learning

One response so far

One Response to “LMS API”

  1. GarykPattonon 16 Jun 2009 at 6:34 am

    You know so many interesting infomation. You might be very wise. I like such people. Don’t top writing.

Trackback URI | Comments RSS

Leave a Reply

Search