use of uk.nhs.adaptors.scr.logging.LogExecutionTime in project summary-care-record-api by NHSDigital.
the class SpineClient method sendAcsData.
@SneakyThrows
@Override
@LogExecutionTime
public Response<Document> sendAcsData(String requestBody, String nhsdAsid) {
var url = spineConfiguration.getUrl() + spineConfiguration.getAcsEndpoint();
LOGGER.info("Sending ACS Set Permission Spine request. URL: {}", url);
LOGGER.debug("Body: {}", requestBody);
var request = new HttpPost(url);
setSoapHeaders(request, SET_PERMISSION_SOAP_ACTION, TEXT_XML_VALUE);
request.setHeader(NHSD_ASID, nhsdAsid);
request.setEntity(new StringEntity(requestBody, UTF_8));
var response = spineHttpClient.sendRequest(request, xmlResponseHandler);
var statusCode = response.getStatusCode();
if (statusCode != OK.value()) {
LOGGER.error("Unexpected spine ACS set permission response: {}", response);
throw new UnexpectedSpineResponseException("Unexpected spine 'send data' response " + statusCode);
}
LOGGER.info("Received Spine {} interaction response: HTTP status {}", SET_PERMISSION_SOAP_ACTION, response.getStatusCode());
return response;
}
use of uk.nhs.adaptors.scr.logging.LogExecutionTime in project summary-care-record-api by NHSDigital.
the class SpineClient method sendGetScr.
@SneakyThrows
@Override
@LogExecutionTime
public Response<Document> sendGetScr(String requestBody, String nhsdAsid) {
var uri = spineConfiguration.getUrl() + spineConfiguration.getPsisQueriesEndpoint();
var request = new HttpPost(uri);
LOGGER.info("Sending GET SCR Spine request. URL: {}", uri);
LOGGER.debug("Body: {}", requestBody);
request.addHeader(SOAP_ACTION, PSIS_EVENT_QUERY_SOAP_ACTION);
request.addHeader(CONTENT_TYPE, TEXT_XML_VALUE);
request.addHeader(NHSD_ASID, nhsdAsid);
request.setEntity(new StringEntity(requestBody, UTF_8));
var response = spineHttpClient.sendRequest(request, xmlResponseHandler);
var statusCode = response.getStatusCode();
if (statusCode != OK.value()) {
LOGGER.error("Unexpected spine GET SCR response: {} {}", statusCode, serialize(response.getBody()));
throw new UnexpectedSpineResponseException("Unexpected spine send response " + statusCode);
}
LOGGER.info("Received Spine {} interaction response: HTTP status {}", PSIS_EVENT_QUERY_SOAP_ACTION, response.getStatusCode());
return response;
}
Aggregations