Vasumathi, Not sure if you're both working on the same project, but a user on the fusesource.com forum had a very similar problem. Just providing a reference to the thread so it might help you as well http://fusesource.com/forums/thread.jspa?threadID=594&tstart=0.
The MEP change you observed is OK actually: the content-enricher receives an InOnly exchange and then sends a second, InOut exchange to the servicemix-bean POJO. The in message will contain the original message content and your bean can provide the enriched content. Regards, Gert Vanthienen ------------------------ Open Source SOA: http://fusesource.com Blog: http://gertvanthienen.blogspot.com/ 2009/2/6 vasumathi <[email protected]>: > > Hi Gert Vanthienen, > > As you advised, I have changed the DEBUG logging of the container. Please > find the console log. The control passes MyBean successfully but erroring > out in EIP component. > > It leads to another doubt. When the control reaches MyBean(SU), the exchange > pattern is Inout but in router it is InOnly. I have coded the default > message pattern as In-Only only. > > Please clarify the same and let me know if you have any clue to solve the > issue. > > Thanks > Vasumathi > > > DEBUG - MyBean - ## Received exchange with status > ACTIVE > : InOut[ > id: ID:10.102.11.29-11f4a35617b-7:4 > status: Active > role: provider > service: {http://test}MyS1PojoService > endpoint: myS1PojoSu > in: <?xml version="1.0" encoding="UTF-8"?><input2>Tesing Content Based > Rounter > 2222</input2> > ] > DEBUG - MyBean - ## In Message: <?xml version="1.0" > enco > ding="UTF-8"?><input2>Tesing Content Based Rounter 2222</input2> > input<?xml version="1.0" encoding="UTF-8"?><input2>Tesing Content Based > Rounter > 2222</input2> > coreMessage from Service1<input2>Tesing Content Based Rounter 2222</input2> > DEBUG - MyBean - ## Out Message: > <response1><input2>Tesi > ng Content Based Rounter 2222</input2></response1> > 11111111 > ## Out Message: <response1><input2>Tesing Content Based Rounter > 2222</input2></r > esponse1> > after processXml11111<response1><input2>Tesing Content Based Rounter > 2222</input > 2></response1> > set contentStringSource[<response1><input2>Tesing Content Based Rounter > 2222</in > put2></response1>] > before sending > after sending > [Fatal Error] :-1:-1: Premature end of file. > [Fatal Error] :-1:-1: Premature end of file. > ERROR - EIPComponent - Error processing exchange InOnly[ > id: ID:10.102.11.29-11f4a35617b-11:4 > status: Active > role: provider > service: {http://test}MyStaticRoutingSlip1Service > endpoint: myStaticRoutingSlip1Su > operation: {http://test}onMessageExchange > in: Unable to display: org.xml.sax.SAXParseException: Premature end of > file. > ] > org.xml.sax.SAXParseException: Premature end of file. > at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) > at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) > at > org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStrea > m(SourceTransformer.java:268) > at > org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(SourceTr > ansformer.java:175) > at > org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(SourceTran > sformer.java:311) > at > org.apache.servicemix.eip.patterns.ContentEnricher.getDOMNode(Content > Enricher.java:247) > at > org.apache.servicemix.eip.patterns.ContentEnricher.combineToDOMDocume > nt(ContentEnricher.java:213) > at > org.apache.servicemix.eip.patterns.ContentEnricher.process(ContentEnr > icher.java:168) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLi > feCycle.java:540) > at > org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(Async > BaseLifeCycle.java:492) > at > org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLife > Cycle.java:46) > at > org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBoun > d(DeliveryChannelImpl.java:610) > at > org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlo > w.java:172) > at > org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.j > ava:167) > at > org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.jav > a:134) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec > utor.java:650) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor > .java:675) > at java.lang.Thread.run(Thread.java:595) > > > > > Gert Vanthienen wrote: >> >> Vasumathi, >> >> Could you try enabling DEBUG logging for the container itself as >> explained in >> http://servicemix.apache.org/how-do-i-change-the-logging.html? >> >> Regards, >> >> Gert Vanthienen >> ------------------------ >> Open Source SOA: http://fusesource.com >> Blog: http://gertvanthienen.blogspot.com/ >> >> >> >> 2009/2/5 Vasumathi, Rajamarthandan >> <[email protected]>: >>> Hi Gert Vanthienen >>> >>> Thanks for your reply. I had debug statements, just removed them before >>> submitting the code to forum. Please find the bean method with debug >>> statements and the console displaying/printing the statement values. >>> >>> It is executing onMessageExchange successfully while the control >>> returning back from onMessageExchange method to router the router occurs >>> (I guess). >>> >>> Please help me to solve this issue. I am struggling for the past four >>> days with the same issue. >>> >>> Bean method >>> ----------- >>> >>> public void onMessageExchange(MessageExchange exchange) >>> throws MessagingException { >>> >>> if (exchange.getStatus() == ExchangeStatus.ACTIVE) { >>> NormalizedMessage normalizedMessage =null; >>> NormalizedMessage normalizedMessageOut=null; >>> normalizedMessage = exchange.getMessage("in"); >>> normalizedMessageOut= exchange.createMessage(); >>> String outMessage = >>> processXml(normalizedMessage); >>> System.out.println("after processXml11111" + >>> outMessage); >>> normalizedMessageOut.setContent(new >>> StringSource(outMessage)); >>> System.out.println("set >>> content"+normalizedMessageOut.getContent().toString()); >>> exchange.setMessage(normalizedMessageOut, >>> "out"); >>> exchange.setStatus(ExchangeStatus.ACTIVE); >>> System.out.println("before sending"); >>> channel.send(exchange); >>> System.out.println("after sending"); >>> } >>> } >>> private String processXml(NormalizedMessage normalizedMessage) >>> throws MessagingException { >>> SourceTransformer sourceTransformer = new SourceTransformer(); >>> String inMessage = ""; >>> try { >>> inMessage = sourceTransformer.contentToString(normalizedMessage); >>> } catch (Exception e) { >>> throw new MessagingException(e); >>> } >>> System.out.println("input"+inMessage); >>> System.out.println("coreMessage from Service1"+coreMessage); >>> String outMessage ="<response1>" + coreMessage + "</response1>"; >>> System.out.println("11111111"); >>> System.out.println("## Out Message: " + outMessage); >>> return outMessage; >>> } >>> } >>> >>> Server console output >>> --------------------- >>> >>> input<?xml version="1.0" encoding="UTF-8"?><input2>Tesing Content Based >>> Rounter >>> 2222</input2> >>> coreMessage from Service1<input2>Tesing Content Based Rounter >>> 2222</input2> >>> 11111111 >>> ## Out Message: <response1><input2>Tesing Content Based Rounter >>> 2222</input2></r >>> esponse1> >>> after processXml11111<response1><input2>Tesing Content Based Rounter >>> 2222</input >>> 2></response1> >>> set contentStringSource[<response1><input2>Tesing Content Based Rounter >>> 2222</in >>> put2></response1>] >>> before sending >>> after sending >>> [Fatal Error] :-1:-1: Premature end of file. >>> [Fatal Error] :-1:-1: Premature end of file. >>> ERROR - EIPComponent - Error processing exchange >>> InOnly[ >>> id: ID:10.102.11.29-11f46231bc3-11:2 >>> status: Active >>> role: provider >>> service: {http://test}MyStaticRoutingSlip1Service >>> endpoint: myStaticRoutingSlip1Su >>> operation: {http://test}onMessage >>> in: Unable to display: org.xml.sax.SAXParseException: Premature end of >>> file. >>> ] >>> org.xml.sax.SAXParseException: Premature end of file. >>> >>> Please help me to solve this issue. I am struggling for the past four >>> days with the same issue. >>> >>> Thanks >>> Vasumathi >>> >>> >>> -----Original Message----- >>> From: Gert Vanthienen [mailto:[email protected]] >>> Sent: Thursday, February 05, 2009 7:46 AM >>> To: [email protected] >>> Subject: Re: Unable to display: org.xml.sax.SAXParseException: Premature >>> end of file >>> >>> Vasumathi, >>> >>> This is probably caused by something consuming a StreamSource or >>> StaxSource before your service touches it. To make sure that this is >>> the cause, could you try enabling DEBUG logging because this should >>> 'solve' the issue then? >>> >>> Once we are sure that this is the cause of the problem, we should try to >>> modify the bean method so that it converts the source into a re-readable >>> source type before actually processing it. Our MessageUtil class has a >>> method named enableContentRereadability() that was created exactly for >>> this purpose. >>> >>> Regards, >>> >>> Gert Vanthienen >>> ------------------------ >>> Open Source SOA: http://fusesource.com >>> Blog: http://gertvanthienen.blogspot.com/ >>> >>> >>> >>> 2009/2/5 Vasumathi, Rajamarthandan >>> <[email protected]>: >>>> Hi All, >>>> >>>> I am new to service Mix and JBI. I am getting the below error while >>>> executing a content enricher EIP. The service Mix version I am using >>>> is 3.3.1.3. I am using In-Only exchange pattern. >>>> >>>> Overall flow goes like this >>>> >>>> JMS BC -> Content Enricher EIP -> Service Unit(Temporarily using a >>>> Single Service Unit) >>>> >>>> Error I am facing >>>> >>>> [Fatal Error] :-1:-1: Premature end of file. >>>> [Fatal Error] :-1:-1: Premature end of file. >>>> ERROR - EIPComponent - Error processing exchange >>>> InOnly[ >>>> id: ID:10.102.11.29-11f46231bc3-11:0 >>>> status: Active >>>> role: provider >>>> service: {http://test}MyStaticRoutingSlip1Service >>>> endpoint: myStaticRoutingSlip1Su >>>> operation: {http://test}onMessage >>>> in: Unable to display: org.xml.sax.SAXParseException: Premature end >>>> of file ] >>>> org.xml.sax.SAXParseException: Premature end of file. >>>> >>>> Please find the code >>>> >>>> JMS BC >>>> ------- >>>> >>>> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0" >>>> xmlns:test="http://test" xmlns:amq="http://activemq.org/config/1.0"> >>>> <jms:endpoint service="test:MyJmsQueueTest" endpoint="jmsQueue" >>>> targetService="test:MyStaticRoutingSlip1Service" >>>> targetEndpoint="myStaticRoutingSlip1Su" >>>> role="consumer" destinationStyle="queue" >>>> jmsProviderDestinationName="myJmsQueueTest" >>>> defaultMep="http://www.w3.org/2004/08/wsdl/in-only" >>>> defaultOperation="test:onMessage" >>>> connectionFactory="#connectionFactory"> >>>> </jms:endpoint> >>>> <amq:connectionFactory id="connectionFactory" >>>> brokerURL="tcp://localhost:61616" /> >>>> </beans> >>>> >>>> Cotent Enricher EIP >>>> ------------------- >>>> <beans xmlns:eip="http://servicemix.apache.org/eip/1.0" >>>> xmlns:test="http://test"> >>>> <eip:content-enricher service="test:MyStaticRoutingSlip1Service" >>>> endpoint="myStaticRoutingSlip1Su"> >>>> <eip:enricherTarget> >>>> <eip:exchange-target service="test:MyS1PojoService"/> >>>> </eip:enricherTarget> >>>> >>>> </eip:content-enricher> >>>> </beans> >>>> >>>> Service Unit - Pojo code >>>> -------------------------- >>>> >>>> public void onMessageExchange(MessageExchange exchange) { if >>>> (exchange.getStatus() == ExchangeStatus.ACTIVE) { >>>> >>>> NormalizedMessage normalizedMessage =null; >>>> NormalizedMessage normalizedMessageOut=null; >>>> normalizedMessage = exchange.getMessage("in"); >>>> normalizedMessageOut= exchange.createMessage(); >>>> String outMessage = processXml(normalizedMessage); >>>> normalizedMessageOut.setContent(new StringSource(outMessage)); >>>> exchange.setMessage(normalizedMessageOut, "out"); >>>> exchange.setStatus(ExchangeStatus.ACTIVE); >>>> channel.send(exchange); >>>> >>>> } >>>> } >>>> >>>> I am struggling for the past four days with this issue. Please help me >>> >>>> to solve the issue. >>>> >>>> Thanks >>>> Vasumathi >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >> >> >> ----- >> --- >> Gert Vanthienen >> http://gertvanthienen.blogspot.com >> > > -- > View this message in context: > http://www.nabble.com/in%3A-Unable-to-display%3A-org.xml.sax.SAXParseException%3A-Premature-end-of-file-tp21850744p21867376.html > Sent from the ServiceMix - User mailing list archive at Nabble.com. > >
