2014-10-10 49 views
1

我使用Orbeon Froms 4.7並測試了持久性API。我一直在參考文檔:http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/persistence-apiOrbeon Forms CRUD工程,但搜索給出500錯誤

我在Form Builder中創建了一個表單,發佈了它,並在Form Runner中完成了幾個表單。

應用:nrs_smart_forms
形式:POC

要測試的持久性API,我使用 「郵差 - REST客戶端(打包應用程序)」 從Chrome網絡商店。

目前,我已將請求配置爲不受限制,與4.0之前的版本一樣。參見: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"/> 

表演上/ CRUD一個GET ......成功地檢索表單數據:

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

但是,執行POST到/搜索...失敗:

/orbeon/FR /服務/持久/搜索/ nrs_smart_forms/POC

原始文本p osted:

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

響應:500內部服務器錯誤

部分日誌輸出如下。我已經改變了一些格式來消除重複的前綴。有三個部分堆棧跟蹤從一個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

我認爲這個問題是你沒有通過Content-Type: application/xml標題。如果我在沒有它的情況下嘗試POST,我會得到同樣的異常。

這個工作對我來說,捲曲:

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

用下面search.xml

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

我也clarified the documentation