@SuppressWarnings("unchecked")
public static Element getInputDocumentType(SoapMessage message)
{
Element inputDocumentElement = null;
List<Object> myList = message.getContent(List.class);
ServiceResponseInfo sb = new ServiceResponseInfo();
for (Object object : myList)
{
// check what type of document is coming in.
switch(SSAFWebservicesEnum.valueOfClassName(object.getClass().getName()))
{
case DROPOFF:
{
DropOff dropOff = (DropOff) object;
Element docElement = (Element) dropOff.getAny();
if ((docElement != null)
&& (docElement.getLocalName()
.equalsIgnoreCase(SSAFNodes.message_envelope
.getLocalName()))
&& (docElement.getNamespaceURI()
.equalsIgnoreCase(SSAFNodes.message_envelope
.getNamespace())))
{
inputDocumentElement = docElement;
log.info("Incoming request document is of type DropOff");
}
else
{ // throw FatalFault if incoming DropOff request does not
// Contain expected ssaf:message element.
sb.noteError("DropOff incoming request document does not contain " +
"ssaf:message element which is required");
Drop_OffUtil .throwFault(
null,
null,
null,
sb, SSAFErrorTypes.REQUEST_INVALID,
null, docElement);
}
break;
}
case CHECKCONFIRMATION:
{
CheckConfirmation checkConfirmation = (CheckConfirmation) object;
Element docElement = (Element) checkConfirmation.getAny();
if ((docElement != null)
&& (docElement.getLocalName()
.equalsIgnoreCase(SSAFNodes.view_confirmation_response
.getLocalName()))
&& (docElement.getNamespaceURI()
.equalsIgnoreCase(SSAFNodes.view_confirmation_response
.getNamespace())))
{
inputDocumentElement = docElement;
log.info("Incoming request document is of type CheckConfirmation");
}
else
{
// throw FatalFault if incoming CheckConfirmation request does not
// Contain expected drop-off:view_confirmation_response element.
sb.noteError("CheckConfirmation incoming request document does not contain " +
"drop-off:view_confirmation_response element which is required");
Drop_OffUtil.throwFault(
null,
null,
null,
sb, SSAFErrorTypes.REQUEST_INVALID,
null, docElement);
}
break;
}
case CHECKDROPOFFSTATUS:
{
CheckDropOffStatus checkError = (CheckDropOffStatus) object;
Element docElement = (Element) checkError.getAny();
if ((docElement != null)
&& (docElement.getLocalName()
.equalsIgnoreCase(SSAFNodes.view_response_message
.getLocalName()))
&& (docElement.getNamespaceURI()
.equalsIgnoreCase(SSAFNodes.view_response_message
.getNamespace())))
{
inputDocumentElement = docElement;
log.info("Incoming request document is of type CheckDropOffStatus");
}
else
{
// throw FatalFault if incoming CheckDropOffStatus request does not
// Contain expected drop-off:view_response_message element.
sb.noteError("CheckDropOffStatus incoming request document does not contain " +
"drop-off:view_response_message element which is required");
Drop_OffUtil .throwFault(
null,
null,
null,
sb, SSAFErrorTypes.REQUEST_INVALID,
null, docElement);
}
break;
}
case GETRESPONSES:
{
GetResponses getResponses = (GetResponses) object;
Element docElement = (Element) getResponses.getAny();
if ((docElement != null)
&& (docElement.getLocalName()
.equalsIgnoreCase(SSAFNodes.get_responses
.getLocalName()))
&& (docElement.getNamespaceURI()
.equalsIgnoreCase(SSAFNodes.get_responses
.getNamespace())))
{
inputDocumentElement = docElement;
log.info("Incoming request document is of type GetResponses");
}
else
{
// throw FatalFault if incoming GetResponses request does not contian expected
// drop-off:get_reponses element.
sb.noteError("GetResponses incoming request document does not contain " +
"drop-off:get_reponses element which is required");
Drop_OffUtil.throwFault(
null,
null,
null,
null, SSAFErrorTypes.REQUEST_INVALID,
null, docElement);
}
break;
}
case DELETEERROR:
{
DeleteError deleteError = (DeleteError) object;
Element docElement = (Element) deleteError.getAny();
if ((docElement != null)
&& (docElement.getLocalName()
.equalsIgnoreCase(SSAFNodes.error_message_to_delete
.getLocalName()))
&& (docElement.getNamespaceURI()
.equalsIgnoreCase(SSAFNodes.error_message_to_delete
.getNamespace())))
{
inputDocumentElement = docElement;
log.info("Incoming request document is of type DeleteError");
}
else
{
// throw FatalFault if incoming DeleteError request does not contain expected
// drop-off:error_message_to_delete element.
sb.noteError("DeleteError incoming request document does not contain " +
"drop-off:error_message_to_delete element which is required");
Drop_OffUtil.throwFault(
null,
null,
null,
null, SSAFErrorTypes.REQUEST_INVALID,
null, docElement);
}
break;
}
case DELETECONFIRMATION:
{
DeleteConfirmation deleteConfirmation = (DeleteConfirmation) object;
Element docElement = (Element) deleteConfirmation.getAny();
if ((docElement != null)
&& (docElement.getLocalName()
.equalsIgnoreCase(SSAFNodes.confirmation_messages_to_delete
.getLocalName()))
&& (docElement.getNamespaceURI()
.equalsIgnoreCase(SSAFNodes.confirmation_messages_to_delete
.getNamespace())))
{
inputDocumentElement = docElement;
log.info("Incoming request document is of type DeleteConfirmation");
}
else
{
// throw FatalFault if incoming DeleteConfirmatio request does not contain
// expected drop-off:confirmation_messages_to_delete element.
sb.noteError("DeleteConfirmation incoming request document does not contain " +
"drop-off:confirmation_messages_to_delete element which is required");
Drop_OffUtil.throwFault(
null,
null,
null,