...
| Bloc de code |
|---|
@RequestMapping(value = "/validateTag", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<String> eppnValidate(@RequestBody EsupNfcTagLog esupNfcTagLog, HttpServletRequest httpServletRequest) {
if(Math.random() <= 0.5) {
return new ResponseEntity<String>("OK", new HttpHeaders(), HttpStatus.OK);
} else {
return new ResponseEntity<String>("KO", new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
}
} |
Exemple d'appel avec curl :
| Bloc de code |
|---|
curl -v -H "Content-Type: application/json" -d '{"eppn":"toto@univ-rouen.fr", "location":"Inscriptions Test 1"}' https://mon-appli-metier.univ-rouen.fr/nfc-ws/validateTag |
Exemple de retour (code http 200 ici : le badgeage a bien été validé) :
| Bloc de code |
|---|
* About to connect() to mon-appli-metier.univ-rouen.fr port 443 (#0) * Trying xxxxxxxxxx... * Connected to mon-appli-metier.univ-rouen.fr (10.0.128.31) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 * Server certificate: * subject: CN=*.univ-rouen.fr,O=Université de Rouen,L=Mont-Saint-Aignan,ST=Seine-Maritime,C=FR * start date: mai 25 00:00:00 2016 GMT * expire date: mai 30 12:00:00 2019 GMT * common name: *.univ-rouen.fr * issuer: CN=TERENA SSL CA 3,O=TERENA,L=Amsterdam,ST=Noord-Holland,C=NL > POST /nfc-ws/validateTag HTTP/1.1 > User-Agent: curl/7.29.0 > Host: mon-appli-metier.univ-rouen.fr > Accept: */* > Content-Type: application/json > Content-Length: 65 > * upload completely sent off: 65 out of 65 bytes < HTTP/1.1 200 OK < Date: Tue, 23 May 2017 10:21:02 GMT < Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips < Content-Type: text/plain;charset=ISO-8859-1 < Content-Length: 2 < * Connection #0 to host mon-appli-metier.univ-rouen.fr left intact OK |