try {
xproc.getPipeline().run();
Serialization serial = xproc.getPipeline().getSerialization(outputPort);
WritableDocument doc = new WritableDocument(cache.getRuntime(),null,serial,out);
ReadablePipe rpipe = xproc.getPipeline().readFrom(outputPort);
while (rpipe.moreDocuments()) {
doc.write(rpipe.read());
}
out.flush();
} catch (Exception ex) {
getLogger().log(Level.SEVERE,"Exception while running pipeline.",ex);