if (!(request.getLocalName().equals(
SSAFNodes.request_delete_of_next.getLocalName()) && request
.getNamespaceURI().equals(
SSAFNodes.request_delete_of_next.getNamespace())))
{
throw new FatalFault("The required element '"
+ SSAFNodes.request_delete_of_next
+ "' is missing in the request!");
}
String folderURI = request.getAttributeNS(
SSAFNodes.pick_up_folder_nominal_uri.getNamespace(),
SSAFNodes.pick_up_folder_nominal_uri.getLocalName());
String messageID = request.getAttributeNS(SSAFNodes.message_id
.getNamespace(), SSAFNodes.message_id.getLocalName());
log.info("\tThe deleteMessageRequest: " + folderURI + " "
+ messageID);
ServiceResponseInfo serviceResponseInfo = new ServiceResponseInfo();
if (folderURI == null || messageID == null)
{
serviceResponseInfo
.noteError("nominal folder uri or message_id is missing in the request ");
}
else
{
String destDir =
folderURI.replace(ssafNominalUri, ssafRootUri)
+ NominalUriPartNames.NEXT_MESSAGE;
String workflowId = folderURI.replace(ssafNominalUri, "");
String queueName = workflowId + NominalUriPartNames.OUTBOUND_QUEUE;
if (destDir != null && queueName != null)
{
try
{
serviceResponseInfo = jmsTemplate
.deleteHeadMessageOnRequest(request, queueName,
destDir);
}
catch (Exception e1)
{
e1.printStackTrace();
throw new FatalFault(
"Error when processing the request, please try later.",
e1);
}
}
}
DeleteNextUnitOfWorkResponse response = null;
try
{
response = this.createDeleteNextUnitOfWorkResponse(
serviceResponseInfo, messageID, folderURI);
}
catch (ParserConfigurationException e)
{
e.printStackTrace();
throw new FatalFault("Error when creating response.", e);
}
catch (SAXException e)
{
e.printStackTrace();
throw new FatalFault("Error when creating response.", e);
}
catch (IOException e)
{
e.printStackTrace();
throw new FatalFault("Error when creating response.", e);
}
return response;
}