1
votes

I am using Orbeon Froms 4.7 and testing out the persistence API. I have been referring to the documentation: http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/persistence-api.

I created a form in Form Builder, published it, and completed several forms in Form Runner.

App: nrs_smart_forms
Form: poc

To test the persistence API, I am using "Postman - REST Client (Packaged app)" from the Chrome web store.

For the moment, I have configured requests to be unrestricted as in pre-4.0 versions. See: http://wiki.orbeon.com/forms/doc/developer-guide/page-flow-controller/authorization#TOC-Backward-compatibility.

<property
  as="xs:string"
  processor-name="oxf:page-flow"
  name="page-public-methods"
  value="GET HEAD POST PUT DELETE"/>

<property
  as="xs:string"
  processor-name="oxf:page-flow"
  name="service-public-methods"
  value="GET HEAD POST PUT DELETE"/>

Performing a GET on /crud... successfully retrieves the form data:

/orbeon/fr/service/persistence/crud/nrs_smart_forms/poc/data/5dcc4d2cf9533c6477f92b1ad5addd5993494173/data.xml

However, performing a POST to /search... fails:

/orbeon/fr/service/persistence/search/nrs_smart_forms/poc

Raw text posted:

<search>
    <drafts>include</drafts>
    <!-- Paging -->
    <page-size>10</page-size>
    <page-number>1</page-number>
    <!-- Language -->
    <lang>en</lang>
</search>

Response: 500 Internal Server Error

Partial log output is below. I have changed the formatting a bit to eliminate repeated prefixes. There are three partial stack traces output from one POST:

PageFlowControllerProcessor  - error caught {controller: "oxf:/apps/fr/page-flow.xml", method: "GET", path: "/fr/service/persistence/form/"}
+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Unsupported path: /fr/service/persistence/form/                                                                       |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/page-flow.xml                                                        |reading page model data output|  18|
|······················································································································|
|element=<service path="/fr/service/persistence/.*" model="persistence/proxy.xpl"/>                                    |
|model  =persistence/proxy.xpl                                                                                         |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/persistence/proxy.xpl                                                |executing processor           |  18|
|······················································································································|
|element=<p:processor name="fr:persistence-proxy"/>                                                                    |
|name   ={http://orbeon.org/oxf/xml/form-runner}persistence-proxy                                                      |
|----------------------------------------------------------------------------------------------------------------------|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.oxf.common.OXFException                                                                         |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.oxf.fr.FormRunnerPersistenceProxy       |proxyRequest                  |FormRunnerPersistenceProxy.sca|  67|

...

ProcessorService  - /fr/service/persistence/form/ - Timing: 203
XFormsServer  - xforms-submit-error - setting throwable {throwable: "
+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|xf:submission for submission id: fr-default-submission, error code received when submitting instance: 500             |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.oxf.xforms.submission.XFormsSubmissionException                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|.orbeon.oxf.xforms.submission.XFormsModelSubmission|getReplacer                   |XFormsModelSubmission.java    | 729|

...

XSLTTransformer  - Error at line 113 of oxf:/apps/fr/persistence/exist/search.xpl:
 variable $instance is element(search, xs:anyType); supplied value has item type element(null, xs:anyType)
PageFlowControllerProcessor  - error caught {controller: "oxf:/apps/fr/page-flow.xml", method: "POST", path: "/fr/service/exist/search/nrs_smart_forms/poc"}

+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Required item type of value of variable $instance is element(search, xs:anyType); supplied value has item type element|
|(null, xs:anyType)                                                                                                    |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/persistence/exist/search.xpl                                         |                              | 113|
|oxf:/apps/fr/page-flow.xml                                                        |reading page view data output |  28|
|······················································································································|
|element=<service path="/fr/service/exist/search/([^/^.]+)/([^/^.]+)" view="persistence/exist/search.xpl"/>            |
|view   =persistence/exist/search.xpl                                                                                  |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/persistence/exist/search.xpl                                         |reading processor output      | 164|
|······················································································································|
|element=<p:output name="response" ref="data"/>                                                                        |
|name   =response                                                                                                      |
|ref    =data                                                                                                          |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/ops/xforms/xforms-submission.xpl                                             |reading processor output      |  75|
|······················································································································|
|element=<p:output name="document" id="binary-document"/>                                                              |
|name   =document                                                                                                      |
|id     =binary-document                                                                                               |
|----------------------------------------------------------------------------------------------------------------------|
|input:data                                                                        |                              |    |
|oxf:/ops/xforms/xforms-submission.xpl                                             |reading processor output      |  42|
|······················································································································|
|element=<p:param name="request" type="input"/>                                                                        |
|name   =request                                                                                                       |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/persistence/exist/search.xpl                                         |reading processor output      | 157|
|······················································································································|
|element=<p:output name="data" id="query"/>                                                                            |
|name   =data                                                                                                          |
|id     =query                                                                                                         |
|----------------------------------------------------------------------------------------------------------------------|
|oxf:/apps/fr/persistence/exist/search.xpl                                         |executing XSLT transformation | 113|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.saxon.trans.XPathException                                                                      |
|----------------------------------------------------------------------------------------------------------------------|
|org.orbeon.saxon.expr.Expression                   |typeError                     |Expression.java               | 981|

...

1

1 Answers

1
votes

I think the issue is that you didn't pass the Content-Type: application/xml header. If I try a POST without it, I get the same exception you are getting.

This works for me with CURL:

curl -X POST -d @search.xml -H "Content-Type: application/xml" http://localhost:8080/orbeon/fr/service/persistence/search/orbeon/bookshelf

With the following search.xml:

<search>
    <drafts>include</drafts>
    <page-size>10</page-size>
    <page-number>1</page-number>
    <lang>en</lang>
</search>

I also clarified the documentation.