Version 13.1 by Robin Huisman on 2024/04/05 16:14

Show last authors
1 {{toc/}}
2
3
4 = Digital Lab Exchange process =
5
6 The flow diagram gives a small overview of what the data flow of a lab assignment is. Every green block shows a step of the lab assignment process. From top to bottom these steps are:
7
8 1. Showing the laboratory and all the analyses that can be requested as an option to the user.
9 1. The user creating a lab assignment and sending it to the lab trough TerraIndex.
10 1. The lab sending the analysis results back to the TerraIndex.
11
12
13
14 (% element-id="1884" %)
15 = (% element-id="1883" %)Firewall IP-Addresses of TerraIndex(%%) =
16
17 (% element-id="1882" %)
18 Our IP-addresses:
19
20 (% element-id="1881" %)
21 inbound [[Web.terraindex.com>>url:http://Web.terraindex.com||element-id="1880"]]
22 137.116.199.164
23
24 (% element-id="1878" %)
25 outbound [[Test.terraindex.com>>url:http://Test.terraindex.com||element-id="1877"]]
26 104.45.9.128
27
28 (% element-id="1875" %)
29 Production outbound
30 40.115.34.64
31
32 (% element-id="1873" %)
33 Test outbound
34 13.73.138.173
35
36 (% element-id="1871" %)
37 CD/CI outbound
38 40.114.238.16
39
40 (% element-id="1869" %)
41 Office outbound
42 213.124.115.132
43
44
45 (% element-id="1864" %)
46 = (% element-id="1863" %)Labdelivery (menu-card) files Exchange(%%) =
47
48 (% element-id="1862" %)
49 == (% element-id="1861" %)Solution/Design(%%) ==
50
51
52 (% class="table-hover" element-id="1858" %)
53 (% element-id="1856" %)|(% element-id="1855" %)(% element-id="1854" %)**Action**|(% element-id="1853" %)(% element-id="1852" %)**TerraIndex**|(% element-id="1851" %) |(% element-id="1849" %)(% element-id="1848" %)**Laboratorium**|(% element-id="1847" %)(% element-id="1846" %)**Parameters/Message**|(% element-id="1845" %)(% element-id="1844" %)**Remarks**|(% element-id="1843" %)(% element-id="1842" %)**ResultCodes**
54 (% element-id="1841" %)|(% element-id="1840" %)1|(% element-id="1839" %)Sends a request to the function: GetCustomers().|=(% element-id="1838" %)>|(% element-id="1837" %) |(% element-id="1835" %)(% element-id="1834" %)**WebserviceUsername (string), **(%%)
55 (% element-id="1832" %)**WebservicePassword (string),**(%%)
56 (% element-id="1830" %)**CustomerUsername (string)**|(% element-id="1829" %) |(% element-id="1827" %)
57 (% element-id="1825" %)|(% element-id="1824" %)2|(% element-id="1823" %) |(% element-id="1821" %) |(% element-id="1819" %)Receives the request and check the customers this username and searches the dateLastChanged for this Customer.|(% element-id="1818" %) |(% element-id="1816" %) |(% element-id="1814" %)
58 (% element-id="1812" %)|(% element-id="1811" %)3|(% element-id="1810" %) |(% element-id="1808" %)<=|(% element-id="1807" %)Sends back the list of customers with the lastChangedTimestamp|(% element-id="1806" %)ResultCode (),
59 ErrorMessage (string),
60 List<customer> , Customer:
61 CustomerCode (string),
62 CustomerName (string),
63 LabID (int),
64 LabName (string),
65 ChangedTimeStamp (DateTime)|(% element-id="1798" %)We receive the dateTimestamp instead of sending it, so we always get the full list and we are also able to delete customercodes.|(% element-id="1797" %)1 = Success,
66 2 = GeneralError,
67 3 = WrongSIKBVersion,
68 4 = InvalidCredentials,
69 5 = CustomerUsernameInvalid,
70 6 = CustomerUsernameNotValidForCustomerCode
71 7 = FileContentProblem,
72 8 = InvalidOrderId,
73 9 = OrderIdAlreadyApproved
74 10 = PDFNotAvailable
75 (% element-id="1787" %)|(% element-id="1786" %)4|(% element-id="1785" %)Receives the list of Customers, and will check for each customer it needs to request a new/changed labdelivery file based on the ChangedTimestamp.|(% element-id="1784" %) |(% element-id="1782" %) |(% element-id="1780" %) |(% element-id="1778" %)If a customer is not longer in this list, TerraIndex can remove this customercode from the customer database.|(% element-id="1777" %)
76 (% element-id="1775" %)|(% element-id="1774" %)5|(% element-id="1773" %)Sends a request to the function: GetProductList() if it has changed.|=(% element-id="1772" %)>|(% element-id="1771" %) |(% element-id="1769" %)(% element-id="1768" %)**WebserviceUsername (string), **(%%)
77 (% element-id="1766" %)**WebservicePassword (string),**(%%)
78 (% element-id="1764" %)**CustomerUsername (string),**(%%)
79 LabID (int),
80 CustomerCode (string),
81 LanguageCode (string, default 'nld' volgens ISO 639-3-codes),
82 SIKBVersion (string, default: '13.4.0'),
83 UseZipStream/UseZip (bool, default: 'false')|(% element-id="1758" %)(% element-id="1757" %)
84 (((
85 (% element-id="1756" %)
86 We start with dutch, then extend with multiple languages, TerraIndex is in the lead to request multiple languages.
87 TerraIndex uses: 'fra', 'nld', 'eng', 'spa', 'deu', 'ita', 'por', 'dan'
88
89
90 (% element-id="1752" %)
91 Besides SIKB 13.4.0, TerraIndex also supports 9.0.0/8.0.0 etc.
92 )))|(% element-id="1751" %)
93 (% element-id="1749" %)|(% element-id="1748" %)6|(% element-id="1747" %) |(% element-id="1745" %) |(% element-id="1743" %)Reveives a request to create a labdelivery file in a certain version of SIKB. It will generate the file.|(% element-id="1742" %) |(% element-id="1740" %) |(% element-id="1738" %)
94 (% element-id="1736" %)|(% element-id="1735" %)7|(% element-id="1734" %) |(% element-id="1732" %)<=|(% element-id="1731" %)Sends back the SIKB file, as a Base64 encoded string, with or without using a zipstream.|(% element-id="1730" %)ResultCode (),
95 ErrorMessage (string),
96 FileContent_Base64 (string),
97 UseZipStream/UseZip (bool, default: 'false')|(% element-id="1726" %) |(% element-id="1724" %)1 = Success,
98 2 = GeneralError,
99 3 = WrongSIKBVersion,
100 4 = InvalidCredentials,
101 5 = CustomerUsernameInvalid,
102 6 = CustomerUsernameNotValidForCustomerCode
103 7 = FileContentProblem,
104 8 = InvalidOrderId,
105 9 = OrderIdAlreadyApproved
106 10 = PDFNotAvailable
107 (% element-id="1714" %)|(% element-id="1713" %)8|(% element-id="1712" %)Receives the DeliveryFile and saves the file for import into customer database.|(% element-id="1711" %) |(% element-id="1709" %) |(% element-id="1707" %) |(% element-id="1705" %) |(% element-id="1703" %)
108 (% element-id="1701" %)|(% element-id="1700" %)9|(% element-id="1699" %)Go back to step 5, for every Customer code, every language.|(% element-id="1698" %) |(% element-id="1696" %) |(% element-id="1694" %) |(% element-id="1692" %) |(% element-id="1690" %)
109 (% element-id="1688" %)|(% element-id="1687" %)10|(% element-id="1686" %)Process the LabDeliveryFiles|(% element-id="1685" %) |(% element-id="1683" %) |(% element-id="1681" %) |(% element-id="1679" %) |(% element-id="1677" %)
110
111 (% element-id="1675" %)
112 == (% element-id="1674" %)Get Customers (POST)(%%) ==
113
114 (% element-id="1673" %)
115 === (% element-id="1672" %)Request example(%%) ===
116
117 (% element-id="1671" %)
118 (% element-id="1669" %)|(% element-id="1668" %)(% element-id="1667" %)
119 (((
120 {{code language="C#"}}
121 public GetCustomersCall.Response GetCustomers(string WebserviceUsername, string WebservicePassword, string CustomerUsername)
122         {
123             GetCustomersCall.Response set = new GetCustomersCall.Response();
124
125             try
126             {
127                 var content = new FormUrlEncodedContent(new[]
128                 {
129                     new KeyValuePair<string, string>("userName", WebserviceUsername),
130                     new KeyValuePair<string, string>("password", WebservicePassword),
131                     new KeyValuePair<string, string>("customerUsername", CustomerUsername),
132                 });
133
134                 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetCustomers", content).Result;
135                 response.EnsureSuccessStatusCode();
136                 string responseMessage = response.Content.ReadAsStringAsync().Result;
137
138                 if (string.IsNullOrEmpty(responseMessage))
139                 {
140                     throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / GetCustomers" + "]");
141                 }
142                 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage)))
143                 {
144                     XmlSerializer serializer = new XmlSerializer(typeof(GetCustomersCall.Response));
145                     set = (GetCustomersCall.Response)serializer.Deserialize(ms);                 
146                 }
147             }
148             catch (Exception ex)
149             {
150                 #region handle exception
151                 set.Status = new BusinessEntities.LabRestService.GetCustomersCall.ResponseStatus();
152                 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();               
153                 set.Status.ErrorMessage = "Exception occurred in GetCustomers (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message;
154                 ex.Data.Add("WebserviceUsername", WebserviceUsername);
155                 ex.Data.Add("WebservicePassword", WebservicePassword);
156                 ex.Data.Add("CustomerUsername", CustomerUsername);
157                 ExceptionHandler.HandleException(ex);
158                 #endregion
159             }
160             return set;
161         }
162 {{/code}}
163
164 (% element-id="1566" %)
165
166 )))
167
168 (% element-id="1564" %)
169 (% element-id="1562" %)|(% element-id="1561" %)(% element-id="1560" %)
170 (((
171 (% element-id="1559" %)
172 POST https:~/~/<URL>/GetCustomers HTTP/1.1
173
174 (% element-id="1558" %)
175 Content-Type: application/x-www-form-urlencoded
176
177 (% element-id="1557" %)
178 Host: 81.175.89.24
179
180 (% element-id="1556" %)
181 Content-Length: 115
182
183 (% element-id="1555" %)
184 Expect: 100-continue
185
186
187 (% element-id="1552" %)
188 userName=<webservice_username>&password=<Webservice_password>&customerUsername=<customer_username or token>
189 )))
190
191 (% element-id="1551" %)
192 === (% element-id="1550" %)Response example(%%) ===
193
194 (% element-id="1549" %)
195 (% element-id="1547" %)|(% element-id="1546" %)(% element-id="1545" %)
196 (((
197 {{code language="XML"}}
198 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
199 <Response><Customers>
200   <Customer LabId="1" LabName="Example Laboratorium" CustomerId="300" CustomerName="Adviesbureau De bodemkoning - Rotterdam" LastModifiedOnClient="2019-05-08T11:05:14.17+02:00" ></Customer>
201   <Customer LabId="1" LabName="Example Laboratorium" CustomerId="656" CustomerName="Adviesbureau De bodemkoning - Delft" LastModifiedOnClient="2019-04-19T13:20:10.123+02:00" ></Customer>
202 </Customers>
203 <Status>
204     <StatusCode>1</StatusCode>
205     <StatusCodeDescription>OK</StatusCodeDescription>
206     <ErrorMessage></ErrorMessage>
207 </Status>
208 </Response>
209 {{/code}}
210
211 (% element-id="1492" %)
212
213 )))
214
215 (% element-id="1490" %)
216 == (% element-id="1489" %)Get Products (POST)(%%) ==
217
218 (% element-id="1488" %)
219 === (% element-id="1487" %)Request example(%%) ===
220
221 (% element-id="1486" %)
222 (% element-id="1484" %)|(% element-id="1483" %)(% element-id="1482" %)
223 (((
224 (% element-id="1481" %)
225 public GetProductsCall.Response GetProductList(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, int labid, string sikbVersion, string languageCode)
226
227 (% element-id="1480" %)
228 {
229
230
231 (% element-id="1477" %)
232 GetProductsCall.Response set = new GetProductsCall.Response();
233
234
235 (% element-id="1474" %)
236 try
237
238 (% element-id="1473" %)
239 {
240
241 (% element-id="1472" %)
242 bool useZipstream = true;
243
244 (% element-id="1471" %)
245 var content = new FormUrlEncodedContent(new[]
246
247 (% element-id="1470" %)
248 {
249
250 (% element-id="1469" %)
251 new KeyValuePair<string, string>("userName", WebserviceUsername),
252
253 (% element-id="1468" %)
254 new KeyValuePair<string, string>("password", WebservicePassword),
255
256 (% element-id="1467" %)
257 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
258
259 (% element-id="1466" %)
260 new KeyValuePair<string, string>("languageCode", languageCode),
261
262 (% element-id="1465" %)
263 new KeyValuePair<string, string>("clientId", customerid),
264
265 (% element-id="1464" %)
266 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
267
268 (% element-id="1463" %)
269 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
270
271 (% element-id="1462" %)
272 });
273
274
275 (% element-id="1459" %)
276 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/GetProducts", content).Result;
277
278 (% element-id="1458" %)
279 response.EnsureSuccessStatusCode();
280
281 (% element-id="1457" %)
282 string responseMessage = response.Content.ReadAsStringAsync().Result;
283
284
285 (% element-id="1454" %)
286 if (string.IsNullOrEmpty(responseMessage))
287
288 (% element-id="1453" %)
289 {
290
291 (% element-id="1452" %)
292 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /GetProducts" + "]");
293
294 (% element-id="1451" %)
295 }
296
297 (% element-id="1450" %)
298 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
299
300 (% element-id="1449" %)
301 {
302
303 (% element-id="1448" %)
304 XmlSerializer serializer = new XmlSerializer(typeof(GetProductsCall.Response));
305
306 (% element-id="1447" %)
307 set = (GetProductsCall.Response)serializer.Deserialize(ms);
308
309 (% element-id="1446" %)
310 }
311
312
313 (% element-id="1443" %)
314 if (useZipstream && !string.IsNullOrEmpty(set.FileContent))
315
316 (% element-id="1442" %)
317 {
318
319 (% element-id="1441" %)
320 ~/~/convert from base64 string back to normal
321
322 (% element-id="1440" %)
323 ~/~/first check for real Base64, by checking there is no 'xml'  in it
324
325 (% element-id="1439" %)
326 if (!set.FileContent.Contains("<labaanlevering"))
327
328 (% element-id="1438" %)
329 {
330
331 (% element-id="1437" %)
332 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);
333
334 (% element-id="1436" %)
335 }
336
337 (% element-id="1435" %)
338 }
339
340
341 (% element-id="1432" %)
342 }
343
344 (% element-id="1431" %)
345 catch (Exception ex)
346
347 (% element-id="1430" %)
348 {
349
350 (% element-id="1429" %)
351 #region handle exception
352
353
354 (% element-id="1426" %)
355 set.Status = new BusinessEntities.LabRestService.GetProductsCall.ResponseStatus();
356
357 (% element-id="1425" %)
358 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
359
360 (% element-id="1424" %)
361 set.Status.ErrorMessage = "Exception occurred in GetProducts (username: " + WebserviceUsername + ", password: " + WebservicePassword + ") with message: " + ex.Message;
362
363
364 (% element-id="1421" %)
365 ex.Data.Add("WebserviceUsername", WebserviceUsername);
366
367 (% element-id="1420" %)
368 ex.Data.Add("WebservicePassword", WebservicePassword);
369
370 (% element-id="1419" %)
371 ex.Data.Add("CustomerUsername", CustomerUsername);
372
373 (% element-id="1418" %)
374 ex.Data.Add("sikbVersion", sikbVersion);
375
376 (% element-id="1417" %)
377 ex.Data.Add("customerid", customerid);
378
379 (% element-id="1416" %)
380 ex.Data.Add("languageCode", languageCode);
381
382
383 (% element-id="1413" %)
384 ExceptionHandler.HandleException(ex);
385
386 (% element-id="1412" %)
387 #endregion
388
389 (% element-id="1411" %)
390 }
391
392
393 (% element-id="1408" %)
394 return set;
395
396 (% element-id="1407" %)
397 }
398 )))
399
400 (% element-id="1406" %)
401 (% element-id="1404" %)|(% element-id="1403" %)(% element-id="1402" %)
402 (((
403 (% element-id="1401" %)
404 POST https:~/~/<URL>/GetProducts HTTP/1.1
405
406 (% element-id="1400" %)
407 Content-Type: application/x-www-form-urlencoded
408
409 (% element-id="1399" %)
410 Host: 81.175.89.24
411
412 (% element-id="1398" %)
413 Content-Length: 179
414
415 (% element-id="1397" %)
416 Expect: 100-continue
417
418
419 (% element-id="1394" %)
420 userName=<webservice_username>&password=<Webservice_password>&customerUsername=<customer_username or token>&languageCode=nld&clientId=300&sikbVersion=13.5.0&useZip=True
421 )))
422
423 (% element-id="1393" %)
424 === (% element-id="1392" %)Response example(%%) ===
425
426 (% element-id="1391" %)
427 (% element-id="1389" %)|(% element-id="1388" %)(% element-id="1387" %)
428 (((
429 (% element-id="1386" %)
430 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
431
432 (% element-id="1385" %)
433 <Response>
434
435 (% element-id="1384" %)
436 <FileContent> {SIKB FILE in ZIPSTREAM BASE64 format}</FileContent>
437
438 (% element-id="1383" %)
439 <Status>
440
441 (% element-id="1382" %)
442 <StatusCode>1</StatusCode>
443
444 (% element-id="1381" %)
445 <StatusCodeDescription>OK</StatusCodeDescription>
446
447 (% element-id="1380" %)
448 <ErrorMessage></ErrorMessage>
449
450 (% element-id="1379" %)
451 </Status></Response>
452 )))
453
454 (% element-id="1378" %)
455 = (% element-id="1377" %)Useraccount Checkup.(%%) =
456
457 (% element-id="1374" %)
458 == (% element-id="1373" %)Solution/Design(%%) ==
459
460 (% element-id="1372" %)
461 With every call we will no longer send customer usernames and customer passwords. We want to use a fixed Machine 2 Machine username and password for TerraIndex. So we need to be able to quickly check whether the Customer username we want to use exists, and is bound to our TerraIndex fixed Machine 2 machine account.
462
463 (% element-id="1371" %)
464 WebserviceUsername (string),
465 WebservicePassword (string),
466 CustomerUsername (string)
467
468
469 (% element-id="1366" %)
470 Therefor we call a Webserice for ValidCredentials Check:
471
472
473 (% class="table-hover" element-id="1363" %)
474 (% element-id="1361" %)|(% element-id="1360" %)(% element-id="1359" %)**Action**|(% element-id="1358" %)(% element-id="1357" %)**TerraIndex**|(% element-id="1356" %) |(% element-id="1354" %)(% element-id="1353" %)**Laboratorium**|(% element-id="1352" %)(% element-id="1351" %)**Parameters/Message**|(% element-id="1350" %)(% element-id="1349" %)**Remarks**|(% element-id="1348" %)(% element-id="1347" %)**ResultCodes**
475 (% element-id="1346" %)|(% element-id="1345" %)1|(% element-id="1344" %)Sends a request to the function: ValidCredentials().|=(% element-id="1343" %)>|(% element-id="1342" %) |(% element-id="1340" %)WebserviceUsername (string),
476 WebservicePassword (string),
477 CustomerUsername (string)|(% element-id="1337" %)We want to skip the Password of the customer, and we use the WebserviceUsername + WebservicePassword for real authentication.|(% element-id="1336" %)
478 (% element-id="1334" %)|(% element-id="1333" %)2|(% element-id="1332" %) |(% element-id="1330" %) |(% element-id="1328" %)Receives the request and checks the combination of WebserviceUsername and WebservicePassword is Ok. Then checks the CustomerUsername is valid.|(% element-id="1327" %) |(% element-id="1325" %) |(% element-id="1323" %)
479 (% element-id="1321" %)|(% element-id="1320" %)3|(% element-id="1319" %) |(% element-id="1317" %)<=|(% element-id="1316" %)Sends back a Success of InvalidCredentials|(% element-id="1315" %)ResultCode (),
480 ErrorMessage (string),|(% element-id="1313" %) |(% element-id="1311" %)1 = Success,
481 2 = GeneralError,
482 3 = WrongSIKBVersion,
483 4 = InvalidCredentials,
484 5 = CustomerUsernameInvalid,
485 6 = CustomerUsernameNotValidForCustomerCode
486 7 = FileContentProblem,
487 8 = InvalidOrderId,
488 9 = OrderIdAlreadyApproved
489 10 = PDFNotAvailable
490
491 (% element-id="1301" %)
492 == (% element-id="1300" %)Check ValidCredentials (POST)(%%) ==
493
494 (% element-id="1299" %)
495 === (% element-id="1298" %)Request example(%%) ===
496
497 (% element-id="1297" %)
498 (% element-id="1295" %)|(% element-id="1294" %)(% element-id="1293" %)
499 (((
500 (% element-id="1292" %)
501 public ValidCredentialsCall.Response ValidCredentials(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid)
502
503 (% element-id="1291" %)
504 {
505
506 (% element-id="1290" %)
507 ValidCredentialsCall.Response set = new ValidCredentialsCall.Response();
508
509
510 (% element-id="1287" %)
511 try
512
513 (% element-id="1286" %)
514 {
515
516
517 (% element-id="1283" %)
518 var content = new FormUrlEncodedContent(new[]
519
520 (% element-id="1282" %)
521 {
522
523 (% element-id="1281" %)
524 new KeyValuePair<string, string>("userName", WebserviceUsername),
525
526 (% element-id="1280" %)
527 new KeyValuePair<string, string>("password", WebservicePassword),
528
529 (% element-id="1279" %)
530 ~/~/new KeyValuePair<string, string>("clientId", customerid),   ~/~/ Optional
531
532 (% element-id="1278" %)
533 new KeyValuePair<string, string>("customerUsername", CustomerUsername),
534
535 (% element-id="1277" %)
536 });
537
538
539 (% element-id="1274" %)
540 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/ValidCredentials", content).Result;
541
542 (% element-id="1273" %)
543 response.EnsureSuccessStatusCode();
544
545 (% element-id="1272" %)
546 string responseMessage = response.Content.ReadAsStringAsync().Result;
547
548
549 (% element-id="1269" %)
550 if (string.IsNullOrEmpty(responseMessage))
551
552 (% element-id="1268" %)
553 {
554
555 (% element-id="1267" %)
556 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " / ValidCredentials" + "]");
557
558 (% element-id="1266" %)
559 }
560
561 (% element-id="1265" %)
562 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
563
564 (% element-id="1264" %)
565 {
566
567 (% element-id="1263" %)
568 XmlSerializer serializer = new XmlSerializer(typeof(ValidCredentialsCall.Response));
569
570 (% element-id="1262" %)
571 set = (ValidCredentialsCall.Response)serializer.Deserialize(ms);
572
573
574 (% element-id="1259" %)
575 return set;
576
577 (% element-id="1258" %)
578 }
579
580
581 (% element-id="1255" %)
582 }
583
584 (% element-id="1254" %)
585 catch (Exception ex)
586
587 (% element-id="1253" %)
588 {
589
590 (% element-id="1252" %)
591 #region handle exception
592
593
594 (% element-id="1249" %)
595 set.Status = new BusinessEntities.LabRestService.ValidCredentialsCall.ResponseStatus();
596
597 (% element-id="1248" %)
598 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
599
600 (% element-id="1247" %)
601 set.Status.ErrorMessage = "Exception occurred in GetValidCredentials (username: " + WebserviceUsername + ", with message: " + ex.Message;
602
603
604 (% element-id="1244" %)
605 ex.Data.Add("WebserviceUsername", WebserviceUsername);
606
607 (% element-id="1243" %)
608 ex.Data.Add("WebservicePassword", WebservicePassword);
609
610 (% element-id="1242" %)
611 ex.Data.Add("CustomerUsername", CustomerUsername);
612
613
614 (% element-id="1239" %)
615 ExceptionHandler.HandleException(ex);
616
617 (% element-id="1238" %)
618 #endregion
619
620 (% element-id="1237" %)
621 }
622
623
624 (% element-id="1234" %)
625 return set;
626
627 (% element-id="1233" %)
628 }
629 )))
630
631 (% element-id="1232" %)
632 (% element-id="1230" %)|(% element-id="1229" %)(% element-id="1228" %)
633 (((
634 (% element-id="1227" %)
635 POST https:~/~/<URL>/ValidCredentials HTTP/1.1
636
637 (% element-id="1226" %)
638 Content-Type: application/x-www-form-urlencoded
639
640 (% element-id="1225" %)
641 Host: 81.175.89.24
642
643 (% element-id="1224" %)
644 Content-Length: 125
645
646 (% element-id="1223" %)
647 Expect: 100-continue
648
649
650 (% element-id="1220" %)
651 userName=<webservice_username>&password=<Webservice_password>&clientId=<optional otherwise empty>&customerUsername=<customer_username or token>
652 )))
653
654 (% element-id="1219" %)
655 === (% element-id="1218" %)Response example(%%) ===
656
657 (% element-id="1217" %)
658 (% element-id="1215" %)|(% element-id="1214" %)(% element-id="1213" %)
659 (((
660 (% element-id="1212" %)
661 <?xml version="1.0" encoding="UTF-8" standalone="no"?><Response>
662
663 (% element-id="1211" %)
664 <Status>
665
666 (% element-id="1210" %)
667 <StatusCode>1</StatusCode>
668
669 (% element-id="1209" %)
670 <StatusCodeDescription>OK</StatusCodeDescription>
671
672 (% element-id="1208" %)
673 <ErrorMessage></ErrorMessage>
674
675 (% element-id="1207" %)
676 </Status>
677
678 (% element-id="1206" %)
679 </Response>
680 )))
681
682 (% element-id="1205" %)
683 = (% element-id="1204" %)Labassignment request delivery(POST)(%%) =
684
685 (% element-id="1203" %)
686 == (% element-id="1202" %)Solution/Design(%%) ==
687
688 (% element-id="1201" %)
689 For this we create a Webserice for CreateOrder to create the order in the lab system.
690 After the creation, we would like to show an order overview of the laboratory in the future in PDF. The user can see the prices and can confirm or cancel.
691 Depending on the user's choice at the laboratory, to support this or not, TerraIndex calls the ApproveOrder or the CancelOrder.
692
693 (% element-id="0" %)
694 For default we assume that we cannot do this yet, and TerraIndex sends needsApprovalIsSupported = false. If this becomes true in the future, the Lab can indicate whether or not it is necessary in the NeedsApprove field.
695
696
697 (% class="table-hover" element-id="1195" %)
698 (% element-id="1193" %)|(% element-id="1192" %)(% element-id="1191" %)**Action**|(% element-id="1190" %)(% element-id="1189" %)**TerraIndex**|(% element-id="1188" %) |(% element-id="1186" %)(% element-id="1185" %)**Laboratorium**|(% element-id="1184" %)(% element-id="1183" %)**Parameters/Message**|(% element-id="1182" %)(% element-id="1181" %)**Remarks**|(% element-id="1180" %)(% element-id="1179" %)**ResultCodes**
699 (% element-id="1178" %)|(% element-id="1177" %)1|(% element-id="1176" %)Sends a request to the function: CreateOrder().|=(% element-id="1175" %)>|(% element-id="1174" %) |(% element-id="1172" %)WebserviceUsername (string),
700 WebservicePassword (string),
701 CustomerUsername (string),
702 FileContent_Base64 (string),
703 UseZipStream/UseZip (bool, default: 'false'),
704 CustomerCode (string),
705 SIKBVersion (string, default: '13.4.0'),
706 needsApprovalIsSupported (bool)|(% element-id="1164" %)SIKB Version included, so labs can quickly check the version.
707 Besides SIKB 13.4.0, TerraIndex also supports 9.0.0.
708 \\Before sending the SIKB, validate to the XSD!
709 And to the XSLT?
710 \\needsApprovalIsSupported = false; means we dont get PDF with offerte. This will make is faster.
711 needsApprovalIsSupported = true; means lab will check the user setting to send a PDF Offerte back or not. (If the lab can support this.)|(% element-id="1156" %)
712 (% element-id="1154" %)|(% element-id="1153" %)2|(% element-id="1152" %) |(% element-id="1150" %) |(% element-id="1148" %)Receives the request and checks the credentials.|(% element-id="1147" %) |(% element-id="1145" %) |(% element-id="1143" %)
713 (% element-id="1141" %)|(% colspan="1" element-id="1140" %)3|(% colspan="1" element-id="1139" %) |(% colspan="1" element-id="1137" %) |(% colspan="1" element-id="1135" %)Credentials are valid, the Filecontent is checked on a valid Labassignment. When valid it will be processed and a OrderId is given.|(% colspan="1" element-id="1134" %) |(% colspan="1" element-id="1132" %)Laboratorium saves the Sample GUIDs if it's SIKB 13 or higher.
714 Otherwise we use the idanlmons unique ID.|(% colspan="1" element-id="1130" %)
715 (% element-id="1128" %)|(% colspan="1" element-id="1127" %) |(% colspan="1" element-id="1125" %) |(% colspan="1" element-id="1123" %) |(% colspan="1" element-id="1121" %)Based on what customer, the order will be approved or the approve needs to be done in laboratorium system.|(% colspan="1" element-id="1120" %) |(% colspan="1" element-id="1118" %) |(% colspan="1" element-id="1116" %)
716 (% element-id="1114" %)|(% element-id="1113" %)4|(% element-id="1112" %) |(% element-id="1110" %)<=|(% element-id="1109" %)Sends back a Success with the new OrderId|(% element-id="1108" %)ResultCode (),
717 ErrorMessage (string),
718 OrderId (string),
719 NeedsApprove (bool),
720 FileContent_Base64 (string),
721 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="1102" %)In the future labs will send back the PDF with the prices and some checks. To approve or cancel. For the first version this is not required yet and the fileContent remains empty.|(% element-id="1101" %)1 = Success,
722 2 = GeneralError,
723 3 = WrongSIKBVersion,
724 4 = InvalidCredentials,
725 5 = CustomerUsernameInvalid,
726 6 = CustomerUsernameNotValidForCustomerCode
727 7 = FileContentProblem,
728 8 = InvalidOrderId,
729 9 = OrderIdAlreadyApproved
730 10 = PDFNotAvailable
731 (% element-id="1091" %)|(% colspan="1" element-id="1090" %)6|(% colspan="1" element-id="1089" %)Receives the OrderId, and saves it.
732 |(% colspan="1" element-id="1086" %) |(% colspan="1" element-id="1084" %) |(% colspan="1" element-id="1082" %) |(% colspan="1" element-id="1080" %)(% element-id="1079" %)
733 (((
734 (% element-id="1078" %)
735 Default for now laboratorium will send:
736 NeedsApprove = False,
737 PDF = Empty,
738 Zipstream = False,
739
740
741 (% element-id="1072" %)
742 In the future, do something with the PDF and show the PDF to users to Approve or Cancel.
743 This will be done by; NeedsApprove = true.
744 \\If NeedsApprove is False, the order is Processed and can't be changed in TI. Like it is now.
745
746 (% element-id="1068" %)
747
748 )))|(% colspan="1" element-id="1066" %)
749 (% element-id="1064" %)|(% colspan="1" element-id="1063" %) |(% colspan="1" element-id="1061" %) |(% colspan="1" element-id="1059" %) |(% colspan="1" element-id="1057" %) |(% colspan="1" element-id="1055" %) |(% colspan="1" element-id="1053" %) |(% colspan="1" element-id="1051" %)
750 (% element-id="1049" %)|(% colspan="1" element-id="1048" %) |(% colspan="1" element-id="1046" %) |(% colspan="1" element-id="1044" %) |(% colspan="1" element-id="1042" %) |(% colspan="1" element-id="1040" %) |(% colspan="1" element-id="1038" %) |(% colspan="1" element-id="1036" %)
751 (% element-id="1034" %)|(% colspan="1" element-id="1033" %) |(% colspan="1" element-id="1031" %)(% element-id="1030" %)**IN THE FUTURE: APPROVEORDER**|(% colspan="1" element-id="1029" %) |(% colspan="1" element-id="1027" %) |(% colspan="1" element-id="1025" %) |(% colspan="1" element-id="1023" %) |(% colspan="1" element-id="1021" %)
752 (% element-id="1019" %)|(% colspan="1" element-id="1018" %)7|(% colspan="1" element-id="1017" %)Sends a request to the function: ApproveOrder().|(% colspan="1" element-id="1016" %)=>|(% colspan="1" element-id="1015" %) |(% colspan="1" element-id="1013" %)WebserviceUsername (string),
753 WebservicePassword (string),
754 CustomerUsername (string),
755 OrderId (string)|(% colspan="1" element-id="1009" %) |(% colspan="1" element-id="1007" %)
756 (% element-id="1005" %)|(% colspan="1" element-id="1004" %)8|(% colspan="1" element-id="1003" %) |(% colspan="1" element-id="1001" %) |(% colspan="1" element-id="999" %)Receives the approve and checks the credentials and the OrderId.|(% colspan="1" element-id="998" %) |(% colspan="1" element-id="996" %) |(% colspan="1" element-id="994" %)
757 (% element-id="992" %)|(% colspan="1" element-id="991" %)9|(% colspan="1" element-id="990" %) |(% colspan="1" element-id="988" %)<=|(% colspan="1" element-id="987" %)Sends back a Success with the new CertificateNr|(% colspan="1" element-id="986" %)ResultCode (),
758 ErrorMessage (string),
759 CertificateNr (string)|(% colspan="1" element-id="983" %)This process takes too long at some labs. Maybe this won't be workable...so maybe the CertificateNr return won't be possible. In this case, leave the CertificateNr empty. TerraIndex will read it from GetOrderStatus calls.|(% colspan="1" element-id="982" %)1 = Success,
760 2 = GeneralError,
761 3 = WrongSIKBVersion,
762 4 = InvalidCredentials,
763 5 = CustomerUsernameInvalid,
764 6 = CustomerUsernameNotValidForCustomerCode
765 7 = FileContentProblem,
766 8 = InvalidOrderId,
767 9 = OrderIdAlreadyApproved
768 10 = PDFNotAvailable
769 (% element-id="972" %)|(% colspan="1" element-id="971" %)10|(% colspan="1" element-id="970" %)Receives the CerificateNr and saves it.|(% colspan="1" element-id="969" %) |(% colspan="1" element-id="967" %) |(% colspan="1" element-id="965" %) |(% colspan="1" element-id="963" %) |(% colspan="1" element-id="961" %)
770 (% element-id="959" %)|(% colspan="1" element-id="958" %) |(% colspan="1" element-id="956" %) |(% colspan="1" element-id="954" %) |(% colspan="1" element-id="952" %) |(% colspan="1" element-id="950" %) |(% colspan="1" element-id="948" %) |(% colspan="1" element-id="946" %)
771 (% element-id="944" %)|(% colspan="1" element-id="943" %) |(% colspan="1" element-id="941" %)(% element-id="940" %)**IN THE FUTURE: CANCELORDER**|(% colspan="1" element-id="939" %) |(% colspan="1" element-id="937" %) |(% colspan="1" element-id="935" %) |(% colspan="1" element-id="933" %) |(% colspan="1" element-id="931" %)
772 (% element-id="929" %)|(% element-id="928" %)7|(% element-id="927" %)Sends a request to the function: CancelOrder().|=(% element-id="926" %)>|(% element-id="925" %) |(% element-id="923" %)WebserviceUsername (string),
773 WebservicePassword (string),
774 CustomerUsername (string),
775 OrderId (string)|(% element-id="919" %) |(% element-id="917" %)
776 (% element-id="915" %)|(% element-id="914" %)8|(% element-id="913" %) |(% element-id="911" %) |(% element-id="909" %)Receives the cancel and checks the credentials and the OrderId.|(% element-id="908" %) |(% element-id="906" %) |(% element-id="904" %)
777 (% element-id="902" %)|(% element-id="901" %)9|(% element-id="900" %) |(% element-id="898" %)<=|(% element-id="897" %)Sends back a Success |(% element-id="896" %)ResultCode (),
778 ErrorMessage (string)|(% element-id="894" %) |(% element-id="892" %)1 = Success,
779 2 = GeneralError,
780 3 = WrongSIKBVersion,
781 4 = InvalidCredentials,
782 5 = CustomerUsernameInvalid,
783 6 = CustomerUsernameNotValidForCustomerCode
784 7 = FileContentProblem,
785 8 = InvalidOrderId,
786 9 = OrderIdAlreadyApproved
787 10 = PDFNotAvailable
788 (% element-id="882" %)|(% element-id="881" %)10|(% element-id="880" %)Removes the OrderId and the IsSend to False|(% element-id="879" %) |(% element-id="877" %) |(% element-id="875" %) |(% element-id="873" %)If OrderIsAleadyApproved, set the values to Approved and keep the OrderId and IsSend.|(% element-id="872" %)
789 (% element-id="870" %)|(% colspan="1" element-id="869" %) |(% colspan="1" element-id="867" %) |(% colspan="1" element-id="865" %) |(% colspan="1" element-id="863" %) |(% colspan="1" element-id="861" %) |(% colspan="1" element-id="859" %) |(% colspan="1" element-id="857" %)
790
791 (% element-id="855" %)
792 == (% element-id="854" %)Create Order(%%) ==
793
794 (% element-id="853" %)
795 === (% element-id="852" %)Request example(%%) ===
796
797 (% element-id="851" %)
798 (% element-id="849" %)|(% element-id="848" %)(% element-id="847" %)
799 (((
800 (% element-id="846" %)
801 public CreateOrderResponse.Response SendLabAssignment(string WebserviceUsername, string WebservicePassword, string CustomerUsername, string customerid, string sikbVersion, string assignmentXML, string languageCode, bool needsApprovalIsSupported = false)
802
803 (% element-id="845" %)
804 {
805
806 (% element-id="844" %)
807 CreateOrderResponse.Response set = new CreateOrderResponse.Response();
808
809
810 (% element-id="841" %)
811 try
812
813 (% element-id="840" %)
814 {
815
816 (% element-id="839" %)
817 bool useZipstream = true;
818
819
820 (% element-id="836" %)
821 MultipartFormDataContent content = new MultipartFormDataContent();
822
823
824 (% element-id="833" %)
825 ~/~/Add Formdata
826
827 (% element-id="832" %)
828 var formDataDictionary = new[]
829
830 (% element-id="831" %)
831 {
832
833 (% element-id="830" %)
834 new KeyValuePair<string, string>("userName", WebserviceUsername),
835
836 (% element-id="829" %)
837 new KeyValuePair<string, string>("password", WebservicePassword),
838
839 (% element-id="828" %)
840 new KeyValuePair<string, string>("customerUserName", CustomerUsername),
841
842 (% element-id="827" %)
843 new KeyValuePair<string, string>("clientId", customerid),
844
845 (% element-id="826" %)
846 new KeyValuePair<string, string>("sikbVersion", sikbVersion),
847
848 (% element-id="825" %)
849 new KeyValuePair<string, string>("languageCode", languageCode),
850
851 (% element-id="824" %)
852 new KeyValuePair<string, string>("useZip", useZipstream.ToString() ),
853
854 (% element-id="823" %)
855 new KeyValuePair<string, string>("needsApprovalIsSupported", needsApprovalIsSupported.ToString() ),
856
857 (% element-id="822" %)
858 ~/~/new KeyValuePair<string, string>("orderXml", ZipStreamHelper.CompressToBase64String(assignmentXML)),
859
860 (% element-id="821" %)
861 ~/~/new KeyValuePair<string, string>("orderXml", assignmentXML),
862
863 (% element-id="820" %)
864 };              
865
866 (% element-id="819" %)
867 foreach (var item in formDataDictionary)
868
869 (% element-id="818" %)
870 {
871
872 (% element-id="817" %)
873 content.Add(new StringContent(item.Value), $"\"{item.Key}\"");
874
875 (% element-id="816" %)
876 }
877
878
879 (% element-id="813" %)
880 string filexml = string.Empty;
881
882 (% element-id="812" %)
883 if (useZipstream)
884
885 (% element-id="811" %)
886 {
887
888 (% element-id="810" %)
889 filexml = ZipStreamHelper.CompressToBase64String(assignmentXML);
890
891 (% element-id="809" %)
892 }
893
894 (% element-id="808" %)
895 else
896
897 (% element-id="807" %)
898 {
899
900 (% element-id="806" %)
901 filexml = assignmentXML;
902
903 (% element-id="805" %)
904 }
905
906
907 (% element-id="802" %)
908 ~/~/Add filecontent
909
910 (% element-id="801" %)
911 var fileContent = new ByteArrayContent(ZipStreamHelper.stringToByteArray(filexml));
912
913 (% element-id="800" %)
914 fileContent.Headers.ContentDisposition =
915
916 (% element-id="799" %)
917 new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data") ~/~/<- 'form-data' instead of 'attachment'
918
919 (% element-id="798" %)
920 {
921
922 (% element-id="797" %)
923 Name = "\"orderXml\"", ~/~/ \" is needed so the message contains the quotes, wihtout it will fail
924
925 (% element-id="796" %)
926 FileName = "\"VivaTerraIndexAssignment.xml\""
927
928 (% element-id="795" %)
929 };
930
931 (% element-id="794" %)
932 fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/xml");              
933
934 (% element-id="793" %)
935 content.Add(fileContent);
936
937
938 (% element-id="790" %)
939 ~/~/Start sending
940
941
942 (% element-id="787" %)
943 HttpResponseMessage response = _HttpClient.PostAsync(_HttpClient.BaseAddress + "/CreateOrder", content).Result;
944
945 (% element-id="786" %)
946 response.EnsureSuccessStatusCode();
947
948 (% element-id="785" %)
949 string responseMessage = response.Content.ReadAsStringAsync().Result;
950
951
952 (% element-id="782" %)
953 if (string.IsNullOrEmpty(responseMessage))
954
955 (% element-id="781" %)
956 {
957
958 (% element-id="780" %)
959 throw new Exception("Empty response from: [" + _HttpClient.BaseAddress + " /CreateOrder" + "]");
960
961 (% element-id="779" %)
962 }
963
964 (% element-id="778" %)
965 using (var ms = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(responseMessage~)~)~)
966
967 (% element-id="777" %)
968 {
969
970 (% element-id="776" %)
971 XmlSerializer serializer = new XmlSerializer(typeof(CreateOrderResponse.Response));
972
973 (% element-id="775" %)
974 set = (CreateOrderResponse.Response)serializer.Deserialize(ms);
975
976 (% element-id="774" %)
977 }
978
979
980 (% element-id="771" %)
981 ~/~/Can contain a PDf with price information
982
983 (% element-id="770" %)
984 if (set.UseZip && !string.IsNullOrEmpty(set.FileContent))
985
986 (% element-id="769" %)
987 {
988
989 (% element-id="768" %)
990 ~/~/convert from base64 string back to normal
991
992 (% element-id="767" %)
993 set.FileContent = ZipStreamHelper.DecompressBase64StringToString(set.FileContent);                  
994
995 (% element-id="766" %)
996 }
997
998
999 (% element-id="763" %)
1000 }
1001
1002 (% element-id="762" %)
1003 catch (Exception ex)
1004
1005 (% element-id="761" %)
1006 {
1007
1008 (% element-id="760" %)
1009 #region handle exception
1010
1011
1012 (% element-id="757" %)
1013 set.Status = new BusinessEntities.LabRestService.CreateOrderResponse.ResponseStatus();
1014
1015 (% element-id="756" %)
1016 set.Status.StatusCode = ((int)ResultCodes.GeneralError).ToString();
1017
1018 (% element-id="755" %)
1019 set.Status.ErrorMessage = "Exception occurred in CreateOrder (username: " + WebserviceUsername + ") with message: " + ex.Message;
1020
1021
1022 (% element-id="752" %)
1023 ex.Data.Add("WebserviceUsername", WebserviceUsername);
1024
1025 (% element-id="751" %)
1026 ex.Data.Add("WebservicePassword", WebservicePassword);
1027
1028 (% element-id="750" %)
1029 ex.Data.Add("CustomerUsername", CustomerUsername);
1030
1031 (% element-id="749" %)
1032 ex.Data.Add("sikbVersion", sikbVersion);
1033
1034 (% element-id="748" %)
1035 ex.Data.Add("customerid", customerid);
1036
1037
1038 (% element-id="745" %)
1039 ExceptionHandler.HandleException(ex);
1040
1041 (% element-id="744" %)
1042 #endregion
1043
1044 (% element-id="743" %)
1045 }
1046
1047
1048 (% element-id="740" %)
1049 return set;
1050
1051 (% element-id="739" %)
1052 }
1053 )))
1054
1055 (% element-id="738" %)
1056 (% element-id="736" %)|(% element-id="735" %)(% element-id="734" %)
1057 (((
1058 (% element-id="733" %)
1059 POST https:~/~/<URL>/CreateOrder HTTP/1.1
1060
1061 (% element-id="732" %)
1062 Content-Type: multipart/form-data; boundary="28a3e130-70c9-4a1a-b544-a802a1ade6ca"
1063
1064 (% element-id="731" %)
1065 Host: 81.175.89.24
1066
1067 (% element-id="730" %)
1068 Content-Length: 5010
1069
1070 (% element-id="729" %)
1071 Expect: 100-continue
1072
1073
1074 (% element-id="726" %)
1075 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1076
1077 (% element-id="725" %)
1078 Content-Type: text/plain; charset=utf-8
1079
1080 (% element-id="724" %)
1081 Content-Disposition: form-data; name="userName"
1082
1083
1084 (% element-id="721" %)
1085 <Webservice_Username>
1086
1087 (% element-id="720" %)
1088 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1089
1090 (% element-id="719" %)
1091 Content-Type: text/plain; charset=utf-8
1092
1093 (% element-id="718" %)
1094 Content-Disposition: form-data; name="password"
1095
1096
1097 (% element-id="715" %)
1098 <Webservice_Password>
1099
1100 (% element-id="714" %)
1101 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1102
1103 (% element-id="713" %)
1104 Content-Type: text/plain; charset=utf-8
1105
1106 (% element-id="712" %)
1107 Content-Disposition: form-data; name="customerUserName"
1108
1109
1110 (% element-id="709" %)
1111 <Customer_Username or token>
1112
1113 (% element-id="708" %)
1114 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1115
1116 (% element-id="707" %)
1117 Content-Type: text/plain; charset=utf-8
1118
1119 (% element-id="706" %)
1120 Content-Disposition: form-data; name="clientId"
1121
1122
1123 (% element-id="703" %)
1124 300
1125
1126 (% element-id="702" %)
1127 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1128
1129 (% element-id="701" %)
1130 Content-Type: text/plain; charset=utf-8
1131
1132 (% element-id="700" %)
1133 Content-Disposition: form-data; name="sikbVersion"
1134
1135
1136 (% element-id="697" %)
1137 13.4.0
1138
1139 (% element-id="696" %)
1140 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1141
1142 (% element-id="695" %)
1143 Content-Type: text/plain; charset=utf-8
1144
1145 (% element-id="694" %)
1146 Content-Disposition: form-data; name="languageCode"
1147
1148
1149 (% element-id="691" %)
1150 nld
1151
1152 (% element-id="690" %)
1153 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1154
1155 (% element-id="689" %)
1156 Content-Type: text/plain; charset=utf-8
1157
1158 (% element-id="688" %)
1159 Content-Disposition: form-data; name="useZip"
1160
1161
1162 (% element-id="685" %)
1163 True
1164
1165 (% element-id="684" %)
1166 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1167
1168 (% element-id="683" %)
1169 Content-Type: text/plain; charset=utf-8
1170
1171 (% element-id="682" %)
1172 Content-Disposition: form-data; name="needsApprovalIsSupported"
1173
1174
1175 (% element-id="679" %)
1176 False
1177
1178 (% element-id="678" %)
1179 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca
1180
1181 (% element-id="677" %)
1182 Content-Disposition: form-data; name="orderXml"; filename="VivaTerraIndexAssignment.xml"
1183
1184 (% element-id="676" %)
1185 Content-Type: application/xml
1186
1187
1188 (% element-id="673" %)
1189 <SIKB File in Zip stream Base64  encoding>
1190
1191 (% element-id="672" %)
1192 ~-~-28a3e130-70c9-4a1a-b544-a802a1ade6ca~-~-
1193 )))
1194
1195 (% element-id="671" %)
1196 === (% element-id="670" %)Response example(%%) ===
1197
1198 (% element-id="669" %)
1199 (% element-id="667" %)|(% element-id="666" %)(% element-id="665" %)
1200 (((
1201 (% element-id="664" %)
1202 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
1203
1204 (% element-id="663" %)
1205 <Response>
1206
1207 (% element-id="662" %)
1208 <OrderId>7113828</OrderId>
1209
1210 (% element-id="661" %)
1211 <NeedsApproval>True</NeedsApproval>
1212
1213 (% element-id="660" %)
1214 <FileContent></FileContent>
1215
1216 (% element-id="659" %)
1217 <Status>
1218
1219 (% element-id="658" %)
1220 <StatusCode>1</StatusCode>
1221
1222 (% element-id="657" %)
1223 <StatusCodeDescription>OK</StatusCodeDescription>
1224
1225 (% element-id="656" %)
1226 <ErrorMessage></ErrorMessage>
1227
1228 (% element-id="655" %)
1229 </Status></Response>
1230 )))
1231
1232 (% element-id="654" %)
1233 = (% element-id="653" %)Get Order status and Results(%%) =
1234
1235 (% element-id="652" %)
1236 == (% element-id="651" %)Soluion/Design(%%) ==
1237
1238 (% element-id="650" %)
1239 TerraIndex will request per license/customer which results are ready. These are queried if the latest changes are newer than the last check. This way we never download too much unnecessarily and it can always be requested again.
1240
1241 (% class="table-hover" element-id="647" %)
1242 (% element-id="645" %)|(% element-id="644" %)Action|(% element-id="643" %)TerraIndex|(% element-id="642" %) |(% element-id="640" %)Laboratorium|(% element-id="639" %)Parameters/Message|(% element-id="638" %)Remarks|(% element-id="637" %)ResultCodes
1243 (% element-id="636" %)|(% element-id="635" %)1|(% element-id="634" %)Sends a request to the function: GetCustomers().|=(% element-id="633" %)>|(% element-id="632" %) |(% element-id="630" %)WebserviceUsername (string), 
1244 WebservicePassword (string),
1245 CustomerUsername (string)|(% element-id="627" %)We want to skip the Password of the customer, and we introduce the WebserviceUsername + WebservicePassword.|(% element-id="626" %)
1246 (% element-id="624" %)|(% element-id="623" %)2|(% element-id="622" %) |(% element-id="620" %) |(% element-id="618" %)Receives the request and check the customers this username and searches the dateLastChanged for this Customer.|(% element-id="617" %) |(% element-id="615" %) |(% element-id="613" %)
1247 (% element-id="611" %)|(% element-id="610" %)3|(% element-id="609" %) |(% element-id="607" %)<=|(% element-id="606" %)Sends back the list of customers with the lastChangedTimestamp|(% element-id="605" %)ResultCode (),
1248 ErrorMessage (string),
1249 List<customer> , Customer:
1250 CustomerCode (string),
1251 CustomerName (string),
1252 LabID (int),
1253 LabName (string),
1254 ChangedTimeStamp (DateTime)|(% element-id="597" %)We receive the dateTimestamp instead of sending it, so we always get the full list and we are also able to delete customercodes.|(% element-id="596" %)1 = Success,
1255 2 = GeneralError,
1256 3 = WrongSIKBVersion,
1257 4 = InvalidCredentials,
1258 5 = CustomerUsernameInvalid,
1259 6 = CustomerUsernameNotValidForCustomerCode
1260 7 = FileContentProblem,
1261 8 = InvalidOrderId,
1262 9 = OrderIdAlreadyApproved
1263 10 = PDFNotAvailable
1264 (% element-id="586" %)|(% element-id="585" %)4|(% element-id="584" %)Receives the list of Customers. Read the Timestamp this Customer is last checked for Results/Statuses.|(% element-id="583" %) |(% element-id="581" %) |(% element-id="579" %) |(% element-id="577" %) |(% element-id="575" %)
1265 (% element-id="573" %)|(% element-id="572" %)5|(% element-id="571" %)Send for each Customer a  call to retreive all orders statuses changes since a certain timestamp.
1266 Function: GetOrderStatuses()|=(% element-id="569" %)>|(% element-id="568" %) |(% element-id="566" %)WebserviceUsername (string), 
1267 WebservicePassword (string),
1268 CustomerUsername (string),
1269 CustomerCode (string),
1270 LastCheckedTimestamp (DateTime)|(% element-id="561" %)TerraIndex keeps track of the last check timestamp for each license.|(% element-id="560" %)
1271 (% element-id="558" %)|(% element-id="557" %)6|(% element-id="556" %) |(% element-id="554" %) |(% element-id="552" %)Receives the request and check the orders that are changed since the timestamp for this Customer.|(% element-id="551" %) |(% element-id="549" %) |(% element-id="547" %)
1272 (% element-id="545" %)|(% element-id="544" %)7|(% element-id="543" %) |(% element-id="541" %)<=|(% element-id="540" %)Sends back the list of orders with the status and lastChangedTimestamp|(% element-id="539" %)ResultCode (),
1273 ErrorMessage (string),
1274 OrderID (string),
1275 LabassignmentGUID (GUID),
1276 CertificateNumber (string)
1277 OrderStatusSIKB (int),
1278 Delayed (boolean),
1279 ExpectedTimeStamp (DateTime),|(% element-id="531" %)OrderStatusSIKB is the SIKB Labassignment status.
1280 \\Delayed is a boolean to tell the customer a order will be later ready then expected. The ExpectedTimestamp.
1281 If Delayed for the firsttime, TerraIndex can send a notification to the users and show a different layout.
1282 \\LabassignmentGUID is filled to support also Labassignments that are not from TerraIndex Ordered.|(% element-id="525" %)1 = Success,
1283 2 = GeneralError,
1284 3 = WrongSIKBVersion,
1285 4 = InvalidCredentials,
1286 5 = CustomerUsernameInvalid,
1287 6 = CustomerUsernameNotValidForCustomerCode
1288 7 = FileContentProblem,
1289 8 = InvalidOrderId,
1290 9 = OrderIdAlreadyApproved
1291 10 = PDFNotAvailable
1292 (% element-id="515" %)|(% element-id="514" %)8|(% element-id="513" %)Receives the list of Orders with status.
1293 Update the CertificateNr if this is not already present in the labassignment. |(% element-id="511" %) |(% element-id="509" %) |(% element-id="507" %) |(% element-id="505" %)CertifcateNumber could be new here, if the lab wasn't able to fill it directly at the ApproveOrder.|(% element-id="504" %)
1294 (% element-id="502" %)|(% element-id="501" %)9|(% element-id="500" %)Send for each Order a call to retreive all results.
1295 Function: GetOrderResults()|=(% element-id="498" %)>|(% element-id="497" %) |(% element-id="495" %)WebserviceUsername (string), 
1296 WebservicePassword (string),
1297 CustomerUsername (string),
1298 CustomerCode (string),
1299 OrderID (string),
1300 SIKBVersion (string, default: '13.4.0')|(% element-id="489" %)Besides SIKB 13.4.0, TerraIndex also supports 9.0.0/8.0.0 etc.|(% element-id="488" %)
1301 (% element-id="486" %)|(% element-id="485" %)10|(% element-id="484" %) |(% element-id="482" %) |(% element-id="480" %)Receives the request and creates a SIKB results file based on the version that is requested.|(% element-id="479" %) |(% element-id="477" %) |(% element-id="475" %)
1302 (% element-id="473" %)|(% element-id="472" %)11|(% element-id="471" %) |(% element-id="469" %)<=|(% element-id="468" %)Sends back the results of the orders.|(% element-id="467" %)ResultCode (),
1303 ErrorMessage (string),
1304 OrderId (string),
1305 LabassignmentGUID (GUID),
1306 FileContent_Base64 (string),
1307 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="461" %) |(% element-id="459" %)1 = Success,
1308 2 = GeneralError,
1309 3 = WrongSIKBVersion,
1310 4 = InvalidCredentials,
1311 5 = CustomerUsernameInvalid,
1312 6 = CustomerUsernameNotValidForCustomerCode
1313 7 = FileContentProblem,
1314 8 = InvalidOrderId,
1315 9 = OrderIdAlreadyApproved
1316 10 = PDFNotAvailable
1317 (% element-id="449" %)|(% element-id="448" %)12|(% element-id="447" %)Receives the results and imports all results.|(% element-id="446" %) |(% element-id="444" %) |(% element-id="442" %) |(% element-id="440" %)(% element-id="439" %)
1318 (((
1319 (% element-id="438" %)
1320 Import will be done to corresponding samples based on:
1321
1322 (% element-id="437" %)
1323 * Find Project by ProjectGUID (as provided in the labassignment)
1324 * Find Project by ProjectCode (as provided in the Labassignment)
1325 * Find Project and Labassignment by LabassignmentGUID (as provided in the Labassignment)
1326 * Find Project (only if Project is not found yet) and Samples based on SampleGUID (as provided in the Labassignment) .
1327 Sample GUIDs that are send to the lab in the labassignment version SIKB 13 or higher are required in the results for labassignment.
1328 For lower version Labassignments the lab should return the 'old' idanlmons as SampleGUID in the XML.
1329 * Find Samples (only if Project is already found ) by SampleName
1330
1331 (% element-id="429" %)
1332 What is imported?
1333
1334 (% element-id="428" %)
1335 * If Sample is found, the results in the XML are always all updated and/or inserted.
1336 * If Project is found, but the sample is not; The Sample and the results are inserted as new Sample. (If watersample; fake filtertube and fake measurementpoints are created)
1337 )))|(% element-id="425" %)
1338 (% element-id="423" %)|(% element-id="422" %)13|(% element-id="421" %)If OrderStatus is 'Completed/Reported' (SIKBID: 5)
1339 Request the PDF certificate.
1340 Function: GetOrderPDF()|=(% element-id="418" %)>|(% element-id="417" %) |(% element-id="415" %)WebserviceUsername (string), 
1341 WebservicePassword (string),
1342 CustomerUsername (string),
1343 CustomerCode (string),
1344 OrderID (string),|(% element-id="410" %) |(% element-id="408" %)
1345 (% element-id="406" %)|(% element-id="405" %)14|(% element-id="404" %) |(% element-id="402" %) |(% element-id="400" %)Receives the request and creates the PDF for the Order.|(% element-id="399" %) |(% element-id="397" %) |(% element-id="395" %)
1346 (% element-id="393" %)|(% element-id="392" %)15|(% element-id="391" %) |(% element-id="389" %)<=|(% element-id="388" %)Sends back the PDF of the order.|(% element-id="387" %)ResultCode (),
1347 ErrorMessage (string),
1348 OrderId (string),
1349 LabassignmentGUID (GUID),
1350 FileContent_Base64 (string),
1351 UseZipStream/UseZip (bool, default: 'false'),|(% element-id="381" %)If the PDF is not available yet, please give the resultcode: PDFNotAvailable.|(% element-id="380" %)1 = Success,
1352 2 = GeneralError,
1353 3 = WrongSIKBVersion,
1354 4 = InvalidCredentials,
1355 5 = CustomerUsernameInvalid,
1356 6 = CustomerUsernameNotValidForCustomerCode
1357 7 = FileContentProblem,
1358 8 = InvalidOrderId,
1359 9 = OrderIdAlreadyApproved
1360 10 = PDFNotAvailable
1361 (% element-id="370" %)|(% element-id="369" %)12|(% element-id="368" %)Receives the PDF and stores it for reporting and downloading.|(% element-id="367" %) |(% element-id="365" %) |(% element-id="363" %) |(% element-id="361" %) |(% element-id="359" %)
1362
1363 (% element-id="357" %)
1364 = (% element-id="356" %)Customer wants to see real time information about the status in the interface(%%) =
1365
1366 (% element-id="354" %)
1367 == (% element-id="353" %)Solution/Design(%%) ==
1368
1369 (% element-id="352" %)
1370 To always show up-to-date information in the TerraIndex interface when a user opens a lab assignment to see the status, we reuse part of the GetOrderStatus, but with a specific OrderID.
1371
1372 (% element-id="351" %)
1373 ..NOT SUPPORTED YET...
1374
1375 (% class="table-hover" element-id="350" %)
1376 (% element-id="348" %)|(% colspan="1" element-id="347" %)Action|(% colspan="1" element-id="346" %)TerraIndex|(% colspan="1" element-id="345" %) |(% colspan="1" element-id="343" %)Laboratorium|(% colspan="1" element-id="342" %)Parameters/Message|(% colspan="1" element-id="341" %)Remarks|(% colspan="1" element-id="340" %)ResultCodes
1377 (% element-id="339" %)|(% element-id="338" %)1|(% element-id="337" %)Request the Order status for a single Order/Labassignment.
1378 Function: GetOrderStatus()|=(% element-id="335" %)>|(% element-id="334" %) |(% element-id="332" %)WebserviceUsername (string), 
1379 WebservicePassword (string),
1380 CustomerUsername (string),
1381 CustomerCode (string),
1382 OrderID (string),|(% element-id="327" %) |(% element-id="325" %)
1383 (% element-id="323" %)|(% element-id="322" %)2|(% element-id="321" %) |(% element-id="319" %) |(% element-id="317" %)Receives the request and gets the status for the Order.|(% element-id="316" %) |(% element-id="314" %) |(% element-id="312" %)
1384 (% element-id="310" %)|(% element-id="309" %)3|(% element-id="308" %) |(% element-id="306" %)<=|(% element-id="305" %)Sends back the status of the order.|(% element-id="304" %)ResultCode (),
1385 ErrorMessage (string),
1386 OrderID (string),
1387 LabassignmentGUID (GUID),
1388 CertificateNumber (string)
1389 OrderStatusSIKB (int),
1390 Delayed (boolean),
1391 ExpectedTimeStamp (DateTime),|(% element-id="296" %)OrderStatusSIKB is the SIKB Labassignment status.
1392 \\Delayed is a boolean to tell the customer a order will be later ready then expected. The ExpectedTimestamp.
1393 If Delayed for the firsttime, TerraIndex can send a notification to the users and show a different layout.
1394 \\LabassignmentGUID is filled to support also Labassignments that are not from TerraIndex Ordered.|(% element-id="290" %)1 = Success,
1395 2 = GeneralError,
1396 3 = WrongSIKBVersion,
1397 4 = InvalidCredentials,
1398 5 = CustomerUsernameInvalid,
1399 6 = CustomerUsernameNotValidForCustomerCode
1400 7 = FileContentProblem,
1401 8 = InvalidOrderId,
1402 9 = OrderIdAlreadyApproved
1403 10 = PDFNotAvailable
1404 (% element-id="280" %)|(% element-id="279" %)4|(% element-id="278" %)Receives the status and shows in the interface the updated info.
1405 Update the CertificateNr if this is not already present in the labassignment. |(% element-id="276" %) |(% element-id="274" %) |(% element-id="272" %) |(% element-id="270" %)CertifcateNumber could be new here, if the lab wasn't able to fill it directly at the ApproveOrder.|(% element-id="269" %)
1406
1407 (% element-id="265" %)
1408