what is the preferred way of creating SOAPMessage containing a SOAPFault from a webservice that implements JAX-WS Provider interface?
MessageFactory.newInstance()
seems like unnecessarily expensive operation and there's no mention about thread safety. I have four possible solutions, but got no idea which I should be using:
MessageFactory.createMessage()
MessageFactory.newInstance()
for every callPremature optimization is the root of all evil
As this will be very easy to change later, I would go with option 4 (MessageFactory.newInstance()
every time) and only consider other options if and when I see it has performance issues.
This might not be a performance issue at all and you'll save yourself some coding.