Skip to content

Commit 805eb02

Browse files
committed
Changed charset representation
1 parent 659e2ca commit 805eb02

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ph-as4-lib/src/main/java/com/helger/as4/messaging/mime/MimeMessageCreator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static MimeMessage generateMimeMessage (@Nonnull final ESOAPVersion eSOAP
9696
ValueEnforcer.notNull (aSOAPEnvelope, "SOAPEnvelope");
9797

9898
final Charset aCharset = AS4XMLHelper.XWS.getCharset ();
99-
final SoapMimeMultipart aMimeMultipart = new SoapMimeMultipart (eSOAPVersion);
99+
final SoapMimeMultipart aMimeMultipart = new SoapMimeMultipart (eSOAPVersion, aCharset);
100100
final EContentTransferEncoding eCTE = EContentTransferEncoding.BINARY;
101101
final String sContentType = eSOAPVersion.getMimeType (aCharset).getAsString ();
102102

ph-as4-lib/src/main/java/com/helger/as4/messaging/mime/SoapMimeMultipart.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
package com.helger.as4.messaging.mime;
1818

19+
import java.nio.charset.Charset;
20+
1921
import javax.annotation.Nonnull;
2022
import javax.mail.internet.ContentType;
2123
import javax.mail.internet.MimeMultipart;
@@ -31,15 +33,16 @@
3133
*/
3234
public class SoapMimeMultipart extends MimeMultipart
3335
{
34-
public SoapMimeMultipart (@Nonnull final ESOAPVersion eSOAPVersion) throws ParseException
36+
public SoapMimeMultipart (@Nonnull final ESOAPVersion eSOAPVersion,
37+
@Nonnull final Charset aCharset) throws ParseException
3538
{
3639
super ("related");
3740

3841
// type parameter is essential for Axis to work!
39-
// But only without the charset! Otherwise Holodeck complains that the
40-
// receiver is unknown. Somewhat a bug in Axis according to Sander
41-
final ContentType cType = new ContentType (contentType);
42-
cType.setParameter ("type", eSOAPVersion.getMimeType ().getAsString ());
43-
contentType = cType.toString ();
42+
// But no charset! RFC 2387, section 3.4 has a special definition
43+
final ContentType aContentType = new ContentType (contentType);
44+
aContentType.setParameter ("type", eSOAPVersion.getMimeType ().getAsString ());
45+
aContentType.setParameter ("charset", aCharset.name ());
46+
contentType = aContentType.toString ();
4447
}
4548
}

0 commit comments

Comments
 (0)