String responseContentType = invocationResponse == null ? requestContentType : WebUtil.getContentType(invocationResponse);
response.setContentType(responseContentType);
//int iContentLength = getContentLength(invocationResponse);
//response.setContentLength(iContentLength);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
Marshaller marshaller = getMarshaller();
if (marshaller instanceof VersionedMarshaller)
((VersionedMarshaller) marshaller).write(invocationResponse, outputStream, Version.getDefaultVersion());
else
marshaller.write(invocationResponse, outputStream);
retval = outputStream.toByteArray();
response.setContentLength(retval.length);
}
}