0

I have locally installed Orbeon Forms CE 2017.2.201712300816-CE and I would like to create view which will serve pdf document generated from xforms form.

All my files are in orbeon/WEB-INF/resources/apps/test/ directory.

When I go to URL http://localhost:8080/orbeon/test/ I see error message: "Orbeon Forms - Page Not Found We are sorry, but the resource you have requested is not available on this server. ".

What I'm doing wrong? How can I fix it?

My files:

page-flow.xml

<controller xmlns="http://www.orbeon.com/oxf/controller" matcher="regexp">
    <page path="/test/" view="pdf.xpl"/>
    <epilogue url="oxf:/config/epilogue.xpl"/>
</controller>

pdf.xpl

<!--
  Copyright (C) 2011 Orbeon, Inc.

  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU Lesser General Public License as published by the Free Software Foundation; either version
  2.1 of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU Lesser General Public License for more details.

  The full text of the license is available at http://www.gnu.org/copyleft/lesser.html
  -->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:xforms="http://www.w3.org/2002/xforms"
        xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
        xmlns:ev="http://www.w3.org/2001/xml-events">

    <p:param type="output" name="data"/>

    <!-- Prepare XForms to use noscript mode, with static appearance -->
    <p:processor name="oxf:xslt">
        <p:input name="config">
            <xsl:transform version="2.0">
                <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/>
                <xsl:template match="xforms:model">
                    <xsl:copy>
                        <xsl:attribute name="xxforms:readonly-appearance">static</xsl:attribute>
                        <xsl:apply-templates select="@* | node()"/>
                        <xforms:bind nodeset="//*" readonly="true()"/>
                    </xsl:copy>
                </xsl:template>
            </xsl:transform>
        </p:input>
        <p:input name="data" href="pdf.xhtml"/>
        <p:output name="data" id="xforms"/>
    </p:processor>

    <!-- Run XForms engine, which gives us XHTML -->
    <p:processor name="oxf:pipeline">
        <p:input name="config" href="/ops/pfc/xforms-epilogue.xpl"/>
        <p:input name="data" href="#xforms"/>
        <p:input name="model-data"><null xsi:nil="true"/></p:input>
        <p:output name="xformed-data" id="xformed-data"/>
    </p:processor>

    <!-- Prepare XHTML before conversion to PDF -->
    <p:processor name="oxf:xslt">
        <p:input name="config">
            <xsl:transform version="2.0">
                <xsl:import href="oxf:/oxf/xslt/utils/copy.xsl"/>
                <!-- Filter out scripts as they won't be used -->
                <xsl:template match="*:script"/>
                <!-- Remove noscript element, to remove warning that scripts are not supported -->
                <xsl:template match="*:noscript"/>
                <!-- Remove xforms-initially-hidden class on the form, normally removed by the script -->
                <xsl:template match="*:form">
                    <xsl:copy>
                        <xsl:attribute name="class" select="string-join(tokenize(@class, ' ')[. != 'xforms-initially-hidden'], ' ')"/>
                        <xsl:apply-templates select="@* except @class | node()"/>
                    </xsl:copy>
                </xsl:template>
                <!-- Remove all prefixes because Flying Saucer doesn't like them -->
                <xsl:template match="*">
                    <xsl:element name="{local-name()}">
                        <xsl:apply-templates select="@* | node()"/>
                    </xsl:element>
                </xsl:template>
            </xsl:transform>
        </p:input>
        <p:input name="data" href="#xformed-data"/>
        <p:output name="data" id="xhtml-data"/>
    </p:processor>

    <!-- Run Flying Saucer on the XHTML to get PDF -->
    <p:processor name="oxf:xhtml-to-pdf">
        <p:input name="data" href="#xhtml-data"/>
        <p:output name="data" ref="data"/>
    </p:processor>

</p:config>

pdf.xhtml

<?xml version="1.0"?>
<html 
  xmlns="http://www.w3.org/1999/xhtml" 
  xmlns:xf="http://www.w3.org/2002/xforms">
<head></head>
<body>
  <div style="max-width: 900px; margin: 0 auto;">
    This should be PDF.
  </div>
</body>
</html>

orbeon.log

2018-08-06 21:07:43,038 INFO  lifecycle  - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "limiter", "message": "start: nofilter", "path": "/test/", "method": "GET"}
2018-08-06 21:07:43,039 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-prod.xml
2018-08-06 21:07:43,039 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-internal.xml
2018-08-06 21:07:43,045 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-base.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-xforms.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-form-runner.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-form-builder.xml
2018-08-06 21:07:43,046 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-local.xml
2018-08-06 21:07:43,047 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/properties-local-prod.xml
2018-08-06 21:07:43,047 DEBUG properties  - Not reloading properties because they have not changed.
2018-08-06 21:07:43,047 DEBUG auth  - using `Container` method
2018-08-06 21:07:43,047 DEBUG auth  - usernameOpt: `None`, roles: `None`
2018-08-06 21:07:43,047 WARN  auth  - not setting credentials headers because credentials are not found
2018-08-06 21:07:43,047 INFO  lifecycle  - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "service", "message": "start: handle"}
2018-08-06 21:07:43,047 INFO  ProcessorService  - /test/ - Received request
2018-08-06 21:07:43,047 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,048 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/prologue-servlet.xpl
2018-08-06 21:07:43,048 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/aggregator.rng
2018-08-06 21:07:43,057 DEBUG ConcreteChooseProcessor  - Choose: taking otherwise branch at line 25, column 40 of oxf:/config/prologue-servlet.xpl
2018-08-06 21:07:43,057 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/page-flow-controller.rng
2018-08-06 21:07:43,057 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /page-flow.xml
2018-08-06 21:07:43,057 DEBUG PageFlowControllerProcessor  - processing page/service {controller: "oxf:/page-flow.xml", method: "GET", path: "/test/"}
2018-08-06 21:07:43,057 DEBUG PageFlowControllerProcessor  - processing route {route: "PageOrServiceRoute(PageOrServiceElement(None,/([^/]+)/.*,/([^/]+)/.*,None,Some(apps/${1}/page-flow.xml),None,org.orbeon.dom.tree.ConcreteElement@1ea06e3 [Element: <page uri: http://www.orbeon.com/oxf/controller attributes: [org.orbeon.dom.tree.ConcreteAttribute@117b4e6 [Attribute: name path value "/([^/]+)/.*"], org.orbeon.dom.tree.ConcreteAttribute@1b83b9f [Attribute: name model value "apps/${1}/page-flow.xml"], org.orbeon.dom.tree.ConcreteAttribute@f734ae [Attribute: name public-methods value "#all"]]/>] userData: line 31, column 85 of oxf:/page-flow.xml,<function1>,<function1>,true),<function1>)"}
2018-08-06 21:07:43,058 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,058 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-xml-submission.xpl
2018-08-06 21:07:43,058 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/request-config.rng
2018-08-06 21:07:43,061 DEBUG ConcreteChooseProcessor  - Choose: taking otherwise branch at null
2018-08-06 21:07:43,062 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /ops/pfc/rewrite.xsl
2018-08-06 21:07:43,062 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/url-generator-config.rng
2018-08-06 21:07:43,062 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/xslt-transformer-config.rng
2018-08-06 21:07:43,063 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/attributes-config.rng
2018-08-06 21:07:43,063 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/aggregator.rng
2018-08-06 21:07:43,063 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,063 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,063 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /apps/test/page-flow.xml
2018-08-06 21:07:43,070 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,070 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,076 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,076 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,077 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,077 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@2981c7
2018-08-06 21:07:43,077 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/page-flow-controller.rng
2018-08-06 21:07:43,078 DEBUG PageFlowControllerProcessor  - processing page/service {controller: "oxf:/apps/test/page-flow.xml", method: "GET", path: "/test/"}
2018-08-06 21:07:43,078 DEBUG PageFlowControllerProcessor  - processing route {route: "PageOrServiceRoute(PageOrServiceElement(None,/test/,/test/,None,None,Some(pdf.xpl),org.orbeon.dom.tree.ConcreteElement@1bf3914 [Element: <page uri: http://www.orbeon.com/oxf/controller attributes: [org.orbeon.dom.tree.ConcreteAttribute@876b67 [Attribute: name path value "/test/"], org.orbeon.dom.tree.ConcreteAttribute@48c89c [Attribute: name view value "pdf.xpl"]]/>] userData: line 2, column 41 of oxf:/apps/test/page-flow.xml,<function1>,Set(GET, HEAD),true),<function1>)"}
2018-08-06 21:07:43,078 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,078 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-xml-submission.xpl
2018-08-06 21:07:43,084 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/request-config.rng
2018-08-06 21:07:43,089 DEBUG ConcreteChooseProcessor  - Choose: taking when branch with test: /step-type = 'view' at null
2018-08-06 21:07:43,089 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/url-generator-config.rng
2018-08-06 21:07:43,089 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,089 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,089 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /apps/test/pdf.xpl
2018-08-06 21:07:43,112 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,112 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,113 DEBUG URLGenerator  - Config found: org.orbeon.oxf.processor.generator.URLGenerator$ConfigURIReferences@19489e
2018-08-06 21:07:43,113 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,114 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,114 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-epilogue.xpl
2018-08-06 21:07:43,115 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/xslt-transformer-config.rng
2018-08-06 21:07:43,115 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/attributes-config.rng
2018-08-06 21:07:43,115 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /apps/test/pdf.xhtml
2018-08-06 21:07:43,121 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /oxf/xslt/utils/copy.xsl
2018-08-06 21:07:43,122 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/processor/serializer/legacy-serializer-config.rng
2018-08-06 21:07:43,122 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/xslt-transformer-config.rng
2018-08-06 21:07:43,122 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/attributes-config.rng
2018-08-06 21:07:43,122 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /oxf/xslt/utils/copy.xsl
2018-08-06 21:07:43,122 DEBUG ConcreteChooseProcessor  - Choose: taking when branch with test: not(/*/@xsi:nil = 'true') at null
2018-08-06 21:07:43,122 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,123 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/epilogue.xpl
2018-08-06 21:07:43,123 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/request-config.rng
2018-08-06 21:07:43,125 DEBUG ConcreteChooseProcessor  - Choose: taking when branch with test: /request/container-type = 'servlet' at line 57, column 31 of oxf:/config/epilogue.xpl
2018-08-06 21:07:43,125 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,125 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /config/epilogue-servlet.xpl
2018-08-06 21:07:43,139 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/xml/schemas/pipeline.rng
2018-08-06 21:07:43,139 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /ops/pfc/xforms-epilogue.xpl
2018-08-06 21:07:43,141 DEBUG ConcreteChooseProcessor  - Choose: taking when branch with test: /document[@xsi:type] at line 52, column 36 of oxf:/config/epilogue-servlet.xpl
2018-08-06 21:07:43,141 DEBUG URLGenerator  - OXF Protocol: Using ResourceManager for key /org/orbeon/oxf/processor/serializer/http-serializer-config.rng
2018-08-06 21:07:43,143 INFO  ProcessorService  - /test/ - Timing: 96
2018-08-06 21:07:43,146 INFO  lifecycle  - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "service", "message": "end: handle", "time": "96 ms"}
2018-08-06 21:07:43,146 INFO  lifecycle  - event: {"request": "18", "session": "AD33D43367512176B3CB5DDDA4B830F9", "source": "limiter", "message": "end: nofilter", "time": "108 ms"}
BPS
  • 1,133
  • 1
  • 17
  • 38
  • 1
    Could you check your `orbeon.log` at the time you access `http://localhost:8080/orbeon/test/`, getting a 404, and see if find anything interesting in the log? If not, could you post the log file somewhere and link to it here in a comment? – avernet Aug 03 '18 at 14:39
  • @avernet I've added orbeon.log to end of post. – BPS Aug 06 '18 at 19:14
  • Sorry for the late follow-up! Have you solved this one by any chance since your last message? If not, I've checked the `orbeon.log` you linked to, but I'm not sure what error or part of the log file corresponds to the 404. Would you be able to send me the part of the log just when you do that request? Maybe one way to do this, is to stop Tomcat, remove the `orbeon.log`, start Tomcat, do just that request, and copy the `orbeon.log` at that point. – avernet Aug 16 '18 at 17:42
  • @avernet This log I've included describes only one request, it starts at 21:07:43,038 and ends at 21:07:43,146. Also I forgot to add that this code works perfectly fine on Orbeon 3.9, all I have to do is to replace some names in page-flow like controller -> config, path -> path-info, etc. – BPS Aug 17 '18 at 12:21
  • Got it @BPS, I must have looked at the wrong log file. However, the thing is that your code is working for me. I downloaded a 2017.2 CE, and put the `test` directory with your files under `WEB-INF/resources/apps`, and going to `http://localhost:8080/orbeon/test/`, I get the [PDF as expected](https://i.imgur.com/9dJP01w.png). I've put your files in [a Gist](https://gist.github.com/avernet/63dd24f05b671bc36e7a53f5f2a35390) so you can easily download them as a zip. Could you try again reproducing this on a verbatim install, exactly as I did? – avernet Aug 20 '18 at 23:12
  • @avernet Nothing changed. I have 2 freshly installed virtual machines: 1). ubuntu16 server + tomcat8 + orbeon 2017.2; 2). ubuntu16 server + tomcat8 + orbeon 3.9; On orbeon 3.9 pdf is generated, on orbeon 2017 is not :/ – BPS Aug 27 '18 at 11:01
  • And just to make sure we're doing exactly the same thing, have in indeed followed the steps mentioned in my Aug 20 comment, starting with a fresh install of Orbeon Forms? – avernet Aug 28 '18 at 17:55
  • Hi @BPS, did you get to solve the 404 issue when generating the PDF? If not, have you tried following the steps I mentioned my Aug 20 comment, per my previous Aug 28 comment? – avernet Sep 04 '18 at 18:53

0 Answers0