[SWS-887] NullPointerException for a soap request with missing soap body tag Created: 09/Jan/15  Updated: 25/Mar/15  Resolved: 18/Mar/15

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.2.0.RELEASE
Fix Version/s: 2.2.1

Type: Bug Priority: Major
Reporter: Jim Liu Assignee: Arjen Poutsma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

There is Web Service which was built by using Spring WS 2.2.0 release. When service receiving a soap request with missing soap body tag, Spring WS thrown a NullPointerException exception. Here are the Exception and call stack:

[DEBUG]:[01/09/15 17:01:44.884]:[qtp713450595-20]:[org.springframework.ws.server.MessageDispatcher] - Endpoint invocation resulted in exception - responding with Fault
java.lang.NullPointerException: null
	at org.springframework.ws.soap.saaj.SaajSoapEnvelope.getBody(SaajSoapEnvelope.java:54) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:38) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.soap.AbstractSoapMessage.getPayloadSource(AbstractSoapMessage.java:50) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping.getLookupKeyForMessage(PayloadRootAnnotationMethodEndpointMapping.java:62) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping.getLookupKeyForMessage(PayloadRootAnnotationMethodEndpointMapping.java:52) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.endpoint.mapping.AbstractMethodEndpointMapping.getEndpointInternal(AbstractMethodEndpointMapping.java:62) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping.getEndpoint(AbstractEndpointMapping.java:119) ~[spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.MessageDispatcher.getEndpoint(MessageDispatcher.java:272) [spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:215) [spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176) [spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89) [spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at com.experian.atb.webservice.endpoints.ATBWebServiceMessageReceiverHandlerAdapter.handle(ATBWebServiceMessageReceiverHandlerAdapter.java:40) [classes/:na]
	at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293) [spring-ws-core-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) [spring-webmvc-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) [spring-webmvc-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [servlet-api-3.1.jar:3.1.0]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) [spring-webmvc-4.0.3.RELEASE.jar:4.0.3.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [servlet-api-3.1.jar:3.1.0]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:751) [jetty-servlet-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:566) [jetty-servlet-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578) [jetty-security-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:498) [jetty-servlet-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:199) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:98) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:309) [jetty-rewrite-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:98) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.Server.handle(Server.java:461) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:284) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244) [jetty-server-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:534) [jetty-io-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:607) [jetty-util-9.2.1.v20140609.jar:9.2.1.v20140609]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:536) [jetty-util-9.2.1.v20140609.jar:9.2.1.v20140609]
	at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]



 Comments   
Comment by Arjen Poutsma [ 18/Mar/15 ]

We now throw a SaajSoapBodyException instead of a NPE, as a SOAP Body tag is required according to the SOAP specifications.

Generated at Fri Dec 15 06:34:18 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.