Spring ws payloadvalidatinginterceptor

There are several known issues related to MTOM (or more generally XOP) processing in Spring-WS.

This article identifies the common root cause of these issues and discusses a possible (long term) solution.

spring ws payloadvalidatinginterceptor-49

The problem with Spring-WS is that in contrast to SAAJ and Axiom, it doesn’t have a well defined MTOM processing model.

Namely, it is unspecified whether the object representing XOP decoded or encoded data.

This is not just a missing detail in the documentation; the problem is that this method is both implemented and used inconsistently in Spring-WS itself: In the previous section we have seen that the problems with MTOM processing in Spring-WS are caused by a flaw in the design of the Spring-WS API.

There is therefore no easy fix and a proper solution will require changes to the API.

Namely the method (or a new, overloaded version of that method) should have an argument that allows the caller to specify whether it expects it to return XOP encoded or decoded data, i.e.

whether it is prepared to handle elements or expects to get base64 encoded data instead.

That new API would be easy to implement in the Axiom based implementation because Axiom already provides the necessary APIs for that.

The case is less trivial for SAAJ because that API doesn’t perform any XOP decoding itself.

A solution would be to let the SAAJ based implementation return a In order to support large attachments a Web service stack needs to provide mechanisms to process them without copying them in their entirety into memory.

There are two techniques commonly used for this: None of this is supported by the SAAJ API.

On the other hand, Axiom has always supported offloading to disk, and streaming support was added in 1.2.13.

Tags: , ,