Project: mule
Issue MULE-8786: WSC with basic auth wraps "error"s HTTP status code by throwing exceptions with timeouts
When using WSC in conjunction with HTTP Basic Authentication (through HttpRequesterConfig) when bad credentials are used in the basic auth, the output I see is a timeout [1] rather than an exception caused by a 401 or 403 status code error. To reproduce so, I'm attaching a small SOAP server (demo-soap-server.zip) and a mule app to try it out [2]. The endpoint I'm hitting is http://localhost:9000/acme-crm/orders?wsdl where the valid credentials are user: admin pass: admin. In the mule app there are two flows to be executed * (a) http://localhost:8081/goodCredentials where once it's hit you will see something like the following in a browser {code:xml}0{code} * and (b) http://localhost:8081/badCredentials where once it's hit you will wait for the default timeout of the WSC to be consumed, seeing at the end the stack trace in the mule app [1]. The issue here is that, despite the app will fail because of bad credentials, the developer should be warn that the error was an unauthorized rather than timed-outed. [1] Mule app stack after hitting http://localhost:8081/badCredentials {code:java|title=log of the mule application} WARN 2015-07-16 17:54:43,634 [[wsc_wrong_cred].HTTP_Listener_Configuration.worker.01] org.apache.cxf.endpoint.ClientImpl: Timed out waiting for response to operation {http://support.cxf.module.mule.org/}invoke. ERROR 2015-07-16 17:54:43,647 [[wsc_wrong_cred].HTTP_Listener_Configuration.worker.01] org.mule.exception.DefaultMessagingExceptionStrategy: ******************************************************************************** Message : Timed out waiting for response to operation {http://support.cxf.module.mule.org/}invoke.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PushbackInputStream Type : org.mule.api.transport.DispatchException Code : MULE_ERROR--2 JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html Payload : java.io.PushbackInputStream@2ef70222 ******************************************************************************** Exception stack is: 1. Timed out waiting for response to operation {http://support.cxf.module.mule.org/}invoke. (java.io.IOException) org.apache.cxf.endpoint.ClientImpl:740 (null) 2. Timed out waiting for response to operation {http://support.cxf.module.mule.org/}invoke.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: PushbackInputStream (org.mule.api.transport.DispatchException) org.mule.module.cxf.CxfOutboundMessageProcessor:163 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html) ******************************************************************************** Root Exception stack trace: java.io.IOException: Timed out waiting for response to operation {http://support.cxf.module.mule.org/}invoke. org.apache.cxf.endpoint.ClientImpl.waitResponse(ClientImpl.java:740) org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:661) org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:581) org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481) org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:281) org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:128) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94) org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56) org.mule.processor.AbstractRequestResponseMessageProcessor.processBlocking(AbstractRequestResponseMessageProcessor.java:56) org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94) org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56) org.mule.module.ws.consumer.WSConsumer$1.processNext(WSConsumer.java:183) org.mule.processor.AbstractRequestResponseMessageProcessor.processBlocking(AbstractRequestResponseMessageProcessor.java:56) org.mule.processor.AbstractRequestResponseMessageProcessor.process(AbstractRequestResponseMessageProcessor.java:47) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:85) org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.module.ws.consumer.WSConsumer.process(WSConsumer.java:107) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:85) org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94) org.mule.processor.BlockingProcessorExecutor.execute(BlockingProcessorExecutor.java:56) org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:102) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:24) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:107) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:44) org.mule.processor.BlockingProcessorExecutor.executeNext(BlockingProcessorExecutor.java:94) org.mule.processor.BlockingProcess... ******************************************************************************** {code} [2] Mule application to try it out {code:xml|title=mule app.xml} %dw 1.0 %output application/xml %namespace ns0 http://server.connect.mulesoft.org/ --- {	ns0#Create: {	order: {	client: "failureCreatingOrder",	clientId: 1,	description: "someDesc",	id: 1,	items: {	sko: 1	},	shippingDate: |2003-10-01T23:57:59Z|	}	} } %dw 1.0 %output application/xml %namespace ns0 http://server.connect.mulesoft.org/ --- {	ns0#Create: {	order: {	client: "successCreatingOrder",	clientId: 1,	description: "description",	id: 1,	items: {	sko: 1	},	shippingDate: |2003-10-01T23:57:59Z|	}	} } {code}
Story points: 8