I'm writing a simple spring-ws webservice which implements a WSDL that was defined by another project. The problem is that this WSDL and the related datatypes are extremely complicated and when sending a request to the webservice it takes around 15 seconds to initialise the JAXBContext and spring seems to create a new JAXBContext for each incoming datatype. The relevant spring code is here.
Given that I can't change the datatypes, is it possible to change the JAXBContext initialisation strategy used by spring-ws? Ideally, I'd just need the single JAXBContext cached for all requests as I can be certain that the context will be the same across requests.
Fixed the issue by accepting and responding with org.w3c.dom.Elements and having a singleton bean with a single JAXBContext which can convert between the JAXBElements and Elements.