Accessing Persistence API Implementations

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing Persistence API Implementations

kiskandar
This post was updated on .
I'm currently deploying Orbeon PE 2018.2 into a standalone instance of
WildFly 14 and followed the guide to use MySQL persistence. Everything works
and I can see form templates and form data being persisted into the MySQL
database.

I'm now trying to make individual calls to the MySQL persistence API without
any success, for example calls to the following:
http://localhost:8080/orbeon/fr/service/mysql/form
http://localhost:8080/orbeon/fr/service/mysql/crud/appname/formname/form/form.xhtml

All returned a HTTP 403 Forbidden error.

Have the following properties set in properties-local.xml so far:
<property
        as="xs:string"
        name="oxf.fr.persistence.provider.*.*.*"
        value="mysql"/>
    <property
        as="xs:boolean"
        name="oxf.fr.authentication.user-menu.enable"
        value="true"/>
    <property
         as="xs:string"
         name="oxf.fr.authentication.method"
         value="container"/>
    <property
         as="xs:string"
         name="oxf.fr.authentication.container.roles"
         value="admin orbeon-user orbeon-service"/>


Appriciate if anyone can point me in the right direction.

Kind regards
Kris

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Persistence API Implementations

Alessandro  Vernet
Administrator
Hi Kris,

A couple of things:

1. First, you'll need to authorize calling those services. For testing, you
can add the following 2 properties. But will completely open access to those
services, which most likely you won't want to have in production. You can
check the page linked below for more on this.

<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"/>

https://doc.orbeon.com/xml-platform/controller/authorization-of-pages-and-services

2. Second, call the services using `persistence` in the URL, instead of
directly `mysql`. This way the call will go through the persistence proxy,
which will take care of routing the request to the implementation for MySQL,
but will also perform other needed operations.

You'll let me know if this helps.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Persistence API Implementations

kiskandar
This post was updated on .
Hi Alex

Thanks for the reply. I managed to get this working now. I now encounter an
issue where I need to create an instance of a form and save it before
presenting it to the user (the form needs to be pre-populated with data from
an external system). If I trigger a PUT request to the following endpoint to
save the form data
http://localhost:8080/orbeon/fr/service/persistence/crud/app_name/form_name/data/document_id/data.xml
then I get a HTTP 400 error if the document_id is a non-existent document
ID, but it is successful if the document ID already exists in Orbeon so I
can use this to edit the values of an existing form but not for saving a new
form.

Essentially I want to trigger the save attachments and save XML part of
Orbeon's save action to create and prefill a new form and only presenting
the form to the user afterwards. Is this possible>

Kind regards
Kris


--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+unsubscribe@googlegroups.com.
To post to this group, send email to orbeon@googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Persistence API Implementations

Alessandro  Vernet
Administrator
Hi Kris,

You should be able to store form data using a `PUT`. Could it be that the
`Orbeon-Form-Definition-Version` header is missing in your request (see link
below)? If this isn't the problem, I'd recommend you check the `orbeon.log`
for more information about what went wrong. You'll let me know what your
findings are.

https://doc.orbeon.com/form-runner/api/persistence/crud#put

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Persistence API Implementations

kiskandar
Thanks Alex, I was indeed missing the Orbeon-Form-Definition-Version header.
It's all working now.

Kind regards
Kris

--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Persistence API Implementations

Alessandro  Vernet
Administrator
Excellent Kris, I am glad adding that header did it! And thanks for the
update.

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet