Hai all out there,
I (still) have trouble giving back a result to the client after a submission... First question is: does anybody have an example of a form, that submits a part of the model via a pipeline to a custom java processor and than gives back a result (just a message is enough) to the client? I think it should be possible (would be very weird if it is not possible, I think!) and if anybody knows how to do this, I think it should help if we make an example for it and add it to the xforms-sandbox... I really think I just have a very small error in configuration somewhere and I cannot find what is going wrong. Here is what I have: in my .xhtml: <xforms:instance id = "result-instance"> <root> <result/> <failure/> <success/> </root> </xforms:instance> and <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"> <xforms:setvalue ev:event = "xforms-submit-done" ref = "instance('result-instance')/success">success</xforms:setvalue> <xforms:message ev:event = "xforms-submit-error" level = "modal">error occurred</xforms:message> </xforms:submission> in my page-flow.xml: <!-- mail --> <page path-info="/e-formulieren/mail" model="forms/xpl/mail.xpl" /> in forms/xpl/mail.xpl: <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 then my mailProcessor: public class MailProcessor extends SimpleProcessor { private static Logger LOGGER = Logger.getLogger(MailProcessor.class); public MailProcessor() { addInputInfo(new ProcessorInputOutputInfo("instance")); addOutputInfo(new ProcessorInputOutputInfo(OUTPUT_DATA)); } @Override 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()); } LocationSAXWriter saxWriter = new LocationSAXWriter(); saxWriter.setContentHandler(contentHandler); saxWriter.write(doc); } As you can see, with the declaration in the submission: replace = "instance" instance = "result-instance" I try to replace the result instance with what I construct in the MailProcessor... The logging put to debug, this is (all) what I see: 2009-09-01 09:52:20,055 WARN XFormsServer - XForms - submission - instance replacement did not take place upon successful response because no body was provided. Submission: mail-submission Can you help??? Do you see where I go wrong? And I really think it would help to add an example to the sandbox.. then I won't have to bother you about thiss... Thanks and best regards, Bart Ottenkamp -- 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 |
I
think you'll need a view in your page flow - so your data gets sent back to the
client. Try using your existing model pipeline as the view instead.
The alternative is that the model pipeline will need to us the http serializer
processor to send data back to the client.
-- 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 |
Free forum by Nabble | Edit this page |