Hi!

I'm trying to get FOP over SOAP (invoking a bean) up and running, but I
always receive the "org.apache.fop.apps.FOPException" error message. Though
I'm a beginner in this matter, hopefully someone can give me a hint.

My code:

import java.io.*;
import java.util.*;

import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;

import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.apps.InputHandler;
import org.apache.fop.apps.XSLTInputHandler;

import org.apache.log.*;

public class generatePDF {

        public String Publish(String XMLfile, String XSLfile, String outFile)
throws Exception {

                File MyXMLfile = new File(XMLfile);
                File MyXSLfile = new File(XSLfile);
                FileOutputStream MyOutputFile = new FileOutputStream(outFile);

                Logger log = null;

                if(log == null) {
                    Hierarchy hierarchy = Hierarchy.getDefaultHierarchy();
                    log = hierarchy.getLoggerFor("fop");
                    log.setPriority(Priority.WARN);
                }

                try {

                        Driver driver = new Driver();
                        driver.setLogger(log);
                        driver.setRenderer(Driver.RENDER_PDF);
                        InputHandler inputHandler = new 
XSLTInputHandler(MyXMLfile, MyXSLfile);
                        XMLReader parser = inputHandler.getParser();
                        driver.setOutputStream(MyOutputFile);
                        driver.render(parser, inputHandler.getInputSource());
                        MyOutputFile.close();

                } catch (Exception ex) {

                        System.out.println(ex);

                }

                return "built " + outFile;
        }

}

Thanks in advance and sorry for my english,

Tobi

Reply via email to