msg.setContent(OutputStream.class, baos);
msg.setContent(MessageExchange.class, exchange);
msg.put(SoapVersion.class, in.get(SoapVersion.class));
msg.put(JbiConstants.USE_JBI_WRAPPER, useJbiWrapper);
InterceptorChain phase = getChain(Phase.ServerOutFault);
SoapFault soapFault;
if (error instanceof SoapFault) {
soapFault = (SoapFault) error;
} else {
soapFault = new SoapFault(error);
}
msg.setContent(Exception.class, soapFault);
phase.doIntercept(msg);
return session.createTextMessage(baos.toString());
}