JAX-WS SoapHandler with large messages: OutOfMemoryError

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

JAX-WS SoapHandler with large messages: OutOfMemoryError

Using JAX-WS 2, I see an issue that others have spoken about as well. The
issue is that if a SOAP message is received inside a handler, and that SOAP
message is large - whether due to inline SOAP body elements that happen to
have lots of content, or due to MTOM attachments - then it is dangerously
easy to get an OutOfMemoryError. The reason is that the call to getMessage()
seems to set off a chain of events that involve reading the entire SOAP
message on the wire, and creating an object (or objects) representing what
was on the wire. For example: ... public boolean
handleMessage(SOAPMessageContext context) { // for a large message, this will
cause an OutOfMemoryError System.out.println(
context.getMessage().countAttachments() ); ... My question is: is there a
known mechanism/workaround for dealing with this? Specifically, it would be
nice to access the SOAP part in a SOAP message without forcing the
attachments (if MTOM for example) to also be vacuumed up.


[Message sent by forum member 'bland999']

View Post: http://forums.java.net/node/895732