Discussion:
SOAP with attachments and chunked transfer-encoding
Thorsten Schöning
2018-09-23 18:20:08 UTC
Permalink
Hi all,

I need to send SOAP messages using large binary data, hundreds of MB,
and I don't want Axis2 to read them entirely into memory AND would
like to avoid that Axis2 creates temp files for large HTTP requests as
well. Because of the large files, I'm using SOAP with attachments to
not need to encode using Base64.

Am I correct that I simply need to enable chunked encoding?

Without chunked encoding I could see that my data was entirely read
into memory before sending anything to get content length and such.
That resulted in a byte[] later used to send the request body over the
wire.

With chunked encoding enabled, that byte[] was not created and instead
the OutputStream for sending over the wire wrapped into some
chunking-thing and forwarded to SOAPMessageFormatter. That read my
SwA-attachments and wrote them to the wrapped OutputStream, actually
sending data directly over the wire.

Thanks for clearing things up!

Mit freundlichen Grüßen,

Thorsten Schöning
--
Thorsten Schöning E-Mail: ***@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/

Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-***@axis.apache.org
For additional commands, e-mail: java-user-***@axis.apache.org
Thorsten Schöning
2018-09-23 18:23:31 UTC
Permalink
Guten Tag Thorsten Schöning,
Post by Thorsten Schöning
With chunked encoding enabled, that byte[] was not created and instead
the OutputStream for sending over the wire wrapped into some
chunking-thing and forwarded to SOAPMessageFormatter. That read my
SwA-attachments and wrote them to the wrapped OutputStream, actually
sending data directly over the wire.
if (chunked) {
messageFormatter.writeTo(messageContext, format, outStream, isAllowedRetry);
} else {
if (bytes == null) {
bytes = messageFormatter.getBytes(messageContext, format);
}
outStream.write(bytes);
}
https://github.com/wso2/wso2-axis2/blob/master/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java#L84
Post by Thorsten Schöning
Attachments attachments = msgCtxt.getAttachmentMap();
for (String contentID : attachments.getAllContentIDs()) {
if (!contentID.equalsIgnoreCase(attachments.getSOAPPartContentID())) {
attachmentsWriter.writePart(attachments.getDataHandler(contentID), contentID);
}
}
https://github.com/wso2/wso2-axis2/blob/master/modules/kernel/src/org/apache/axis2/transport/http/SOAPMessageFormatter.java#L235

Mit freundlichen Grüßen,

Thorsten Schöning
--
Thorsten Schöning E-Mail: ***@AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/

Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-***@axis.apache.org
For additional commands, e-mail: java-user-***@axis.apache.org
Loading...