Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in client when sending a message clear text messagse #45

Closed
zharpaz-bmc-com opened this issue Jul 25, 2018 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@zharpaz-bmc-com
Copy link
Contributor

Hi Philip,
When sending a message with no encryption, signature, or compression, the call
aSecuredMimePart.getInputStream() (AS2SenderModule:682) fails with Exception javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/xml.
Thanks, Ziv

@phax phax self-assigned this Jul 25, 2018
@phax
Copy link
Owner

phax commented Jul 25, 2018

I tried to reproduce that but failed. I was sending an unsigned, unencrypted, non-compressed messages without an issue. Do you have any additional libraries in your jre/ext folder?

@zharpaz-bmc-com
Copy link
Contributor Author

It works OK when the data is set with
aRequest.setData ("toSend", Charset.defaultCharset());
if fails with
aRequest.setData (new File("file.txt"));

@phax
Copy link
Owner

phax commented Aug 7, 2018

I see. When no Charset is provided, the following exception occurs:

1342 [main] INFO com.helger.as2lib.exception.OpenAS2Exception - OpenAS2 WrappedOpenAS2Exception terminated: java.io.IOException: "text/plain" DataContentHandler requires String object, was given object of type class [B; sources: {message=[AS2Message@0x2630dbc4: data=javax.mail.internet.MimeBodyPart@5ea4300e; MDN=null]}
java.io.IOException: "text/plain" DataContentHandler requires String object, was given object of type class [B
	at com.sun.mail.handlers.text_plain.writeTo(text_plain.java:133)
	at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:889)
	at javax.activation.DataHandler.writeTo(DataHandler.java:317)
	at com.helger.as2lib.crypto.BCCryptoHelper.calculateMIC(BCCryptoHelper.java:321)
	at com.helger.as2lib.processor.sender.AS2SenderModule.calculateAndStoreMIC(AS2SenderModule.java:272)
	at com.helger.as2lib.processor.sender.AS2SenderModule.handle(AS2SenderModule.java:815)
	at com.helger.as2lib.client.AS2Client.sendSynchronous(AS2Client.java:402)
	at com.helger.as2lib.supplementary.main.MainIssue45.main(MainIssue45.java:116)

When instead calling

aRequest.setData (new File ("file.txt"), Charset.defaultCharset ());

it works for me.

That means: we could use that Charset by default if none is provided to work around that error?

phax added a commit that referenced this issue Aug 7, 2018
@zharpaz-bmc-com
Copy link
Contributor Author

I wasn't aware of it. Yes, thanks.

phax added a commit that referenced this issue Aug 8, 2018
`AS2ClientRequest.setData (File, Charset)`; #45
@phax phax added this to the 4.2.0 milestone Aug 8, 2018
@phax
Copy link
Owner

phax commented Aug 8, 2018

The respective method without Charset got deprecated.

@phax phax closed this as completed Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants