You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by pratibhaG <pr...@in2m.com> on 2008/10/23 14:40:05 UTC
How to use setBody and xpath together?
I am using camel in servicemix
I am doing like this:
from("jbi:service:http://servicemix.in2m.com/operations/errorhandler/ResolvedErrorConsumerService")
.setBody(xpath("error/requestData"))
.intercept(new CustomDelegateProcessor())
.recipientList(header(ErrorConstants.APPLICATION_NAME).append("?mep=in-out"));
This code gives me null in message for recipient. How can I resolve it?
Here are the logs:
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.64-11d29ba52bd-5:1
DEBUG - CamelJbiEndpoint - Received exchange: InOnly[
id: ID:192.168.2.64-11d29ba52bd-5:1
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d29ba52bd-6-6
in: <?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
]
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.64-11d29ba52bd-2:6 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SecuredBroker - service name
:{http://servicemix.in2m.com/operations/errorhandler}DirectorService
DEBUG - SecuredBroker - operation name :null
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.64-11d29ba52bd-2:6 (13a8983) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@8e2cf dequeued exchange:
InOut[
id: ID:192.168.2.64-11d29ba52bd-2:6
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}DirectorService
endpoint: directorEndpoint
in: null
]
DEBUG - HttpComponent - Received exchange: status: Active,
role: provider
DEBUG - HttpComponent - Retrieved correlation id: null
ERROR - HttpComponent - Error processing exchange InOut[
id: ID:192.168.2.64-11d29ba52bd-2:6
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}DirectorService
endpoint: directorEndpoint
in: null
]
javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
document has no root (ie. trying to output empty document).
at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
at
com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1502)
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1663)
at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:130)
at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)
at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:335)
at
org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:137)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d29ba52bd-2:6 in DeliveryChannel{servicemix-http}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@10057d3 dequeued
exchange: InOut[
id: ID:192.168.2.64-11d29ba52bd-2:6
status: Error
role: consumer
service:
{http://servicemix.in2m.com/operations/errorhandler}DirectorService
endpoint: directorEndpoint
in: null
error: javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT
when document has no root (ie. trying to output empty document).
]
DEBUG - DeliveryChannelImpl - Notifying exchange
ID:192.168.2.64-11d29ba52bd-2:6(13a8983) in
DeliveryChannel{servicemix-camel} from processInboundSynchronousExchange
DEBUG - DeliveryChannelImpl - Notified:
ID:192.168.2.64-11d29ba52bd-2:6(13a8983) in
DeliveryChannel{servicemix-camel} from sendSync
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/33499-1224765784014/0-1. On delivery attempt: 0 caught:
javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
document has no root (ie. trying to output empty document).
javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
document has no root (ie. trying to output empty document).
at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
at
com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1502)
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1663)
at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:130)
at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)
at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:335)
at
org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:137)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
*******************request=JbiMessage:
org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@1d2d4e5{properties:
{org.apache.camel.Redelivered=true, org.apache.camel.RedeliveryCounter=1,
application=jbi:service:http://servicemix.in2m.com/operations/errorhandler/DirectorService}}
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=ID:192.168.2.64-11d29ba52bd-0:1] with service:
null component: org.apache.servicemix.client.DefaultServiceMixClient@ce2624
INFO - ComponentMBeanImpl - Initializing component:
ID:192.168.2.64-11d29ba52bd-0:1
INFO - ComponentMBeanImpl - Starting component:
ID:192.168.2.64-11d29ba52bd-0:1
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d29ba52bd-21:0 in
DeliveryChannel{ID:192.168.2.64-11d29ba52bd-0:1}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - S
--
View this message in context: http://www.nabble.com/How-to-use-setBody-and-xpath-together--tp20130051s22882p20130051.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: How to use setBody and xpath together?
Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi
What does the intercept do?
Could you try without it?
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com]
Sent: 24. oktober 2008 14:10
To: camel-user@activemq.apache.org
Subject: Re: How to use setBody and xpath together?
I did as you said :
from("jbi:service:http://servicemix.in2m.com/operations/errorhandler/ResolvedErrorConsumerService")
.setBody(xpath("error/requestData"))
.convertBodyTo(String.class).to("log:before-recipient-list")
.intercept(new CustomDelegateProcessor())
.recipientList(header(ErrorConstants.APPLICATION_NAME).append("?mep=in-out"));
This is what I got at logs:
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.64-11d2d51eb94-5:18
DEBUG - CamelJbiEndpoint - Received exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:18
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-29
in: <?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
]
[Fatal Error] :1:1: Content is not allowed in prolog.
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. On delivery attempt: 0 caught:
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:411)
at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:50)
at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:67)
at
org.apache.camel.util.ExchangeHelper.convertToType(ExchangeHelper.java:175)
at
org.apache.servicemix.camel.JbiBinding.convertBodyToJbi(JbiBinding.java:56)
at
org.apache.servicemix.camel.JbiMessage.setBody(JbiMessage.java:163)
at
org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:50)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
at
org.apache.servicemix.camel.CamelJbiEndpoint.handleActiveProviderExchange(CamelJbiEndpoint.java:94)
at
org.apache.servicemix.camel.CamelJbiEndpoint.process(CamelJbiEndpoint.java:74)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSourceFromStream(XmlConverter.java:360)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSource(XmlConverter.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:407)
... 27 more
*******************request=JbiMessage:
org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@1047fcd{properties:
{org.apache.camel.Redelivered=true, org.apache.camel.RedeliveryCounter=1,
application=jbi:service:http://servicemix.in2m.com/operations/errorhandler/DirectorService}}
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=ID:192.168.2.64-11d2d51eb94-0:16] with service:
null component: org.apache.servicemix.client.DefaultServiceMixClient@95a1cf
INFO - ComponentMBeanImpl - Initializing component:
ID:192.168.2.64-11d2d51eb94-0:16
INFO - ComponentMBeanImpl - Starting component:
ID:192.168.2.64-11d2d51eb94-0:16
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-131:0 in
DeliveryChannel{ID:192.168.2.64-11d2d51eb94-0:16}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SecuredBroker - service name
:{http://servicemix.in2m.com/operations/errorhandler}SystemErrorService
DEBUG - SecuredBroker - operation name :null
DEBUG - SedaFlow - Called Flow send
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. Handled by the failure
processor: Delegate(null)
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-5:18 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@5dd23e dequeued
exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:18
status: Done
role: consumer
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-29
in: null
]
--
View this message in context: http://www.nabble.com/How-to-use-setBody-and-xpath-together--tp20130051s22882p20148919.html
Sent from the Camel - Users mailing list archive at Nabble.com.
RE: How to use setBody and xpath together?
Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi
You get this ERRO:
[Fatal Error] :1:1: Content is not allowed in prolog.
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. On delivery attempt: 0 caught:
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
It's indicating that your xml has an invalid header (the <?xml ...> stuff). However even though it looks okay? Could you try using a different encoding utf-8 changed to iso-8859-1.
If you Google "Content is not allowed in prolog" and "xerces" you will got a ton of hits with this problem.
Med venlig hilsen
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: pratibhaG [mailto:pratibha.ghogale@in2m.com]
Sent: 24. oktober 2008 14:10
To: camel-user@activemq.apache.org
Subject: Re: How to use setBody and xpath together?
I did as you said :
from("jbi:service:http://servicemix.in2m.com/operations/errorhandler/ResolvedErrorConsumerService")
.setBody(xpath("error/requestData"))
.convertBodyTo(String.class).to("log:before-recipient-list")
.intercept(new CustomDelegateProcessor())
.recipientList(header(ErrorConstants.APPLICATION_NAME).append("?mep=in-out"));
This is what I got at logs:
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.64-11d2d51eb94-5:18
DEBUG - CamelJbiEndpoint - Received exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:18
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-29
in: <?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
]
[Fatal Error] :1:1: Content is not allowed in prolog.
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. On delivery attempt: 0 caught:
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:411)
at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:50)
at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:67)
at
org.apache.camel.util.ExchangeHelper.convertToType(ExchangeHelper.java:175)
at
org.apache.servicemix.camel.JbiBinding.convertBodyToJbi(JbiBinding.java:56)
at
org.apache.servicemix.camel.JbiMessage.setBody(JbiMessage.java:163)
at
org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:50)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
at
org.apache.servicemix.camel.CamelJbiEndpoint.handleActiveProviderExchange(CamelJbiEndpoint.java:94)
at
org.apache.servicemix.camel.CamelJbiEndpoint.process(CamelJbiEndpoint.java:74)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSourceFromStream(XmlConverter.java:360)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSource(XmlConverter.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:407)
... 27 more
*******************request=JbiMessage:
org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@1047fcd{properties:
{org.apache.camel.Redelivered=true, org.apache.camel.RedeliveryCounter=1,
application=jbi:service:http://servicemix.in2m.com/operations/errorhandler/DirectorService}}
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=ID:192.168.2.64-11d2d51eb94-0:16] with service:
null component: org.apache.servicemix.client.DefaultServiceMixClient@95a1cf
INFO - ComponentMBeanImpl - Initializing component:
ID:192.168.2.64-11d2d51eb94-0:16
INFO - ComponentMBeanImpl - Starting component:
ID:192.168.2.64-11d2d51eb94-0:16
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-131:0 in
DeliveryChannel{ID:192.168.2.64-11d2d51eb94-0:16}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SecuredBroker - service name
:{http://servicemix.in2m.com/operations/errorhandler}SystemErrorService
DEBUG - SecuredBroker - operation name :null
DEBUG - SedaFlow - Called Flow send
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. Handled by the failure
processor: Delegate(null)
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-5:18 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@5dd23e dequeued
exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:18
status: Done
role: consumer
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-29
in: null
]
--
View this message in context: http://www.nabble.com/How-to-use-setBody-and-xpath-together--tp20130051s22882p20148919.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to use setBody and xpath together?
Posted by pratibhaG <pr...@in2m.com>.
I did as you said :
from("jbi:service:http://servicemix.in2m.com/operations/errorhandler/ResolvedErrorConsumerService")
.setBody(xpath("error/requestData"))
.convertBodyTo(String.class).to("log:before-recipient-list")
.intercept(new CustomDelegateProcessor())
.recipientList(header(ErrorConstants.APPLICATION_NAME).append("?mep=in-out"));
This is what I got at logs:
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.64-11d2d51eb94-5:18
DEBUG - CamelJbiEndpoint - Received exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:18
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-29
in: <?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
]
[Fatal Error] :1:1: Content is not allowed in prolog.
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. On delivery attempt: 0 caught:
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException:
Content is not allowed in prolog.
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:411)
at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:50)
at
org.apache.camel.impl.converter.DefaultTypeConverter.convertTo(DefaultTypeConverter.java:67)
at
org.apache.camel.util.ExchangeHelper.convertToType(ExchangeHelper.java:175)
at
org.apache.servicemix.camel.JbiBinding.convertBodyToJbi(JbiBinding.java:56)
at
org.apache.servicemix.camel.JbiMessage.setBody(JbiMessage.java:163)
at
org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:50)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:155)
at
org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:91)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:85)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:57)
at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:39)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
at
org.apache.servicemix.camel.CamelJbiEndpoint.handleActiveProviderExchange(CamelJbiEndpoint.java:94)
at
org.apache.servicemix.camel.CamelJbiEndpoint.process(CamelJbiEndpoint.java:74)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSourceFromStream(XmlConverter.java:360)
at
org.apache.camel.converter.jaxp.XmlConverter.toDOMSource(XmlConverter.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:407)
... 27 more
*******************request=JbiMessage:
org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@1047fcd{properties:
{org.apache.camel.Redelivered=true, org.apache.camel.RedeliveryCounter=1,
application=jbi:service:http://servicemix.in2m.com/operations/errorhandler/DirectorService}}
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=ID:192.168.2.64-11d2d51eb94-0:16] with service:
null component: org.apache.servicemix.client.DefaultServiceMixClient@95a1cf
INFO - ComponentMBeanImpl - Initializing component:
ID:192.168.2.64-11d2d51eb94-0:16
INFO - ComponentMBeanImpl - Starting component:
ID:192.168.2.64-11d2d51eb94-0:16
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-131:0 in
DeliveryChannel{ID:192.168.2.64-11d2d51eb94-0:16}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SecuredBroker - service name
:{http://servicemix.in2m.com/operations/errorhandler}SystemErrorService
DEBUG - SecuredBroker - operation name :null
DEBUG - SedaFlow - Called Flow send
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-17. Handled by the failure
processor: Delegate(null)
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-5:18 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@5dd23e dequeued
exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:18
status: Done
role: consumer
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-29
in: null
]
--
View this message in context: http://www.nabble.com/How-to-use-setBody-and-xpath-together--tp20130051s22882p20148919.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to use setBody and xpath together?
Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,
Could you try adding a
convertBodyTo(String.class).to("log:before-recipient-list") right before
the recipient list bit? The logs indicate that an empty message is
being sent to the errorhandler service.
Regards,
Gert
pratibhaG wrote:
> What is wrong in this code
>
> from("jbi:service:http://servicemix.in2m.com/operations/errorhandler/ResolvedErrorConsumerService")
> .setBody(xpath("error/requestData/request"))
> .intercept(new CustomDelegateProcessor())
>
> .recipientList(header(ErrorConstants.APPLICATION_NAME).append("?mep=in-out"));
>
>
>
> This gives me following output at logs :
>
>
> DEBUG - SedaQueue -
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@3ffd2a dequeued
> exchange: InOnly[
> id: ID:192.168.2.64-11d2d51eb94-5:9
> status: Active
> role: provider
> service:
> {http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
> endpoint: camel192-168-2-64-11d2d51eb94-6-14
> in: <?xml version="1.0" encoding="UTF-8"?><error>
> <errorCode>4000</errorCode>
> <requestData><request>
> <updateUserProfile>
> <userName>0910user1</userName>
> <firstName>pratibhaPp</firstName>
> <lastName>ghogalePp</lastName>
> <emailAddress>pratibha.ghogale@in2m.com</emailAddress>
> </updateUserProfile>
> </request></requestData>
> <message>java.net.ConnectException: Connection refused</message>
> <service>DirectorService</service>
> </error>
> ]
> DEBUG - CamelJbiComponent - Received exchange: status: Active,
> role: provider
> DEBUG - CamelJbiComponent - Retrieved correlation id:
> ID:192.168.2.64-11d2d51eb94-5:9
> DEBUG - CamelJbiEndpoint - Received exchange: InOnly[
> id: ID:192.168.2.64-11d2d51eb94-5:9
> status: Active
> role: provider
> service:
> {http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
> endpoint: camel192-168-2-64-11d2d51eb94-6-14
> in: <?xml version="1.0" encoding="UTF-8"?><error>
> <errorCode>4000</errorCode>
> <requestData><request>
> <updateUserProfile>
> <userName>0910user1</userName>
> <firstName>pratibhaPp</firstName>
> <lastName>ghogalePp</lastName>
> <emailAddress>pratibha.ghogale@in2m.com</emailAddress>
> </updateUserProfile>
> </request></requestData>
> <message>java.net.ConnectException: Connection refused</message>
> <service>DirectorService</service>
> </error>
> ]
> DEBUG - DeliveryChannelImpl - SendSync
> ID:192.168.2.64-11d2d51eb94-2:15 in DeliveryChannel{servicemix-camel}
> DEBUG - SecuredBroker - send exchange with secure broker
> DEBUG - SecuredBroker - service name
> :{http://servicemix.in2m.com/operations/errorhandler}DirectorService
> DEBUG - SecuredBroker - operation name :null
> DEBUG - SedaFlow - Called Flow send
> DEBUG - DeliveryChannelImpl - Waiting for exchange
> ID:192.168.2.64-11d2d51eb94-2:15 (1e4a154) to be answered in
> DeliveryChannel{servicemix-camel} from sendSync
> DEBUG - SedaQueue -
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@11ba955 dequeued
> exchange: InOut[
> id: ID:192.168.2.64-11d2d51eb94-2:15
> status: Active
> role: provider
> service:
> {http://servicemix.in2m.com/operations/errorhandler}DirectorService
> endpoint: directorEndpoint
> in: null
> ]
> DEBUG - HttpComponent - Received exchange: status: Active,
> role: provider
> DEBUG - HttpComponent - Retrieved correlation id: null
> ERROR - HttpComponent - Error processing exchange InOut[
> id: ID:192.168.2.64-11d2d51eb94-2:15
> status: Active
> role: provider
> service:
> {http://servicemix.in2m.com/operations/errorhandler}DirectorService
> endpoint: directorEndpoint
> in: null
> ]
> javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
> document has no root (ie. trying to output empty document).
> at
> com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
> at
> com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1502)
> at
> com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1663)
> at
> com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
> at
> org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:130)
> at
> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)
> at
> org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:335)
> at
> org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:137)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
> at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
> at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> at java.lang.Thread.run(Thread.java:595)
> DEBUG - DeliveryChannelImpl - Send
> ID:192.168.2.64-11d2d51eb94-2:15 in DeliveryChannel{servicemix-http}
> DEBUG - SecuredBroker - send exchange with secure broker
> DEBUG - SedaFlow - Called Flow send
> DEBUG - SedaQueue -
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@10a4b9e dequeued
> exchange: InOut[
> id: ID:192.168.2.64-11d2d51eb94-2:15
> status: Error
> role: consumer
> service:
> {http://servicemix.in2m.com/operations/errorhandler}DirectorService
> endpoint: directorEndpoint
> in: null
> error: javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT
> when document has no root (ie. trying to output empty document).
> ]
> DEBUG - DeliveryChannelImpl - Notifying exchange
> ID:192.168.2.64-11d2d51eb94-2:15(1e4a154) in
> DeliveryChannel{servicemix-camel} from processInboundSynchronousExchange
> DEBUG - DeliveryChannelImpl - Notified:
> ID:192.168.2.64-11d2d51eb94-2:15(1e4a154) in
> DeliveryChannel{servicemix-camel} from sendSync
> ERROR - DeadLetterChannel - Failed delivery for exchangeId:
> ID-gpratibha.site/51845-1224826008387/0-9. On delivery attempt: 0 caught:
> javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
> document has no root (ie. trying to output empty document).
> javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
> document has no root (ie. trying to output empty document).
> at
> com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
> at
> com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1502)
> at
> com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1663)
> at
> com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
> at
> org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:130)
> at
> org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)
> at
> org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:335)
> at
> org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:137)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
> at
> org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
> at
> org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
> at
> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
> at
> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
> at
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> at java.lang.Thread.run(Thread.java:595)
> *******************request=JbiMessage:
> org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@f441ae{properties:
> {org.apache.camel.Redelivered=true, org.apache.camel.RedeliveryCounter=1,
> application=jbi:service:http://servicemix.in2m.com/operations/errorhandler/DirectorService}}
> INFO - JBIContainer - Activating component for:
> [container=ServiceMix,name=ID:192.168.2.64-11d2d51eb94-0:8] with service:
> null component: org.apache.servicemix.client.DefaultServiceMixClient@ff32b9
> INFO - ComponentMBeanImpl - Initializing component:
> ID:192.168.2.64-11d2d51eb94-0:8
> INFO - ComponentMBeanImpl - Starting component:
> ID:192.168.2.64-11d2d51eb94-0:8
> DEBUG - DeliveryChannelImpl - Send
> ID:192.168.2.64-11d2d51eb94-68:0 in
> DeliveryChannel{ID:192.168.2.64-11d2d51eb94-0:8}
> DEBUG - SecuredBroker - send exchange with secure broker
> DEBUG - SecuredBroker - service name
> :{http://servicemix.in2m.com/operations/errorhandler}SystemErrorService
> DEBUG - SecuredBroker - operation name :null
> DEBUG - SedaFlow - Called Flow send
> ERROR - DeadLetterChannel - Failed delivery for exchangeId:
> ID-gpratibha.site/51845-1224826008387/0-9. Handled by the failure processor:
> Delegate(null)
> DEBUG - DeliveryChannelImpl - Send
> ID:192.168.2.64-11d2d51eb94-5:9 in DeliveryChannel{servicemix-camel}
> DEBUG - SecuredBroker - send exchange with secure broker
> DEBUG - SedaFlow - Called Flow send
> DEBUG - SedaQueue -
> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@191edf9 dequeued
> exchange: InOnly[
> id: ID:192.168.2.64-11d2d51eb94-5:9
> status: Done
>
>
Re: How to use setBody and xpath together?
Posted by pratibhaG <pr...@in2m.com>.
What is wrong in this code
from("jbi:service:http://servicemix.in2m.com/operations/errorhandler/ResolvedErrorConsumerService")
.setBody(xpath("error/requestData/request"))
.intercept(new CustomDelegateProcessor())
.recipientList(header(ErrorConstants.APPLICATION_NAME).append("?mep=in-out"));
This gives me following output at logs :
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@3ffd2a dequeued
exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:9
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-14
in: <?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
]
DEBUG - CamelJbiComponent - Received exchange: status: Active,
role: provider
DEBUG - CamelJbiComponent - Retrieved correlation id:
ID:192.168.2.64-11d2d51eb94-5:9
DEBUG - CamelJbiEndpoint - Received exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:9
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}ResolvedErrorConsumerService
endpoint: camel192-168-2-64-11d2d51eb94-6-14
in: <?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
]
DEBUG - DeliveryChannelImpl - SendSync
ID:192.168.2.64-11d2d51eb94-2:15 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SecuredBroker - service name
:{http://servicemix.in2m.com/operations/errorhandler}DirectorService
DEBUG - SecuredBroker - operation name :null
DEBUG - SedaFlow - Called Flow send
DEBUG - DeliveryChannelImpl - Waiting for exchange
ID:192.168.2.64-11d2d51eb94-2:15 (1e4a154) to be answered in
DeliveryChannel{servicemix-camel} from sendSync
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@11ba955 dequeued
exchange: InOut[
id: ID:192.168.2.64-11d2d51eb94-2:15
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}DirectorService
endpoint: directorEndpoint
in: null
]
DEBUG - HttpComponent - Received exchange: status: Active,
role: provider
DEBUG - HttpComponent - Retrieved correlation id: null
ERROR - HttpComponent - Error processing exchange InOut[
id: ID:192.168.2.64-11d2d51eb94-2:15
status: Active
role: provider
service:
{http://servicemix.in2m.com/operations/errorhandler}DirectorService
endpoint: directorEndpoint
in: null
]
javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
document has no root (ie. trying to output empty document).
at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
at
com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1502)
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1663)
at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:130)
at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)
at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:335)
at
org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:137)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-2:15 in DeliveryChannel{servicemix-http}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@10a4b9e dequeued
exchange: InOut[
id: ID:192.168.2.64-11d2d51eb94-2:15
status: Error
role: consumer
service:
{http://servicemix.in2m.com/operations/errorhandler}DirectorService
endpoint: directorEndpoint
in: null
error: javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT
when document has no root (ie. trying to output empty document).
]
DEBUG - DeliveryChannelImpl - Notifying exchange
ID:192.168.2.64-11d2d51eb94-2:15(1e4a154) in
DeliveryChannel{servicemix-camel} from processInboundSynchronousExchange
DEBUG - DeliveryChannelImpl - Notified:
ID:192.168.2.64-11d2d51eb94-2:15(1e4a154) in
DeliveryChannel{servicemix-camel} from sendSync
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-9. On delivery attempt: 0 caught:
javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
document has no root (ie. trying to output empty document).
javax.xml.stream.XMLStreamException: Trying to write END_DOCUMENT when
document has no root (ie. trying to output empty document).
at
com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
at
com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1502)
at
com.ctc.wstx.sw.BaseStreamWriter.finishDocument(BaseStreamWriter.java:1663)
at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:585)
at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(SoapWriter.java:130)
at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:92)
at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(ProviderProcessor.java:335)
at
org.apache.servicemix.http.processors.ProviderProcessor.process(ProviderProcessor.java:137)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:538)
at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:490)
at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
*******************request=JbiMessage:
org.apache.servicemix.jbi.messaging.NormalizedMessageImpl@f441ae{properties:
{org.apache.camel.Redelivered=true, org.apache.camel.RedeliveryCounter=1,
application=jbi:service:http://servicemix.in2m.com/operations/errorhandler/DirectorService}}
INFO - JBIContainer - Activating component for:
[container=ServiceMix,name=ID:192.168.2.64-11d2d51eb94-0:8] with service:
null component: org.apache.servicemix.client.DefaultServiceMixClient@ff32b9
INFO - ComponentMBeanImpl - Initializing component:
ID:192.168.2.64-11d2d51eb94-0:8
INFO - ComponentMBeanImpl - Starting component:
ID:192.168.2.64-11d2d51eb94-0:8
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-68:0 in
DeliveryChannel{ID:192.168.2.64-11d2d51eb94-0:8}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SecuredBroker - service name
:{http://servicemix.in2m.com/operations/errorhandler}SystemErrorService
DEBUG - SecuredBroker - operation name :null
DEBUG - SedaFlow - Called Flow send
ERROR - DeadLetterChannel - Failed delivery for exchangeId:
ID-gpratibha.site/51845-1224826008387/0-9. Handled by the failure processor:
Delegate(null)
DEBUG - DeliveryChannelImpl - Send
ID:192.168.2.64-11d2d51eb94-5:9 in DeliveryChannel{servicemix-camel}
DEBUG - SecuredBroker - send exchange with secure broker
DEBUG - SedaFlow - Called Flow send
DEBUG - SedaQueue -
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1@191edf9 dequeued
exchange: InOnly[
id: ID:192.168.2.64-11d2d51eb94-5:9
status: Done
--
View this message in context: http://www.nabble.com/How-to-use-setBody-and-xpath-together--tp20130051s22882p20145010.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to use setBody and xpath together?
Posted by pratibhaG <pr...@in2m.com>.
The resolved error consumer consumes the message in format
<?xml version="1.0" encoding="UTF-8"?><error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
This should set the message body as
<request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request>
and send it to the recipient name given in header.
I tried using splitter. It does the above but only problem is it does not
change the actual message body. If I do
exchange.getIn().getBody(String.class)
it returns me
<error>
<errorCode>4000</errorCode>
<requestData><request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request></requestData>
<message>java.net.ConnectException: Connection refused</message>
<service>DirectorService</service>
</error>
but I need
<request>
<updateUserProfile>
<userName>0910user1</userName>
<firstName>pratibhaPp</firstName>
<lastName>ghogalePp</lastName>
<emailAddress>pratibha.ghogale@in2m.com</emailAddress>
</updateUserProfile>
</request>
How to achieve this?
--
View this message in context: http://www.nabble.com/How-to-use-setBody-and-xpath-together--tp20130051s22882p20130172.html
Sent from the Camel - Users mailing list archive at Nabble.com.