Assert.notNull(clazz, "'clazz' must not be null");
Assert.notNull(jaxbElement, "'jaxbElement' must not be null");
if (logger.isDebugEnabled()) {
logger.debug("Marshalling [" + jaxbElement + "] to response payload");
}
WebServiceMessage response = messageContext.getResponse();
if (response instanceof StreamingWebServiceMessage) {
StreamingWebServiceMessage streamingResponse = (StreamingWebServiceMessage) response;
StreamingPayload payload = new JaxbStreamingPayload(clazz, jaxbElement);
streamingResponse.setStreamingPayload(payload);
}
else {
Result responsePayload = response.getPayloadResult();
try {
Jaxb2ResultCallback callback = new Jaxb2ResultCallback(clazz, jaxbElement);
TraxUtils.doWithResult(responsePayload, callback);
}
catch (Exception ex) {