FULL PRODUCT VERSION :
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 2008 64Bit, Windows XP 64-Bit
A DESCRIPTION OF THE PROBLEM :
The DataHandler doesnt pay attention to the character-set after you publish a webservice via Endpoint.publish(..., ...).
The encoding is regarded when you dont publish a webservice.
I used a MimeBodyPart for testing but i could track the problem to the JDK-classes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please use the attached source-code. In order to compile you need mail.jar but the bug seems not to be related to this package.
run the code and take a look at system.out.
The umlauts are encoded in the same way in both lines despite different parameters for the encodign (utf-8 and iso-8859-1).
Uncomment the line with Endpoint.publish(..) and the line are encoded differently as they should be.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The encoding should be regarded. The umlauts should be encoded like:
=F6=E4=FCtest231
=C3=B6=C3=A4=C3=BCtest231
ACTUAL -
With the probided example the output looks like this:
@WebService(targetNamespace="http://www.mycompany.com/customerrelations", name="TestService")
public class enctest
{
public static void main(String[] args) throws Exception
{
enctest impl = new enctest();
Endpoint end = null;
//comment and uncomment the following line to see the difference
end = Endpoint.publish("http://localhost:81/Webservice", impl);
Previously tracked via: https://bugs.openjdk.java.net/browse/JDK-7029376
FULL PRODUCT VERSION : java version "1.6.0_24" Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION : Windows 2008 64Bit, Windows XP 64-Bit
A DESCRIPTION OF THE PROBLEM : The DataHandler doesnt pay attention to the character-set after you publish a webservice via Endpoint.publish(..., ...).
The encoding is regarded when you dont publish a webservice.
I used a MimeBodyPart for testing but i could track the problem to the JDK-classes.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Please use the attached source-code. In order to compile you need mail.jar but the bug seems not to be related to this package. run the code and take a look at system.out. The umlauts are encoded in the same way in both lines despite different parameters for the encodign (utf-8 and iso-8859-1). Uncomment the line with Endpoint.publish(..) and the line are encoded differently as they should be.
EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The encoding should be regarded. The umlauts should be encoded like:
=F6=E4=FCtest231 =C3=B6=C3=A4=C3=BCtest231 ACTUAL - With the probided example the output looks like this:
=C3=B6=C3=A4=C3=BCtest231 =C3=B6=C3=A4=C3=BCtest231
or
=F6=E4=FCtest231 =F6=E4=FCtest231
depending on the file.encoding environment variable.
REPRODUCIBILITY : This bug can be reproduced always.
---------- BEGIN SOURCE ---------- import java.io.OutputStream;
import javax.activation.DataHandler; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeUtility; import javax.xml.ws.Endpoint; import javax.jws.WebService;
@WebService(targetNamespace="http://www.mycompany.com/customerrelations", name="TestService") public class enctest { public static void main(String[] args) throws Exception { enctest impl = new enctest(); Endpoint end = null; //comment and uncomment the following line to see the difference end = Endpoint.publish("http://localhost:81/Webservice", impl);
}
---------- END SOURCE ----------