Skip to content

Commit

Permalink
Added fix for issue OxalisCommunity#143
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddhimaN committed Sep 21, 2021
1 parent 500b1d2 commit 38a5316
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/network/oxalis/as4/inbound/As4InboundHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public SOAPMessage handle(SOAPMessage request, MessageContext messageContext) th
// Organize input data
UserMessage userMessage = SOAPHeaderParser.getUserMessage(soapHeader);

validateUserMessage(userMessage);
As4EnvelopeHeader envelopeHeader = parseAs4EnvelopeHeader(userMessage);
messageContext.put(AS4MessageContextKey.ENVELOPE_HEADER, envelopeHeader);

Expand Down Expand Up @@ -166,6 +167,20 @@ public SOAPMessage handle(SOAPMessage request, MessageContext messageContext) th
return response;
}

private void validateUserMessage(UserMessage userMessage) throws OxalisAs4Exception {
if (userMessage.getMessageInfo() == null){
throw new OxalisAs4Exception("Error processing User Message. Message information not found");
}else if (userMessage.getCollaborationInfo() == null){
throw new OxalisAs4Exception("Error processing User Message. Collaboration information not found");
}else if (userMessage.getPartyInfo() == null){
throw new OxalisAs4Exception("Error processing User Message. Party information not found");
}else if (userMessage.getMessageProperties() == null){
throw new OxalisAs4Exception("Error processing User Message. Message properties not found");
}else if (userMessage.getPayloadInfo() == null){
throw new OxalisAs4Exception("Error processing User Message. Payload information not found");
}
}

private X509Certificate getSenderCertificate(SOAPHeader soapHeader) {
try {
return SOAPHeaderParser.getSenderCertificate(soapHeader);
Expand Down

0 comments on commit 38a5316

Please sign in to comment.