How to change the encoding of wsimport-generated files?
This is somewhat badly documented. WSImport uses XJC (from JAXB) to create Java files and the documentation here indicates that changing the character encoding in the XML file should suffice (although I have not tried this). If you are content with running JAXB by hand then you can also configure this via the JAXB_ENCODING property on your JAXBContext.
I post with my register account:
Set the environment variable JAVA_TOOL_OPTIONS
to -Dfile.encoding=UTF8
Example in windows:
set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
c:>wsimport -keep ... file.wsdl
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 parsing WSDL...
Generating code...
wsimport 2.2.9 in JDK 8 has the -encoding
option that can be used for this. For example:
wsimport -keep -s c:\path\to\src c:\wsdl\myService.wsdl -encoding cp1252
I can't find this option in either wsimport 2.1.6 (JDK 6) or 2.2.4-b01 (JDK 7).