Announcement Announcement Module
Collapse
No announcement yet.
WebServiceTemplate and attachments Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebServiceTemplate and attachments

    Hi,

    I am getting OutOfMemoryError when using WebServiceTemplate attachments.

    I am using AxiomSoapMessageFactory and the bean configuration is:

    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoap MessageFactory">
    <!-- <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory"> -->
    <description>A message factory to support SOAP 1.2</description>
    <property name="soapVersion">
    <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOA P_11" />
    </property>
    <property name="attachmentCaching" value="true"></property>
    <!-- <property name="attachmentCacheDir" value=""></property> -->
    </bean>

    On the server side, SaajSoapMessageFactory is streaming attachments to a tmp file as you would expect, but attachmentCaching=true is not working when used on the client side.

    BTW: I am not using MTOM - I do not have much control on the WSDL definition.

    Any idea?

    Code:
    java.lang.OutOfMemoryError: Java heap space
    	at java.util.Arrays.copyOf(Arrays.java:2786)
    	at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
    	at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:61)
    	at org.springframework.ws.transport.TransportOutputStream.write(TransportOutputStream.java:64)
    	at javax.activation.DataHandler.writeTo(DataHandler.java:294)
    	at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:452)
    	at org.apache.axiom.om.impl.MIMEOutputUtils.writeBodyPart(MIMEOutputUtils.java:216)
    	at org.apache.axiom.om.impl.MIMEOutputUtils.writeDataHandlerWithAttachmentsMessage(MIMEOutputUtils.java:312)
    	at org.apache.axiom.om.impl.MIMEOutputUtils.writeSOAPWithAttachmentsMessage(MIMEOutputUtils.java:259)
    	at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeSwAMessage(AxiomSoapMessage.java:328)
    	at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:278)
    	at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendRequest(WebServiceTemplate.java:622)
    	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:585)
    	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:537)
    	at learn.WebServiceTemplateTest.test(WebServiceTemplateTest.java:36)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
Working...
X