users@saaj.java.net

Re: [SAAJ-USR] SAAJ and UTF-8 BOMs

From: V B Kumar Jayanti <Vbkumar.Jayanti_at_Sun.COM>
Date: Thu, 17 Jul 2008 12:41:16 +0530

Arjen Poutsma wrote:

> Hi,
>
> I have noticed that the SAAJ RI doesn't cope with UTF-8 BOMs.
> According to http://unicode.org/faq/utf_bom.html#22, an UTF-8 file
> can have an optional EF BB BF byte order mark at the beginning of
> the file. When such a file is passed to the SAAJ MessageFactory, the
> following exception occurs:
>
Yes this is a know Issue in SAAJ and has been on the TODO list for some
time. I shall take this up on priority and fix this. Thanks for reporting.

regards,
kumar

> com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: XML
> declaration parsing failed
> at com .sun .xml .internal
> .messaging.saaj.soap.SOAPPartImpl.lookForXmlDecl(SOAPPartImpl.java:644)
> at com .sun .xml .internal .messaging .saaj .soap
> .ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(SOAPPart1_1Impl.java:
> 68)
> at com .sun .xml .internal
> .messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:125)
> at org .springframework .ws
> .soap.saaj.Saaj13Implementation.getEnvelope(Saaj13Implementation.java:
> 169)
> at org .springframework
> .ws.soap.saaj.SaajSoapMessage.getEnvelope(SaajSoapMessage.java:87)
> ... 20 more
> Caused by: java.io.IOException: Unexpected characters before XML
> declaration
> at com .sun .xml .internal .messaging
> .saaj.util.XMLDeclarationParser.parse(XMLDeclarationParser.java:121)
> at com .sun .xml .internal
> .messaging.saaj.soap.SOAPPartImpl.lookForXmlDecl(SOAPPartImpl.java:639)
> ... 24 more
>
> I can work around this issue by creating a PushbackInputStream which
> chops of the BOM, but it would be nice to have this issue resolved in
> the codebase. Or perhaps I am doing something wrong entirely :).
>
> I have attached a sample SOAP message which has an UTF-8 BOM.
>
>------------------------------------------------------------------------
>
><?xml version="1.0" encoding="UTF-8"?>
>
><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
>
> <SOAP-ENV:Body>
>
> <m:GetLastTradePrice xmlns:m='http://www.springframework.org/spring-ws'>
>
> <symbol>DIS</symbol>
>
> </m:GetLastTradePrice>
>
> </SOAP-ENV:Body>
>
></SOAP-ENV:Envelope>
>
>
> ------------------------------------------------------------------------
>
>
>
>
> Best regards,
>
> Arjen
>
>
> ---
> Arjen Poutsma
> Senior Software Engineer, SpringSource
> Spring Web Services Lead
> E: arjen.poutsma_at_springsource.com
> W: www.springsource.com
> B: blog.springsource.com/arjen
>
>
>
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_saaj.dev.java.net
>For additional commands, e-mail: users-help_at_saaj.dev.java.net
>
>