requestId = extractRequestId(requestBody);
/**
* Extract request id from the body.
*
* @param requestBody the request body
* @return the string
*/
private static String extractRequestId(final String requestBody) {
if (!requestBody.contains("RequestID")) {
LOGGER.debug("Request body does not contain a request id");
return null;
}
try {
final int position = requestBody.indexOf("RequestID=\"") + CONST_REQUEST_ID_LENGTH;
final int nextPosition = requestBody.indexOf('"', position);
return requestBody.substring(position, nextPosition);
} catch (final Exception e) {
LOGGER.debug("Exception parsing RequestID from request.", e);
return null;
}
}
@NonNull
final Attribute requestIdAttribute = requestChild.getAttribute("RequestID");
requestId = requestIdAttribute.getValue();