Ok, I've traced the problems for my test case and found out that there are several problems that makes smx to work with only UTF-8 xml. I've also found out that there are problems with libraries that smx uses (woodstox for instance).
The problems I've found within smx are these (all related to smx 3.0.1): org.apache.servicemix.jbi.jasp.SourceTransformer (servicemix-core): 1. UTF-8 is hard coded as the default (and only) encoding, which is used in the toDOMSourceFromStream(StreamSource) method. Not sure the reason for this, because it works for me (in the ISO-8859-1 case) when just removing the setting of this encoding on the InputStream. 2. In the toResult(Source, Result) I need to set the output encoding on the transformer. Possibly this is an Xalan bug, as the encoding is correct in the Source. However, setting the encoding as an output property on the transformer before the transformation fixes this. org.apache.servicemix.soap.marshalers.SoapWriter (sevicemix-soap): 1. In method writeSimpleMessage(OutputStream), when creating the XmlStreamWriter the encoding needs to be passed along. Otherwise the output will be in the wrong encoding. Also, a bug in woodstox 3.0.2 duplicates some characters. This is a known bug, which has been fixed in the woodstox trunk. I've filed a jira to included an updated version when that comes out. I'll file jiras for the servicemix specific problems. I also need to check that this actual does make it work for my real scenario and not just the test case. :-) Anders Hammar wrote: > > Guillaume, > > Attached is a simple test case that sends an ISO-8859-1 encoded xml string > from a JMS provider to a JMS consumer. In my environment, the message is > converted to UTF-8. However, the problem encounted here is probably not > the same as the one we have in our real scenario where we encounter the > problem on the consumer side. In the test case, I've managed to track the > problem to the fromNMS(SoapMessage, TextMessage, MAP) method of the > AbstractJmsProcessor class (which is on the provider side). In this > method, the StringSource in the SoapMessage is ISO-8859-1 encoded, but the > outcome (the TextMessage) is UTF-8 encoded. > > I'm using smx 3.0.1. Just drop the attached test case among the ones in > the jms component and it should work (it uses the test config files of the > jms component). > > My thinking is that if we solve this we probably will be on a good way of > fixing my actual problem on the consumer side. > > Would really appreciate any help. It would also be great to hear if > someone has any other encoding but UTF-8 working (on the jms component or > any other component)! > /Anders > > http://www.nabble.com/file/4561/JmsISO88591Test.java JmsISO88591Test.java > > > gnodet wrote: >> >> Could you set up a simple junit test to reproduce the problem ? >> Also you may want to try to send a BytesMessage as I guess you >> send a TextMessage. If may be a workaround. >> >> On 12/6/06, Anders Hammar <[EMAIL PROTECTED]> wrote: >>> >>> I'm trying to post a ISO-8859-1 encoded xml message to a queue and read >>> that >>> with a jms BC. It works if the xml message is UTF-8 encoded, but >>> ISO-8859-1 >>> doesn't work. Do I need to do any specific configuration for this? (The >>> xml >>> message states that the encoding is ISO-8859-1.) >>> >>> I get these error messages: >>> >>> 429217 DEBUG - tandardConsumerProcessor - >>> .servicemix.jms.standard.StandardConsumerProcessor - Received jms >>> message >>> ActiveMQTextMessage {commandId = 6, responseRequired = false, messageId >>> = >>> ID:PC-614210-3920-1165333854368-1:17:1:1:1, originalDestination = null, >>> originalTransactionId = null, producerId = >>> ID:PC-614210-3920-1165333854368-1:17:1:1, destination = >>> queue://se.c.b.a.dummy, transactionId = >>> TX:ID:PC-614210-3920-1165333854368-1:17:1, expiration = 0, timestamp = >>> 1165397924547, arrival = 0, correlationId = null, replyTo = null, >>> persistent >>> = true, type = null, priority = 4, groupID = null, groupSequence = 0, >>> targetConsumerId = null, compressed = false, userID = null, content = >>> [EMAIL PROTECTED], marshalledProperties = >>> null, >>> dataStructure = null, redeliveryCounter = 0, size = 0, properties = >>> null, >>> readOnlyProperties = true, readOnlyBody = true, text = null} >>> 429217 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - SendSync >>> ID:PC-614210-2833-1165397495410-6:1 in DeliveryChannel{servicemix-jms} >>> [Fatal Error] :16:14: Invalid byte 2 of 3-byte UTF-8 sequence. >>> 429257 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Sent: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: consumer >>> service: {http://b.c.se/a}loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Invalid byte 2 >>> of >>> 3-byte UTF-8 sequence. >>> ] >>> [Fatal Error] :1:1: Content is not allowed in prolog. >>> 429267 DEBUG - DefaultBroker - >>> org.apache.servicemix.jbi.nmr.DefaultBroker - Routing exchange >>> InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Content is not >>> allowed in prolog. >>> ] to: ServiceEndpoint[service={http://b.c.se/a}loggare,endpoint=loggare] >>> [Fatal Error] :1:1: Content is not allowed in prolog. >>> 429277 DEBUG - DefaultBroker - >>> org.apache.servicemix.jbi.nmr.DefaultBroker - Routing exchange >>> InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Content is not >>> allowed in prolog. >>> ] to: ServiceEndpoint[service={http://b.c.se/a}loggare,endpoint=loggare] >>> 429287 DEBUG - SedaFlow - >>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow - Called Flow send >>> 429287 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Waiting for >>> exchange >>> ID:PC-614210-2833-1165397495410-6:1 (1e5a5dc) to be answered in >>> DeliveryChannel{servicemix-jms} from sendSync >>> [Fatal Error] :1:1: Content is not allowed in prolog. >>> 429287 DEBUG - SedaQueue - >>> rg.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1 - >>> [EMAIL PROTECTED] dequeued >>> exchange: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Content is not >>> allowed in prolog. >>> ] >>> [Fatal Error] :1:1: Content is not allowed in prolog. >>> 429307 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Processing inbound >>> exchange: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Content is not >>> allowed in prolog. >>> ] >>> [Fatal Error] :1:13: The markup in the document preceding the root >>> element >>> must be well-formed. >>> 429317 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Received: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: The markup in >>> the >>> document preceding the root element must be well-formed. >>> ] >>> [Fatal Error] :1:3: Invalid byte 2 of 4-byte UTF-8 sequence. >>> 429327 INFO - TraceComponent - >>> g.apache.servicemix.components.util.TraceComponent - Exchange: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Active >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Invalid byte 2 >>> of >>> 4-byte UTF-8 sequence. >>> ] received IN message: >>> [EMAIL PROTECTED]: >>> {}} >>> [Fatal Error] :-1:-1: Premature end of file. >>> 429367 ERROR - TraceComponent - >>> g.apache.servicemix.components.util.TraceComponent - Failed to turn >>> message >>> body into text: javax.xml.transform.TransformerException: >>> org.xml.sax.SAXParseException: Premature end of file. >>> javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: >>> Premature end of file. >>> at >>> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:501) >>> at >>> org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:88) >>> at >>> org.apache.servicemix.jbi.jaxp.SourceTransformer.toString(SourceTransformer.java:104) >>> at >>> org.apache.servicemix.components.util.TraceComponent.onMessageExchange(TraceComponent.java:66) >>> at >>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624) >>> at >>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170) >>> at >>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177) >>> at >>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227) >>> at >>> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291) >>> at >>> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown >>> Source) >>> at java.lang.Thread.run(Thread.java:595) >>> Caused by: org.xml.sax.SAXParseException: Premature end of file. >>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown >>> Source) >>> at >>> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484) >>> ... 10 more >>> --------- >>> org.xml.sax.SAXParseException: Premature end of file. >>> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown >>> Source) >>> at >>> org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484) >>> at >>> org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:88) >>> at >>> org.apache.servicemix.jbi.jaxp.SourceTransformer.toString(SourceTransformer.java:104) >>> at >>> org.apache.servicemix.components.util.TraceComponent.onMessageExchange(TraceComponent.java:66) >>> at >>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624) >>> at >>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170) >>> at >>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177) >>> at >>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227) >>> at >>> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291) >>> at >>> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown >>> Source) >>> at java.lang.Thread.run(Thread.java:595) >>> 429397 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Send >>> ID:PC-614210-2833-1165397495410-6:1 in DeliveryChannel{loggare} >>> [Fatal Error] :-1:-1: Premature end of file. >>> 429397 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Sent: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Done >>> role: provider >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Premature end of >>> file. >>> ] >>> 429407 DEBUG - SedaFlow - >>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow - Called Flow send >>> [Fatal Error] :-1:-1: Premature end of file. >>> 429427 DEBUG - SedaQueue - >>> rg.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1 - >>> [EMAIL PROTECTED] dequeued >>> exchange: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Done >>> role: consumer >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Premature end of >>> file. >>> ] >>> [Fatal Error] :-1:-1: Premature end of file. >>> 429437 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Processing inbound >>> exchange: InOnly[ >>> id: ID:PC-614210-2833-1165397495410-6:1 >>> status: Done >>> role: consumer >>> service: {http://b.c.se/a}loggare >>> endpoint: loggare >>> in: Unable to display: org.xml.sax.SAXParseException: Premature end of >>> file. >>> ] >>> 429437 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Notifying exchange >>> ID:PC-614210-2833-1165397495410-6:1(1e5a5dc) in >>> DeliveryChannel{servicemix-jms} from processInboundSynchronousExchange >>> 429437 DEBUG - DeliveryChannelImpl - >>> pache.servicemix.jbi.messaging.DeliveryChannelImpl - Notified: >>> ID:PC-614210-2833-1165397495410-6:1(1e5a5dc) in >>> DeliveryChannel{servicemix-jms} from sendSync >>> -- >>> View this message in context: >>> http://www.nabble.com/Problem-with-ISO-8859-1-encoding-and-jms-component-tf2767158s12049.html#a7716631 >>> Sent from the ServiceMix - User mailing list archive at Nabble.com. >>> >>> >> >> >> -- >> Cheers, >> Guillaume Nodet >> >> > > -- View this message in context: http://www.nabble.com/Problem-with-ISO-8859-1-encoding-and-jms-component-tf2767158s12049.html#a7891448 Sent from the ServiceMix - User mailing list archive at Nabble.com.
