REST service request - response
The response of a REST webservice can be declared as a certain type. JAX-B is used to convert the response object into XML or JSON. In nevisAuth, we use MoXy as JAX-B provider.
The following code extract provides a request/response example:
Generate/send a TAN with GET
> GET /nevisauth/tan/[email protected] HTTP/1.1
> Accept: /
< HTTP/1.1 200 OK
< Content-Length: 116
< Content-Type: application/xml
< Server: Jetty(7.6.8.v20121106)
<
<<?xml version="1.0" encoding="UTF-8"?><tan-result><status>success</status><challenge>LCUFEB</challenge></tan-result>
The same with JSON:
> GET /nevisauth/tan/[email protected] HTTP/1.1
> Accept: application/json
< HTTP/1.1 200 OK
< Content-Length: 41
< Content-Type: application/json
< Server: Jetty(7.6.8.v20121106)
<
< {"status":"success","challenge":"FQBOJT"}
Or with a POST:
> POST /nevisauth/tan/generate HTTP/1.1
> Accept: application/json
> Content-Length: 21
> Content-Type: application/x-www-form-urlencoded
< HTTP/1.1 200 OK
< Content-Length: 41
< Content-Type: application/json
< Server: Jetty(7.6.8.v20121106)
<
< {"status":"success","challenge":"NAIXZA"}