JAX-WS: Streaming attachments using MTOM - Websphere

This is a discussion on JAX-WS: Streaming attachments using MTOM - Websphere ; Hello, I'm trying to implement a web service and client for efficient data exchange. The scenario is: my ws-client calls an operation on my web service. The service receives the request and sends a response with a (large) binary payload ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: JAX-WS: Streaming attachments using MTOM

  1. JAX-WS: Streaming attachments using MTOM

    Hello,

    I'm trying to implement a web service and client for efficient data exchange.

    The scenario is: my ws-client calls an operation on my web service. The service receives the request and sends a response with a (large) binary payload back to the client.
    Both service and client have MTOM and HTTP chunking enabled.

    When the client receives the response, it buffers the entire attachment to the file system. To increase performance I'd like to disable buffering and instead work with the attachment stream directly.

    I've read about a @StreamingAttachment annotation and StreamingDataHandler to enable streaming on the glassfish metro stack. Is there anything corresponding for IBM's implementation?


    WebSphere Application Server 7.0.0.1

    IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260-20081105
    _25433 (JIT enabled, AOT enabled)
    J9VM - 20081105_025433_lHdSMr
    JIT - r9_20081031_1330
    GC - 20081027_AB)
    JCL - 20081106_01

  2. Re: JAX-WS: Streaming attachments using MTOM

    Andreas,

    You can use MTOMFeature to control at which threshold the system creates file attachment on disk.

    http://publib.boulder.ibm.com/infoce...nablemtom.html

    http://java.sun.com/javase/6/docs/ap...OMFeature.html

    Can you please try bumping that up that threshold and see if that's enough for your scenario?

    thanks,
    dims

  3. Re: JAX-WS: Streaming attachments using MTOM

    Hi dims,

    thanks for your reply.

    When I bump the threshold up, the entire response message will be kept in memory, which really is better than writing it to the file system.

    This solution still has some drawbacks:
    1. The ws-client has to wait until the entire message has been received before it can pass on the received data.
    2. The larger the payload is, the more memory is needed.
    3. Payload size increases due to the need of base64 encoding

    Is there a way to disable buffering?
    Or buffer chunks instead of the +entire+ message?

    thanks and regards,
    Andreas

  4. Re: JAX-WS: Streaming attachments using MTOM

    Andreas - You could try attaching an HTTPTransport Policy to you application and trying to turn on chunking.

    So here are few things I know about chunking in WAS
    1) By default if payload is greater than threshold chunking is turned on in WAS. You can attach HTTP Transport policy to turn it off.
    2) For Payload smaller than 100K buffering is turned on for performance reasons.
    3) If you increase the threshold beyond the default (100K I believe) you are buffering by default. So trying to turn on chunking by attaching policy and that might enable chunking and help out.

    -Nikhil.

  5. Re: JAX-WS: Streaming attachments using MTOM

    Hi Nikhil

    Thanks for your suggestion. HTTP chunking is already turned on for both directions. The problem is that the client endpoint buffers/reassembles +all+ chunks of the message before I can access the payload. Is there a way to change that behavior?

    Further suggestions welcome!

    Thanks and regards
    Andreas

  6. Re: JAX-WS: Streaming attachments using MTOM

    I am sure you can code something that goes away from buffering modal to a streaming modal i.e fetch the inputStream for the chunked data and write that to an output stream. I dont see anything standard out of the box solution for this you will have derive some streaming modal. I think....

    -Nikhil.

  7. Re: JAX-WS: Streaming attachments using MTOM

    Ok, thank you!

    Andreas

+ Reply to Thread