[SWS-330] WebServiceTemplate hasFaut skips check for fault in response if the connection implements FaultAwareWebServiceConnection Created: 14/Apr/08  Updated: 05/May/08  Resolved: 29/Apr/08

Status: Closed
Project: Spring Web Services
Component/s: Core
Affects Version/s: 1.5
Fix Version/s: 1.5.1

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

Tomcat 4.1.36 / JDK 1.4_14


Issue Links:
Depends
depends on SWS-338 Inspect Content-Type in WebServiceTem... Closed
Related
is related to SWS-137 WebServiceTemplate hasFaut skips chec... Closed
is related to SWS-308 WebServiceTemplate skips handling fau... Closed

 Description   

Hello,
I use WebserviceTemplate configured
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<constructor-arg ref="messageFactory"/>
<property name="checkConnectionForFault" value="true"></property>
</bean>.

As you can see, my server returns an error 500, but due to the code of hasError:
return !(faultConnection.hasFault() && request instanceof FaultAwareWebServiceMessage);

hasError returns false.
this code seems strange to me, if a 500 is returned the response might not be XML so unmarshalling will fail and it does:
org.springframework.ws.soap.axiom.AxiomSoapMessageCreationException: Unknown content type 'text/html;charset=ISO-8859-1'
at org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.getSoapEnvelopeNamespace(AxiomSoapMessageFactory.java:262)
at org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.createAxiomSoapMessage(AxiomSoapMessageFactory.java:224)
at org.springframework.ws.soap.axiom.AxiomSoapMessageFactory.createWebServiceMessage(AxiomSoapMessageFactory.java:196)
at org.springframework.ws.transport.AbstractWebServiceConnection.receive(AbstractWebServiceConnection.java:53)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:491)
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:440)
at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:395)
at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:341)
at org.springframework.ws.client.core.WebServiceTemplate.sendSourceAndReceiveToResult(WebServiceTemplate.java:326)
at com.kingfisher.product.wsclient.TestSpringWSClient.main(TestSpringWSClient.java:100)

Related to http://jira.springframework.org/browse/SWS-137.

Request:
POST /TutorialWS/services/LocalProduct HTTP/1.1
Accept-Encoding: gzip
Content-Type: text/xml; charset="UTF-8"
SOAPAction: ""
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.4.2_12
Host: 127.0.0.1:9090
Accept: text/html, image/gif, image/jpeg, ; q=.2, */; q=.2
Connection: keep-alive
Content-Length: 486

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><v1:getLocatedProducts xmlns:v1="http://v1.product.ws.store.kingfisher.com" xmlns:xsd="http://data.v1.product.ws.store.kingfisher.com/xsd"><v1:param0><xsd:callType>1</xsd:callType><xsd:familyCode>1</xsd:familyCode><xsd:moduleCode>1</xsd:moduleCode><xsd:subFamilyCode>1</xsd:subFamilyCode></v1:param0></v1:getLocatedProducts></soapenv:Body></soapenv:Envelope>

Response:
HTTP/1.1 500 Erreur Interne de Servlet
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=ISO-8859-1
Content-Language: fr-FR
Transfer-Encoding: chunked
Date: Mon, 14 Apr 2008 17:06:47 GMT
Connection: close

<html><head><title>Apache Tomcat/4.1.36-LE-jdk14 - Rapport d'erreur</title><STYLE><!--H1

{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;}

H3

{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;}

BODY

{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;}

B

{color : white;background-color : #0086b2;}

HR

{color : #0086b2;}

--></STYLE> </head><body><h1>Etat HTTP 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Rapport d'exception</p><p><b>message</b> <u></u></p><p><b>description</b> <u>Le serveur a rencontr� une erreur interne () qui l'a emp�ch� de satisfaire la requ�te.</u></p><p><b>exception</b> <pre>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NoClassDefFoundError: Test
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:535)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:463)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:198)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:545)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NoClassDefFoundError: Test
at com.kingfisher.product.ws.ProductWsMarshallingEndpoint.invokeInternal(ProductWsMarshallingEndpoint.java:58)
at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:131)
at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:216)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:163)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
... 37 more
</pre></p><p><b>cause m�re</b> <pre>java.lang.NoClassDefFoundError: Test
at com.kingfisher.product.ws.ProductWsMarshallingEndpoint.invokeInternal(ProductWsMarshallingEndpoint.java:58)
at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:131)
at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:216)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:163)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:197)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:523)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:463)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:198)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:545)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:534)
</pre></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/4.1.36-LE-jdk14</h3></body></html>



 Comments   
Comment by Arjen Poutsma [ 27/Apr/08 ]

Due to the wide variety of WS servers out there, it is quite hard to create a handleError() method that satisfies everybody. (See the linked to issues, for instance). Therefore, I think it's best if the error resolution is made pluggable, similarly to the FaultMessageResolver. That way, you can just plug in your error handling strategy, with a sensible, WS-I compliant default provided.

Comment by Arjen Poutsma [ 29/Apr/08 ]

Ignore my earlier comment: error resolution is not pluggable.

Instead, I'm now checking the response content-type, so see whether it's XML. I've also added a checkConnectionForError property, which - when set to false - completely ignores any HTTP status codes.

Comment by Arjen Poutsma [ 05/May/08 ]

Closing issues for 1.5.1

Generated at Thu Dec 14 13:14:42 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.