Wiki source code of 08 Schnittstelle ONYX Reporter
Last modified by Carina Enke on 13.02.2024
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
130.1 | 1 | {{layout-cell}} |
![]() |
402.1 | 2 | {{panel borderColor="#ddd" bgColor="#f0f0f0" borderStyle="solid" title="Content"}} |
3 | {{toc start="2"/}} | ||
4 | |||
![]() |
396.1 | 5 | |
![]() |
402.1 | 6 | {{/panel}} |
![]() |
130.1 | 7 | {{/layout-cell}} |
![]() |
286.1 | 8 | |
![]() |
398.1 | 9 | |
10 | |||
![]() |
402.1 | 11 | == General information == |
![]() |
130.1 | 12 | |
![]() |
402.1 | 13 | The API to the ONYX WebReporter enables the communication between the LMS and the Reporter. Therefore, a couple of commands will be executed: |
![]() |
130.1 | 14 | |
15 | |((( | ||
16 | armSite | ||
17 | )))|((( | ||
![]() |
402.1 | 18 | Registration of sequence requests at the ONYX Reporter |
![]() |
130.1 | 19 | ))) |
20 | |((( | ||
21 | initiateSite | ||
22 | )))|((( | ||
![]() |
402.1 | 23 | Initiates the Reporter session (transmission of the CP). |
![]() |
130.1 | 24 | ))) |
25 | |((( | ||
26 | disarmSite | ||
27 | )))|((( | ||
![]() |
402.1 | 28 | Release of all Reporter resources for this session. |
![]() |
130.1 | 29 | ))) |
30 | |((( | ||
31 | getResultValues | ||
32 | )))|((( | ||
![]() |
402.1 | 33 | Returns all (requested) results for the test. Condition: There is only one student in the list transmitted with initiateSite. |
![]() |
130.1 | 34 | ))) |
35 | |(% colspan="1" %)(% colspan="1" %) | ||
36 | ((( | ||
37 | getResultVariables | ||
38 | )))|(% colspan="1" %)(% colspan="1" %) | ||
39 | ((( | ||
![]() |
402.1 | 40 | Returns all (requested) outcome variables for the test. No armSite, initiateSite, or disarmSite is required. |
![]() |
130.1 | 41 | ))) |
42 | |||
![]() |
402.1 | 43 | == Login through the LMS == |
![]() |
130.1 | 44 | |
![]() |
402.1 | 45 | {{code language="xml" title="Login through the LMS"}} |
![]() |
376.1 | 46 | @WebMethod(operationName = „armSite") |
![]() |
130.1 | 47 | public String armSite( |
48 | @WebParam(name = „version") final Integer version, | ||
49 | @WebParam(name = „userId") final String userId, | ||
50 | @WebParam(name = „optionalRole") final Integer role, | ||
51 | @WebParam(name = „secretToShare") final String secretToShare, | ||
52 | @WebParam(name = „optionalUserLastName") final String userLastName, | ||
53 | @WebParam(name = „optionalUserFirstName") final String userFirstName, | ||
54 | @WebParam(name = „additionalParams") final HashMapWrapper additionalParams) { | ||
![]() |
376.1 | 55 | } |
56 | {{/code}} | ||
![]() |
130.1 | 57 | |
![]() |
376.1 | 58 | === Parameter armSite === |
59 | |||
![]() |
130.1 | 60 | |((( |
![]() |
376.1 | 61 | version |
![]() |
130.1 | 62 | )))|((( |
![]() |
402.1 | 63 | Requested version: 1 |
![]() |
130.1 | 64 | ))) |
65 | |((( | ||
![]() |
376.1 | 66 | userId |
![]() |
130.1 | 67 | )))|((( |
![]() |
402.1 | 68 | UserId of the requested Reporter user |
![]() |
130.1 | 69 | ))) |
70 | |((( | ||
![]() |
376.1 | 71 | optionalRole |
![]() |
130.1 | 72 | )))|((( |
![]() |
402.1 | 73 | Optional. User role. 0 = student, 1 = tutor |
![]() |
130.1 | 74 | ))) |
75 | |((( | ||
![]() |
376.1 | 76 | secretToShare |
![]() |
130.1 | 77 | )))|((( |
![]() |
402.1 | 78 | A secret string that allows the server and client to encrypt their communication. Must remain the same for any further communication. |
![]() |
130.1 | 79 | ))) |
80 | |((( | ||
![]() |
376.1 | 81 | optionalUserLastName |
![]() |
130.1 | 82 | )))|((( |
![]() |
402.1 | 83 | Optional. Last name of the user. |
![]() |
130.1 | 84 | ))) |
![]() |
376.1 | 85 | |(% colspan="1" %)(% colspan="1" %) |
86 | ((( | ||
87 | optionalUserFirstName | ||
88 | )))|(% colspan="1" %)(% colspan="1" %) | ||
89 | ((( | ||
![]() |
402.1 | 90 | Optional. First name of the user. |
![]() |
376.1 | 91 | ))) |
92 | |(% colspan="1" %)(% colspan="1" %) | ||
93 | ((( | ||
94 | additionalParams | ||
95 | )))|(% colspan="1" %)(% colspan="1" %) | ||
96 | ((( | ||
97 | Reserved for future use. | ||
98 | ))) | ||
![]() |
130.1 | 99 | |
![]() |
376.1 | 100 | === ReturnValue armSite === |
![]() |
130.1 | 101 | |
![]() |
376.1 | 102 | |((( |
103 | String | ||
104 | )))|((( | ||
![]() |
402.1 | 105 | Session ID which has to be used to mark any other Reporter call. |
![]() |
376.1 | 106 | ))) |
107 | |||
![]() |
402.1 | 108 | == Initialisation through LMS == |
![]() |
376.1 | 109 | |
![]() |
402.1 | 110 | {{code language="xml" title="Initialisation through LMS"}} |
![]() |
376.1 | 111 | @WebMethod(operationName = „initiateSite") |
112 | public String initiateSite( | ||
113 | @WebParam(name = „version") final Integer version, | ||
114 | @WebParam(name = „sessionId") final String sessionId, | ||
115 | @WebParam(name = „secretToShare") final String secretToShare, | ||
116 | @WebParam(name = „students") final ArrayList<ResultsForStudent> students, | ||
117 | @WebParam(name = „optionalContentPackage") final byte[] contentPackage, | ||
118 | @WebParam(name = „additionalParams") final HashMapWrapper additionalParams) { | ||
119 | } | ||
120 | {{/code}} | ||
121 | |||
122 | === Parameter initiateSite === | ||
123 | |||
124 | |((( | ||
125 | version | ||
126 | )))|((( | ||
![]() |
402.1 | 127 | Requested version: 1 |
![]() |
376.1 | 128 | ))) |
129 | |(% colspan="1" %)(% colspan="1" %) | ||
130 | ((( | ||
131 | sessionId | ||
132 | )))|(% colspan="1" %)(% colspan="1" %) | ||
133 | ((( | ||
![]() |
402.1 | 134 | SessionId, as returned by armSite. |
![]() |
376.1 | 135 | ))) |
136 | |((( | ||
137 | secretToShare | ||
138 | )))|((( | ||
![]() |
402.1 | 139 | A secret string that allows the server and client to encrypt their communication. Must remain the same for any further communication. |
![]() |
376.1 | 140 | ))) |
141 | |((( | ||
142 | students | ||
143 | )))|((( | ||
![]() |
402.1 | 144 | List of students and their results. See below. |
![]() |
376.1 | 145 | ))) |
146 | |((( | ||
147 | optionalContentPackage | ||
148 | )))|((( | ||
![]() |
402.1 | 149 | Optional. Content package (zipped) as byte array. |
![]() |
376.1 | 150 | ))) |
151 | |((( | ||
152 | additionalParams | ||
153 | )))|((( | ||
154 | Reserved for future use. | ||
155 | ))) | ||
156 | |||
157 | === ReturnValue initiateSite === | ||
158 | |||
159 | |((( | ||
160 | String | ||
161 | )))|((( | ||
![]() |
402.1 | 162 | Absolute URL of the Reporter site for the IFrame. The URL has to be amended by the LMS with the following URL parameters: |
![]() |
376.1 | 163 | |
![]() |
402.1 | 164 | * sid: Session ID, as returned by armSite |
165 | * ((( | ||
166 | uid: Student ID, as registrated in the initiateSite at the ONYX Reporter | ||
![]() |
376.1 | 167 | ))) |
![]() |
402.1 | 168 | ))) |
![]() |
376.1 | 169 | |
170 | {{code language="xml"}} | ||
171 | public class ResultsForStudent { | ||
172 | private String studentId = „"; | ||
173 | private String firstname = „"; | ||
174 | private String lastname = „"; | ||
175 | private String groupname = „"; | ||
176 | private String tutorname = „"; | ||
177 | private File contentFile = null; | ||
178 | private byte[] resultsFile = null; | ||
179 | } | ||
180 | {{/code}} | ||
181 | |||
![]() |
402.1 | 182 | == Logout through the LMS == |
![]() |
378.1 | 183 | |
184 | |||
![]() |
390.1 | 185 | {{code}} |
186 | @WebMethod(operationName = „disarmSite") | ||
187 | public Boolean disarmSite( | ||
188 | @WebParam(name = „version") final Integer version, | ||
189 | @WebParam(name = „sessionId") final String sessionId, | ||
190 | @WebParam(name = „secretToShare") final String secretToShare, | ||
191 | @WebParam(name = „additionalParams") final HashMapWrapper additionalParams) { | ||
192 | } | ||
193 | {{/code}} | ||
![]() |
378.1 | 194 | |
![]() |
390.1 | 195 | |
196 | === Parameter disarmSite === | ||
197 | |||
![]() |
378.1 | 198 | |((( |
199 | version | ||
200 | )))|((( | ||
![]() |
402.1 | 201 | Requested version: 1 |
![]() |
378.1 | 202 | ))) |
203 | |(% colspan="1" %)(% colspan="1" %) | ||
204 | ((( | ||
205 | sessionId | ||
206 | )))|(% colspan="1" %)(% colspan="1" %) | ||
207 | ((( | ||
![]() |
402.1 | 208 | SessionId, as returned by armSite. |
![]() |
378.1 | 209 | ))) |
210 | |((( | ||
211 | secretToShare | ||
212 | )))|((( | ||
![]() |
402.1 | 213 | A secret string that allows the server and client to encrypt their communication. Must remain the same for any further communication. |
![]() |
378.1 | 214 | ))) |
215 | |((( | ||
216 | additionalParams | ||
217 | )))|((( | ||
218 | Reserved for future use. | ||
219 | ))) | ||
220 | |||
221 | === ReturnValue disarmSite === | ||
222 | |||
223 | |((( | ||
224 | Boolean | ||
225 | )))|((( | ||
![]() |
402.1 | 226 | True in the case of success, otherwise false. |
![]() |
378.1 | 227 | ))) |
228 | |||
![]() |
402.1 | 229 | == Request of learner results through the LMS == |
![]() |
378.1 | 230 | |
![]() |
402.1 | 231 | {{code language="xml" title="Request of learner results through the LMS"}} |
![]() |
388.1 | 232 | @WebMethod(operationName = „getResultValues") |
233 | public HashMapWrapper getResultValues( | ||
234 | @WebParam(name = „version") final Integer version, | ||
235 | @WebParam(name = „sessionId") final String sessionId, | ||
236 | @WebParam(name = „secretToShare") final String secretToShare, | ||
237 | @WebParam(name = „requestedValues") final HashMap<String, String> | ||
238 | requestedValues, | ||
239 | @WebParam(name = „additionalParams") final HashMapWrapper additionalParams) { | ||
240 | } | ||
![]() |
378.1 | 241 | {{/code}} |
242 | |||
![]() |
388.1 | 243 | === Parameter getResultValues === |
244 | |||
![]() |
378.1 | 245 | |((( |
246 | version | ||
247 | )))|((( | ||
![]() |
402.1 | 248 | Requested version: 1 |
![]() |
378.1 | 249 | ))) |
250 | |(% colspan="1" %)(% colspan="1" %) | ||
251 | ((( | ||
252 | sessionId | ||
253 | )))|(% colspan="1" %)(% colspan="1" %) | ||
254 | ((( | ||
![]() |
402.1 | 255 | SessionId, as returned by armSite. |
![]() |
378.1 | 256 | ))) |
257 | |((( | ||
258 | secretToShare | ||
259 | )))|((( | ||
![]() |
402.1 | 260 | A secret string that allows the server and client to encrypt their communication. Must remain the same for any further communication. |
![]() |
378.1 | 261 | ))) |
262 | |((( | ||
![]() |
388.1 | 263 | requestedValues |
![]() |
378.1 | 264 | )))|((( |
![]() |
402.1 | 265 | Can be empty, in which case all result variables are returned. If keys are included, only the keys will be returned. |
![]() |
378.1 | 266 | ))) |
267 | |((( | ||
![]() |
388.1 | 268 | additionalParams |
![]() |
378.1 | 269 | )))|((( |
![]() |
388.1 | 270 | Reserved for future use. |
![]() |
378.1 | 271 | ))) |
![]() |
388.1 | 272 | |
273 | === ReturnValue getResultValues === | ||
274 | |||
![]() |
378.1 | 275 | |((( |
![]() |
388.1 | 276 | HashMap<String, String> |
277 | )))|((( | ||
![]() |
402.1 | 278 | Map of result variables, key is the variable name, value is the respective variable's value (HashMap is wrapped) |
![]() |
388.1 | 279 | ))) |
280 | |||
![]() |
402.1 | 281 | == Request of result variables through the LMS == |
![]() |
388.1 | 282 | |
![]() |
402.1 | 283 | {{code language="xml" title="Request of result variables through the LMS"}} |
![]() |
388.1 | 284 | @WebMethod(operationName = „getResultVariables") |
285 | public HashMapWrapper getResultVariables( | ||
286 | @WebParam(name = „version") final Integer version, | ||
287 | @WebParam(name = „contentPackage") final byte[] contentPackage, | ||
288 | @WebParam(name = „additionalParams") final HashMapWrapper additionalParams) { | ||
289 | } | ||
290 | {{/code}} | ||
291 | |||
292 | === Parameter getResultVariables === | ||
293 | |||
294 | |((( | ||
295 | version | ||
296 | )))|((( | ||
![]() |
402.1 | 297 | Requested version: 1 |
![]() |
388.1 | 298 | ))) |
299 | |((( | ||
300 | contentPackage | ||
301 | )))|((( | ||
![]() |
402.1 | 302 | Content package (zipped) as byte array. |
![]() |
388.1 | 303 | ))) |
304 | |((( | ||
![]() |
378.1 | 305 | additionalParams |
306 | )))|((( | ||
307 | Reserved for future use. | ||
308 | ))) | ||
![]() |
388.1 | 309 | |
310 | === ReturnValue getResultVariables === | ||
311 | |||
312 | |((( | ||
313 | HashMap<String, String> | ||
314 | )))|((( | ||
![]() |
402.1 | 315 | Map of result variables, key is the variable name, value is the respective variable's value (HashMap is wrapped) |
![]() |
388.1 | 316 | ))) |
317 | |||
318 | == Wrapper == | ||
319 | |||
![]() |
402.1 | 320 | Since the transmission of maps and lists via JAX-WS can cause problems, they have to be wrapped. |
![]() |
388.1 | 321 | |
![]() |
402.1 | 322 | === Wrapper for HashMap<String, String> === |
![]() |
388.1 | 323 | |
324 | HashMapWrapper.java: | ||
325 | |||
![]() |
396.1 | 326 | [[image:attach:HashMapWrapperjava.png||data-xwiki-image-style="img-screen" data-xwiki-image-style-border="true" width="500"]] |
![]() |
388.1 | 327 | |
![]() |
396.1 | 328 | [[image:attach:HashMapWrapperjava2.png||data-xwiki-image-style="img-screen" data-xwiki-image-style-border="true" width="500"]] |
![]() |
388.1 | 329 | |
![]() |
402.1 | 330 | === Wrapper for the ArrayList<ResultsForStudent> === |
![]() |
388.1 | 331 | |
332 | ResultsForStudentsWrapper.java: | ||
333 | |||
![]() |
396.1 | 334 | [[image:attach:ResultsForStudentsWrapperjava.png||data-xwiki-image-style="img-screen" data-xwiki-image-style-border="true" width="500"]] |