// Setup a database interaction and store the request
MessageHome messageHome = new MessageHome(Persistence.createEntityManagerFactory("ExternalRAGUIMessageDS"), MessageHome.MESSAGETYPE_EXTRA, true);
SubMessages submessages = new SubMessages(extRaCertificate, extRaKey, racaserviceCert);
submessages.addSubMessage(subMessage);
String messageId = GUIDGenerator.generateGUID(this);
messageHome.create(messageId, submessages);
// Get response from CA
Message response = waitForResponse(messageHome, messageId);
if (response != null) {
log.debug("Got processed message");
SubMessages subMessages = response.getSubMessages(extRaKey, caCerts, null);