2012-07-12 22 views
6

任何人都可以确认是否可以使用Blackboard WebServices以编程方式向Blackboard提交作业? (如文件here)。具体而言,我想知道使用Gradebook.WS,AttemptVO和studentSubmission方法提交作业的正确方法。以下是我迄今为止它主要工作在该尝试可以降B的成绩簿中可以看出,除了attemptVO.studentSubmission尝试是不可见的黑板成绩册:是否可以使用Blackboard WebServices以编程方式向Blackboard提交作业

from suds.client import Client 
from suds.plugin import MessagePlugin 
from suds.wsse import Timestamp, UsernameToken, Security 

WS_BASE_URL = 'http://bbdev.bangor.ac.uk/webapps/ws/services/' 

class Learn9Plugin(MessagePlugin): 
    def marshalled(self, context): 
     password = context.envelope.childAtPath('Header/Security/UsernameToken/Password') 
     password.set('Type', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText') 

security = Security() 
security.tokens.append(Timestamp()) 
security.tokens.append(UsernameToken('session', 'nosession')) 
plugin = Learn9Plugin() 

context = Client( WS_BASE_URL + 'Context.WS?wsdl', 
location = WS_BASE_URL + 'Context.WS', 
autoblend = True, 
wsse = security, 
plugins = [plugin]) 

context.options.wsse.tokens[1].password = context.service.initialize() 

result = context.service.loginTool('xxxxx', 'xxxx', 'xxxxx', '', 500) 

course_id = '_15877_1' 

gradebook = Client(WS_BASE_URL + 'Gradebook.WS?wsdl', 
    location=WS_BASE_URL + 'Gradebook.WS', 
    autoblend=True, 
    wsse=security, 
    plugins=[plugin]) 


attemptVO = gradebook.factory.create('ns0:AttemptVO') 

attemptVO.override = False 
attemptVO.publicFeedbackToUser = False 
attemptVO.score = 0 
attemptVO.gradeId = '_169_1' # Smith 
attemptVO.studentSubmission = 'Some sample text representing an assignment' 
attemptVO.studentSubmissionTextType = 'PLAIN_TEXT' 
print attemptVO 
attempt_result = gradebook.service.saveAttempts(course_id, [attemptVO,]) 
print attempt_result 

结果:

(AttemptVO){ 
    attemptDate = None 
    creationDate = None 
    displayGrade = None 
    exempt = None 
    expansionData[] = <empty> 
    feedbackToUser = None 
    grade = None 
    gradeId = "_169_1" 
    groupAttemptId = None 
    id = None 
    instructorNotes = None 
    override = False 
    publicFeedbackToUser = False 
    score = 0 
    status = None 
    studentComments = None 
    studentSubmission = "Some sample text representing an assignment" 
    studentSubmissionTextType = "PLAIN_TEXT" 
} 
[_586_1] 

许多谢谢。

+0

对此有何更新? – skippr 2013-02-07 04:05:40

+1

由于无法使用上面提到的API,因此没有更新。我从来没有检查过文档,看看它们是否已经更新。 – Sion 2013-02-14 20:48:05

回答

4

Blackboard的一位开发人员回到了我的面前,并表示无法使用webservice提交任务,因为'studentSubmission'和'setStudentSubmissionTextType'方法是只读属性。

向Blackboard发出了更新文档的请求。

相关问题