From 21b5004162d17db0930649b3b019a5301ab76bf6 Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 18 Mar 2015 10:10:56 +0100 Subject: [PATCH] NullPointerException for request with no SOAP body SaajSoapEnvelope now throws an exception when the SOAP envelope contains no SOAP body. Issue: SWS-887 --- .../org/springframework/ws/soap/saaj/SaajSoapEnvelope.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-ws-core/src/main/java/org/springframework/ws/soap/saaj/SaajSoapEnvelope.java b/spring-ws-core/src/main/java/org/springframework/ws/soap/saaj/SaajSoapEnvelope.java index 424f6da9..25b8c36e 100644 --- a/spring-ws-core/src/main/java/org/springframework/ws/soap/saaj/SaajSoapEnvelope.java +++ b/spring-ws-core/src/main/java/org/springframework/ws/soap/saaj/SaajSoapEnvelope.java @@ -51,6 +51,9 @@ class SaajSoapEnvelope extends SaajSoapElement implements SoapEnve if (body == null) { try { SOAPBody saajBody = getSaajEnvelope().getBody(); + if (saajBody == null) { + throw new SaajSoapBodyException("SAAJ SOAP message has no body"); + } if (saajBody.getElementQName().getNamespaceURI() .equals(SoapVersion.SOAP_11.getEnvelopeNamespaceUri())) { body = new SaajSoap11Body(saajBody, langAttributeOnSoap11FaultString);