Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to programmatically submit an assignment to Blackboard using Blackboard WebServices

Can anyone confirm if it is possible to programmatically submit an assignment to Blackboard using Blackboard WebServices? (As documented here). Specifically I would like to know the correct way of using the Gradebook.WS, AttemptVO and the studentSubmission method to submit an assignment. Here is what I have tried so far which mostly works in that the attempt can be seen in Bb Gradebook except the attemptVO.studentSubmission is not visible in Blackboard Gradebook:

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

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]

Many thanks.

like image 385
Sion Avatar asked Jul 12 '12 15:07

Sion


1 Answers

One of the developers of Blackboard got back to me and said that it is not possible to submit an assignment using the webservice as the 'studentSubmission' and 'setStudentSubmissionTextType' methods are readonly attributes.

A request has been made to Blackboard to update the documentation.

like image 118
Sion Avatar answered Oct 22 '22 06:10

Sion