Stream MTOM Web Services in Spring Web Services Framework

I want to send large files from server to client using MTOM and Spring WS. I understand that this is not the best approach for this type of thing, but it is a requirement. I have MTOM installed and it works great for small files about 50 MB in size. I have errors in memory for large files, and by changing various sizes of heap space, I can send slightly larger files, but nothing close to 1gb. 1GB is my test case. How can I transfer or transfer MTOM service from server to client? I am using Java 6 update 17, Tomcat 6 and Spring WS 1.5.7 with SaajSoapMessageFactory.

I found an example of streaming with jax-ws, but I'm not sure how to include it in the WS760 endpoint.

Optimize binary data transfer with MTOM / XOP

+4
source share
1 answer

Yesterday I had the same problem downloading large files. Finally, I was able to find a solution for this. Spring WS has a customized Axiom factory message called org.springframework.ws.soap.axiom.AxiomSoapMessageFactory , which can use the file instead of memory when loading large files. The only change in your configuration is to define a bean with your custom properties.

 <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"> <property name="payloadCaching" value="false" /> <property name="attachmentCaching" value="true" /> <property name="attachmentCacheThreshold" value="1024"/> </bean> 

Once you have this configuration and the Axiom classes available on the class path, Spring-ws automatically uses temporary files to copy large document loads.

+5
source

All Articles