<route>
        <from uri="direct:Services"/>
        <convertBodyTo type="javax.xml.transform.dom.DOMSource" />
        <to
uri="nmr:{http://services.locator/}ServicesService:ServicesPort"/>
        <convertBodyTo type="javax.xml.transform.stream.StreamSource" />   
        <onException>
                           
<exception>org.apache.servicemix.cxfbc.interceptors.JbiFault</exception>
                            <redeliveryPolicy maximumRedeliveries="1" />
                            <handled><constant>true</constant></handled>
                            <transform>
                              <constant>
                                        &lt;kxml&gt;                            
                                                
&lt;responseCode&gt;91&lt;/responseCode&gt;
                                                
&lt;responseMessage&gt;Connection timed
out&lt;/responseMessage&gt;
                                        &lt;/kxml&gt;
                                </constant>
                            </transform>
                        </onException>
                        
                        <onException>
                            <exception>java.lang.Exception</exception>
                            <handled><constant>true</constant></handled>        
                                <transform>
                              <constant>
                                &lt;kxml&gt;                            
                                        
&lt;responseCode&gt;06&lt;/responseCode&gt;
                                        &lt;responseMessage&gt;Unknown 
Error&lt;/responseMessage&gt;
                                &lt;/kxml&gt;
                              </constant>
                            </transform>
                        </onException>
</route>


I am trying to create an exception clause for the route decribed above and
it failes with 

12:45:50,543 | ERROR | tenderThread-100 | ContextLoaderListener            |
BundleApplicationContextListener   50 | Application context refresh failed
(OsgiBundleXmlApplicationContext(bundle=kimono-bundle,
config=osgibundle:/META-INF/spring/*.xml))
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route
route37 at: >>> OnException[[class java.lang.Exception] ->
[Transform[constant{
                                <kxml>                          
                                        <responseCode>06</responseCode>
                                        <responseMessage>Unknown 
Error</responseMessage>
                                </kxml>
                              
                                <kxml>                          
                                        <responseCode>06</responseCode>
                                        <responseMessage>Unknown 
Error</responseMessage>
                                </kxml>
                              }]]] <<< in route: 
Route[[From[direct://Services]] ->
[OnException[[nul... because of null
        at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1039)



        at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route37 at: >>> OnException[[class java.lang.Exception] ->
[Transform[constant{
                                <kxml>                          
                                        <responseCode>06</responseCode>
                                        <responseMessage>Unknown 
Error</responseMessage>
                                </kxml>
                              
                                <kxml>                          
                                        <responseCode>06</responseCode>
                                        <responseMessage>Unknown 
Error</responseMessage>
                                </kxml>
                              }]]] <<< in route: 
Route[[From[direct://Services]] ->
[OnException[[nul... because of null
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:643)
        at
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:136)




Claus Ibsen-2 wrote:
> 
> On Thu, Feb 4, 2010 at 11:52 AM, lekkie <[email protected]> wrote:
>>
>> Hi,
>>
>> I'd like to set a custom message body after handling an exception.
>>
>> I have handled an exception with the following, how do I set the body to
>> a
>> desired message?
>>
>> <route>
>>        <from uri="direct:route2"/>
>>        <to uri="xslt:requestToSOAP.xsl"/>
>>         <!-- do other things -->
>>        <onException>
>>
>> <exception>org.apache.servicemix.cxfbc.interceptors.JbiFault</exception>
>>            <redeliveryPolicy maximumRedeliveries="1" />
>>            <handled><constant>true</constant></handled>
>>            <!-- set response message to client system here -->
>>      </onException>
>> </route>
>>
> 
> Just do it anyhow you like it using a Processor, POJO etc. You can
> just continue routing the message from that point.
> 
> If you did pickup the Camel in Action book yesterday which was on sale
> for 10$ you could see an example in chapter 5, listing 5.8.
> 
> 
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Setting-custom-response-message-after-handling-exception-tp27450868p27450868.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Setting-custom-response-message-after-handling-exception-tp27450868p27451994.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to