Closed AlexandruCiobanu closed 4 years ago
Okay, so you found the setSignalMsgConsumer
method in the builder. This is clearly a bug...
In this case is there anythig I could do? Also any way to process the response message, meaning decrypt and verify the actual inside payload?
As a temporary fix I did the following:
@Nullable
public static Ebms3SignalMessage parseSignalMessage (@Nonnull @WillNotClose final AS4ResourceHelper aResHelper,
@Nonnull final byte [] aBytes) throws Phase4PeppolException
{
// Read response as XML
Document aSoapDoc = DOMReader.readXMLDOM (aBytes);
if (aSoapDoc == null || aSoapDoc.getDocumentElement () == null) {
Session newSession = Session.getDefaultInstance(new Properties());
InputStream inputStreamObj = new ByteArrayInputStream(aBytes);
try {
MimeMessage mimeMessageObj = new MimeMessage(newSession, inputStreamObj);
String contentType = mimeMessageObj.getContentType();
part = (String) mimeMessageObj.getContent();
part = part.replaceAll("\\<\\?xml(.+?)\\?\\>", "").trim();
part = part.substring(0, part.lastIndexOf('>')+1);
aSoapDoc = DOMReader.readXMLDOM (part);
if (aSoapDoc == null || aSoapDoc.getDocumentElement () == null) {
throw new Phase4PeppolException("Failed to parse as XML");
}
} catch (MessagingException e) {
throw new Phase4PeppolException("Failed to parse as XML", e);
} catch (IOException e) {
throw new Phase4PeppolException("Failed to parse as XML", e);
}
} else {
part = new String(aBytes);
}
....
Thanks for the taking the time to post this here. Let me see what I can do....
In the meantime I verified, that it is okay, to always use MIME encoding. I need to implement this accordingly
@AlexandruCiobanu do you have a test endpoint for me, where the SignalMessage comes as a MIME message? Thx
It should be fixed in the v0.9.7 release
I sent a message and got back a response like:
In log I see this error when processing the signal:
It seems we need some sort of mime handling in teh MDN?