Use of Rest API with Oracle persistence layer

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

Use of Rest API with Oracle persistence layer

Amel Badaoui
Hi,

I would like to put an xml data to a new orbeon form instance, from an external app using jquery Rest API. I'm using the Oracle persistence layer. Could you explain to me how can i achieve that?

Thx,
Reply | Threaded
Open this post in threaded view
|

Re: Use of Rest API with Oracle persistence layer

Erik Bruchez
Administrator
I understand that you are using Form Runner since you mention the
Oracle persistence layer. But can you please provide more details?
It's not clear to me which part of your system will be doing what.

-Erik

On Mon, Jan 16, 2012 at 7:03 AM, Amel Badaoui <[hidden email]> wrote:

> Hi,
>
> I would like to put an xml data to a new orbeon form instance, from an
> external app using jquery Rest API. I'm using the Oracle persistence layer.
> Could you explain to me how can i achieve that?
>
> Thx,
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Use-of-Rest-API-with-Oracle-persistence-layer-tp4299765p4299765.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
>


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Use of Rest API with Oracle persistence layer

Amel Badaoui
Hi, first thank you for the fast reply,

We have an external web application that includes in its pages Xforms created with Orbeon Form Builder and published in Form Runner.
We configured the Oracle persistence layer for persisting form data.
Till now all the environment is ok.
Now we have data from the external web app that we want to send to a new form data and save it in the Oracle database.
So, we think of using the Rest API provided by Orbeon to create the data as explained here : http://wiki.orbeon.com/forms/doc/developer-guide/form-runner/persistence-api by making ajax calls to the link to form data.
But, we dont know how to achieve this exactly (meaning how to build the ajax call, the request body, ...etc.). So can you please tell us if it's a good solution and how to do?

Thanks by advance
Reply | Threaded
Open this post in threaded view
|

Re: Use of Rest API with Oracle persistence layer

Amel Badaoui
Is it clear or have i to detail more?
Reply | Threaded
Open this post in threaded view
|

Re: Use of Rest API with Oracle persistence layer

Amel Badaoui
Hi,

We made some tests with the ajax call to post to the URL a part of the instance like this:

 var buffer = "<form>" +
                    "<attachment>" +
                    "<attachment_one filename=" + info.attachment.name + " mediatype=" + info.attachment.contentType
                + " size=" + info.attachment.size + " >" + info.attachment.bytes + "</attachment_one>" +
                    "</attachment>" +
                    "</form>";
            var xmlDoc = document.implementation.createDocument("", "", null);
            xmlDoc.load(buffer);
            $.ajax({
                type: "PUT",
                url: urlToXml, // "/crud/[APPLICATION_NAME]/[FORM_NAME]/data/[FORM_DATA_ID]/data.xml"
                processData: false,
                data: xmlDoc,
                dataType: "xml",
                success: function(msg) {
                    alert ("xml data sent successfully");
                }
            });

But the response returns an invalid XML doc.

Any idea pls ?