You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2018/09/23 18:20:08 UTC

SOAP with attachments and chunked transfer-encoding

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: Thorsten.Schoening@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-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


Re: SOAP with attachments and chunked transfer-encoding

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Thorsten Schöning,
am Sonntag, 23. September 2018 um 20:20 schrieben Sie:

> 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.

Forgot to mention some code:

>             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

>            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: Thorsten.Schoening@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-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org