* @throws CascadingIOException
*/
protected static byte[] readXMLResponse(Source source, byte[] binary, ServiceManager manager)
throws SAXException, IOException, CascadingIOException {
XMLSerializer serializer = null;
XMLizer xmlizer = null;
byte[] result = null;
try {
serializer = (XMLSerializer) manager.lookup(XMLSerializer.ROLE);
if (source instanceof XMLizable) {
((XMLizable) source).toSAX(serializer);
}
else {
if (binary == null) {
binary = readBinaryResponse(source);
}
final String mimeType = source.getMimeType();
if (mimeType != null) {
xmlizer = (XMLizer) manager.lookup(XMLizer.ROLE);
xmlizer.toSAX(new ByteArrayInputStream(binary),
mimeType,
source.getURI(),
serializer);
}
}