I try to be precise and brief but all the config excerpts and
stacktraces will make this post long, sorry.
We developed a service (using CXF and Spring) that accepts images
through MTOM. I'm pretty sure CXF/MTOM is configured correctly. Still, a
50MB JPEG sent over the wire results in ~1.5GB in the heap. Something
seems amiss but I don't understand why/what...
I see that in $java.io.tmpdir/cxf-tmp-nnnnn the MTOM attachment is
dumped. I see in the stacktrace that MTOM is used because the
MTOMDecorator class shows up. I see in the inbound message (CXF
interceptor) a MIME message with an attachment.
If the heap is too small (e.g. 800MB) the java.lang.OutOfMemoryError
occur in different places depending on available heap obviously. Examples:
- Base64 decoding (stacktrace n/a anymore)
- Arrays.copyOf
- java.awt.image.DataBufferByte.<init>
-> http://pastebin.com/UjfRU9DN
[WSDL/XSD]
<xs:complexType name="attachment" abstract="true">
<xs:sequence>
<xs:element name="name" type="me:string255"/>
<xs:element name="mimeType" type="me:string255"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="imageAttachment">
<xs:complexContent>
<xs:extension base="me:attachment">
<xs:sequence>
<xs:element name="content" type="xs:base64Binary"
xmime:expectedContentTypes="image/jpeg, image/png, image/gif"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
[Spring config]
<jaxws:endpoint
id="publicAPI"
implementor="#publicAPIEndpoint"
address="/publicAPI"
wsdlLocation="my.wsdl"
serviceName="myns:myservice"
xmlns:myns="some-url">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
<!-- doesn't seem to make any difference -->
<!-- <entry key="mtom-enabled" value="true"/> -->
</jaxws:properties>
</jaxws:endpoint>
[Inbound message excerpt]
Address: http://nb0131:8080/ws/publicAPI?runAs=zhapi
Encoding: UTF-8
Http-Method: POST
Content-Type: multipart/related; type="application/xop+xml";
start="<[email protected]>"; start-info="text/xml";
boundary="----=_Part_8_716120932.1348085609456"
Headers: {accept-encoding=[gzip,deflate], connection=[close],
Content-Length=[48725432], content-type=[multipart/related;
type="application/xop+xml"; start="<[email protected]>";
start-info="text/xml"; boundary="----=_Part_8_716120932.1348085609456"],
cookie=[JSESSIONID=E77F8B9C0B753BEE09F62D0EC9C4DFF3],
cookie2=[$Version=1], host=[nb0131:8080], mime-version=[1.0],
SOAPAction=[""], user-agent=[Apache-HttpClient/4.1.1 (java 1.5)]}
Messages:
Message (saved to tmp file):
Filename:
C:\Users\mstoer\AppData\Local\Temp\cxf-tmp-357825\cos3686535214659827149tmp
(message truncated to 65536 bytes)
Payload:
------=_Part_8_716120932.1348085609456
...
Cheers,
Marcel
--
Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org