-
Bug
-
Resolution: Obsolete
-
Major
-
jbossws-native-3.4.1
-
None
When deploying a webservice implemented using javax.jws and JAXB annotations, a WSDL is generated. In this process, a temporary XML schema file is generated and written to the tmp directory by the WSDL11Reader.processSchemaInclude method. It uses a DOMWriter in lines 640-646 to actually write the file via a FileWriter. This leads to the schema being written with the system-default character set, without an XML declaration. For non-ASCII characters, this might in turn lead to org.apache.xerces.xni.XNIException being thrown by the xerces parser when the file is read again by the JavaToXSD.parseSchema (line 181) method.
For example, part of my I have an @XmlEnum with a value "località", specified by @XmlEnumValue("localit\u00e0"), which causes this problem. The exception message in this case is
"Parser should stop: JBossWS_(...)18444939893360070.xsd[domain:http://www.w3.org/TR/1998/REC-xml-19980210]::[key=InvalidByte]::Message=Invalid byte 2 of 3-byte UTF-8 sequence."
Java char supports UTF-16 characters with the "\u" escape sequences. The DOMWriter has another constructor DOMWriter(OutputStream stream, String charsetName) which also causes an XML declaration to be written. Its usage in WSDL11Reader with "UTF-16" as second parameter would thus avoid the described problem.