I have developed a camel application which is exposed as a webservice which
accepts SOAP/HTTP request from the client application, after processing the
request it has to invoke another system via Websphere MQ.

My camel application consists of two routes. First route is CXF route which
accepts the webservice request, Second route is used to perform the
necessary transformation logic and interacts with downstream system via
Websphere MQ. These two routes are communicating via camel direct.

The success scenario is working perfectly with out any issues. The problem I
am facing is with timeout/exeption scenarios after sending the downstream MQ
request.
Eg: when the downstrean target system didn't send the resonse intime.

Then defaultErrorHandler() handles the error and propagates the same
expection to the first route from there using "exchange.addOnCompletion(new
ServiceSync);"//implements Synchronization, the exception is routed to
"onFailure(final Exchange exchange)" there I am constructing custom
response. The issue is I am not able to send my custom response to the
client instead standard SOAP Fault is sending to the client 

SecondRoute:
        public void configure() throws Exception {
                errorHandler(defaultErrorHandler().maximumRedeliveries(0));
                from("direct:downStream")
                .transform(new Marshall())
                        .doTry()
                        .inOut(endpoint)
                        .end()
                .transform(new Unmarshall())
                ;
                
        }
Synchronization class:

public void onFailure(final Exchange exchange) {
        exchange.getIn().setBody(null);
        // Construct custom Response
        exchange.getOut().setBody(responseObject, ResponseObject.class);
        exchange.getOut().setHeaders(exchange.getIn().getHeaders());
        exchange.setException(null);
        exchange.removeProperty(Exchange.EXCEPTION_CAUGHT);
}

SOAP Fault:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>The OUT message was not received within: 5000 millis
due reply message with correlationID:
ID:w002564aa1e7e-4413-1334745520532-0:2:1:1:1 not received.
Exchange[Message: ..incomming request msg ..></faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Note: I am able to send the custom response if any exception occurred before
sending the downstream MQ request (before calling .inOut()). Can anyone help
me out in this regard.

Exception on Console:
[eplyManagerTimeoutChecker[InQ]] DefaultErrorHandler            ERROR Failed
delivery for exchangeId: ID-w002564aa1e7e-4409-1334745495988-0-3. Exhausted
after delivery attempt: 1 caught:
org.apache.camel.ExchangeTimedOutException: The OUT message was not received
within: 5000 millis due reply messag
e with correlationID: ID:w002564aa1e7e-4413-1334745520532-0:2:1:1:1 not
received. Exchange[Message: <?xml version="1.0" encoding="UTF-8"?>
-- incomming message --]
org.apache.cxf.interceptor.Fault: The OUT message was not received within:
5000 millis due reply message with correlationID:
ID:w002564aa1e7e-4413-1334745520532-0:2:1:1:1 not received.
Exchange[Message: <?xml version="1.0" encoding="UTF-8"?>incomming message
]
        at
org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:194)[camel-cxf-2.9.0.jar:2.9.0]
        at
org.apache.camel.component.cxf.CxfConsumer$1.setResponseBack(CxfConsumer.java:174)[camel-cxf-2.9.0.jar:2.9.0]
        at
org.apache.camel.component.cxf.CxfConsumer$1.syncInvoke(CxfConsumer.java:126)[camel-cxf-2.9.0.jar:2.9.0]
        at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:71)[camel-cxf-2.9.0.jar:2.9.0]
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[cxf-rt-core-2.5.2.jar:2.5.2]
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_26]
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_26]
        at
java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_26]
        at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[cxf-rt-core-2.5.2.jar:2.5.2]
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)[cxf-rt-core-2.5.2.jar:2.5.2]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)[cxf-api-2.5.2.jar:2.5.2]
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:123)[cxf-rt-core-2.5.2.jar:2.5.2]
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:207)[cxf-rt-transports-http-2.5.1.jar:2.5.2]
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:213)[cxf-rt-transports-http-2.5.1.jar:2.5.1]
        at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:193)[cxf-rt-transports-http-2.5.1.jar:2.5.1]
        at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:126)[cxf-rt-transports-http-2.5.1.jar:2.5.1]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:185)[cxf-rt-transports-http-2.5.1.jar:2.5.1]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:108)[cxf-rt-transports-http-2.5.1.jar:2.5.1]
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)[servlet-api.jar:]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:164)[cxf-rt-transports-http-2.5.1.jar:2.5.1]
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)[catalina.jar:7.0.21]
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)[catalina.jar:7.0.21]
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)[catalina.jar:7.0.21]
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:185)[catalina.jar:7.0.21]
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)[catalina.jar:7.0.21]
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)[catalina.jar:7.0.21]
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)[catalina.jar:7.0.21]
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)[catalina.jar:7.0.21]
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)[catalina.jar:7.0.21]
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)[catalina.jar:7.0.21]
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:269)[tomcat-coyote.jar:7.0.21]
        at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)[tomcat-coyote.jar:7.0.21]
        at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)[tomcat-coyote.jar:7.0.21]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_26]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_26]

--
View this message in context: 
http://camel.465427.n5.nabble.com/Issue-with-CXF-and-WebsphereMQ-using-Inout-tp5651374p5651374.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to