Login  Register

Re: Re: Re: Re: From java servlet to orbeon context

Posted by Bart Ottenkamp on Jul 20, 2009; 9:04am
URL: https://discuss.orbeon.com/From-java-servlet-to-orbeon-context-tp44958p44973.html

hai Alex,

sorry, sent you half a mail... here is the complete one

I indeed do not see a response when I turn on Firebug in Firefox, so could you inspect the following:

I submit using:

            <xforms:submission
                id = "mail-submission"
                ref = "instance('form-instance')/formcontent"
                xxforms:show-progress = "false"
                method = "post"
                action = "/e-formulieren/mail"
                replace="instance"
                instance="result-instance">

the /e-formulieren/mail is mapped in page-flow.xml as follows:

            <page path-info="/e-formulieren/mail" model="forms/xpl/mail.xpl" />

the mail.xpl looks like:

<p:config
    xmlns:p = "http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf = "http://www.orbeon.com/oxf/processors"
    xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
    xmlns:divosa = "http://www.divosa.com/ops/processors">
    <p:param name = "instance" type = "input"/>
    <p:param name = "data" type = "output"/>
    <p:processor name = "divosa:mailProcessor">
        <p:input name = "data" href = "#instance"/>
        <p:output name = "data" ref = "data"/>
    </p:processor>
</p:config>

and my java code (divosa:mailProcessor):

    public void generateData(PipelineContext context, ContentHandler contentHandler) throws SAXException, DocumentException {
        Document inputDocument = readInputAsDOM4J(context, "data");
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(inputDocument.asXML());
        }
        org.dom4j.Document doc = DocumentHelper.createDocument();
        org.dom4j.Element root = doc.addElement("root");
        org.dom4j.Element result = root.addElement("result");
        // do the actual processing on the submitted information
        try {
            FormSubmitHandler formSubmitHandler = FormSubmitHandlerFactory.getFormSubmitHandler(Constants.FORM_SUBMIT_MAIL);
            String r = (String) formSubmitHandler.handle(inputDocument);
            result.addText("Het formulier is succesvol gemaild op "
                    + new SimpleDateTimeFormatter("dd-MM-YYYY HH:mm:ss").formatSimpleDateTime(new DateTime()));
        } catch (Exception e) {
            result.addText("Er is een fout opgetreden bij het mailen: " + e.getMessage());
        }
        populateContentHandler(contentHandler, doc);
    }

    protected void populateContentHandler(ContentHandler contentHandler, Document document) throws SAXException,
            DocumentException {
        // write the document to the contenthandler
        LocationSAXWriter saxWriter = new LocationSAXWriter();
        saxWriter.setContentHandler(contentHandler);
        saxWriter.write(document);
    }

can you see what happens? All my other processors return xml like this, so I think there's no fault in returning the xml from the processor. Do I loosing it in the pipeline somewhere then?

Thanks for helping.
Bart Ottenkamp

On Sat, Jul 18, 2009 at 1:11 AM, Alessandro Vernet <[hidden email]> wrote:

Hi Bart,


bartottenkamp wrote:
>
> I thought of:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> - Using <xforms:submission anyway with replace="instance" and
> instance="result"...
>

I would do the latter. (In fact, I often prefer the latter to using
xxforms:call-xpl(), as it is more standard, easier to debug, and also
exposes that functionality to other systems if needed.)


bartottenkamp wrote:
>
> I guess (hope) the latter is possible, but I get the message:
> "XFormsServer  - XForms - submission - instance replacement did not take
> place upon successful response because no body was provided. Submission:
> mail-submission"
>

Is this because the service doesn't return anything? If this is the case,
then you can use replace="none". If it is supposed to return something but
that the XForms engine says the body of the response is empty, I'd recommend
you use an HTTP sniffer to figure out what is really going over the wire.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24542979.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws