camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gnanda <gitanjali.na...@phaseforward.com>
Subject Re: reading soapfault message from HttpOperationFailedException
Date Fri, 11 Jun 2010 16:26:37 GMT

Thanks a lot willem for the reply.
I am still stuck with the issue, not sure what is going on
I do get exception as
org.apache.camel.component.http.HttpOperationFailedException. I have the
exception log attached below.
But when I tried getting the exception as HttpOperationFailedException it
prints NULL and prints "exception is not instanceof
http.HttpOperationFailedException" from the below log statements.
Any help is appreciated

Here is the code snippet
onException(Exception.class).onWhen(new Predicate() {

			public boolean matches(Exchange exchange) {
				log.info(exchange);
org.apache.camel.component.http.HttpOperationFailedException ex1 =
exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
						org.apache.camel.component.http.HttpOperationFailedException.class);
				log.info("HttpOperatioFailedException is:"+ex1);
				Exception ex = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
						Exception.class);
				if(ex instanceof
org.apache.camel.component.http.HttpOperationFailedException){
					log.info("exception is instanceof http.HttpOperationFailedException");
					org.apache.camel.component.http.HttpOperationFailedException ex2
=(org.apache.camel.component.http.HttpOperationFailedException)ex;
					log.info("response body is:"+ ex2.getResponseBody());
				}
				else{
					log.info("exception is not instanceof
http.HttpOperationFailedException");
				}

2010-06-11 12:18:29,898 |12:18:29,898 | ERROR | tenerContainer-5 |
DefaultErrorHandler              | rg.apache.camel.processor.Logger  248 |
Failed delivery for exchangeId: ID:LPF004689-2995-1276268480402-0:6:1:1:1.
Exhausted after delivery attempt: 2 caught:
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://localhost/orderapp/OrderProcess with statusCode: 500.
Processed by failure processor:
Pipeline[Channel[sendTo(Endpoint[jms://queue:MM.500Q])],
Channel[com.pf.simpleconsumer.camelrouter.DefaultErrorHandler@1bc1819]]
org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://localhost/orderapp/OrderProcess with statusCode: 500
	at
org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:150)
	at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:92)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
	at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)



willem.jiang wrote:
> 
> Hi,
> 
> You can get the soap fault  message detail by checking out the 
> responseBody from the HttpOperationFailedException.
> 
> Willem
> 
> gnanda wrote:
>> Hi All,
>> I am using camel 2.2 with servicemix 4.2
>> I am trying to retrieve soapFault message from
>> HttpOperationFailedException
>> I could able to print the exception as below
>> Exception ex =
>> exchange.getProperty(Exchange.EXCEPTION_CAUGHT,Exception.class);
>> log.info(ex);
>> It prints the message as below
>> "org.apache.camel.component.http.HttpOperationFailedException: HTTP
>> operation failed invoking
>> http://localhost/orderapp/OrderProcess?httpClientConfigurerRef=com.pf.simpleconsumer.camelrouter.DefaultHttpClientConfigurer
>> with statusCode: 500"
>> 
>> The above string does not have soapfault message.How would I extract
>> soapfault message in my onException() block ?
>> How do I retrieve the fault code?
>> 
>> Any help is appreciated
>> 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/reading-soapfault-message-from-HttpOperationFailedException-tp28847433p28857325.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message