Need help to integrate orbeon form builder & runner with java spring webapp

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

Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
Hi, I want to use orbeon forms in my java spring web application Idea is to have functionality like application admins can build forms and publish as a menu in the application. Using that menu end user will fill those form to submit the information. For this I need to integrate orbeon form builder and runner into my web-app so that i can have single WAR file.
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

Alessandro  Vernet
Administrator
Hi Ashok,

Instead of combining the Orbeon Forms war with your own war, I'd recommend you use the "Separate deployment" technique, which allows you to keep your war and the Orbeon war separate. You can find more about this on:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications

And of course, just let us know if you have any question regarding separate deployment.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
Hi Alex,


As per given steps I have tried separate deployment of Orbeon and myApp.
I have added x-form filter jar in myApp and also added given filters in myApp's web.xml.
I have deployed both application Orbeon and myApp in single tomcat with crossContext="true".

Now when I use
http://localhost:8080/orbeon/xforms-jsp/flickr-search/ 
I am getting the form.

but when I tries to access same form from myApp using
http://localhost:8080/myApp/xforms-jsp/flickr-search/

I am getting 404 page not found error.


I am not getting what I missed.

please let me know if anything I missed.

Thanks,
Ashok
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

Alessandro  Vernet
Administrator
Hi Ashok,

And did you put the flickr-search example inside xforms-jsp in your app?

Just to make things clear: with separate deployment, it's not that a path available under /orbeon becomes available under /myApp, but that a servlet or JSP in /myApp can generate XForms, and that thanks to the filter that XForms will be processed by Orbeon Forms, and the resulting will HTML sent to the browser.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
This post was updated on .
Hi alex,

Thanks for  reply. I got it working after copying flickr-search example app in my application.
Now my question is how can I integrate form created with form builder in /orebon app into my web app.
I read about it and got to know that with the approach i integrated orbeon, I can run plain x-form in my app but for form created using form builder need Form runner to run it. So please let me know how can Iintegrate orbeon form runner in my java webapp so i can run the forms built with form builder in my application.

I also understand that integrating form runner is available only on Professional edition. So is there any other alternative to integrate form builted using orbeon form builder into my app and using community edition of orbeon.

Thanks,
Ashok Wagh
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

Alessandro  Vernet
Administrator
Hi Ashok,

I am glad that things worked when copying flickr-search into your web app. Integrating forms created with Form Builder isn't done with the "separate deployment" you've been using so far. What you've done so far is for cases where your app produces XForms. To integrate a form created with Form Builder, you'll want to use the Form Runner Java Embedding API, which in a way a simpler than what you've done. This is documented on:

http://doc.orbeon.com/form-runner/link-embed/java-api.html

However, as you noted, this is a PE-only feature, and there is no equivalent for Orbeon Forms CE.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
Hi alex,

Thanks For the info. Before using Orbeon PE We are trying some POC so that we can get to know how things works in orbeon. So Now understood the way of separate deployment. I wants to know how it stores the form definition and data. after going through below link

http://doc.orbeon.com/form-runner/api/persistence/index.html#rest-based

I understood the hierarchy of folder structure where it stores form definition and data inside orebon app
But here in my case it is showing only  .bin files, not able to see any form.xhtml/ data.xml file.

Let me know how can i get those stored files?


Thanks,
Ashok  
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

Alessandro  Vernet
Administrator
Hi Ashok,

Yes, doing a POC ("try before you invest more time, energy, money…") is the way to go!

You're saying that you're only seeing .bin files. Where are you looking? With what tool?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
Hi Alex,

I am trying to store orbeon form in mysql database.
I alreday have mysql 5.7.1 database  setted up. I have created schema orbeon using user root & password xyz. I have executed DDL of orbeon tables so tables got created.
Then for configuration I have done below steps-
1. In my tomcat8 i have added mysql-connector-java-5.1.38.jar under tomcat/lib/
then added jndi Resource  in tomcats server.xml as below
<context path="/orbeon" docBase="orbeon"   reloadable="false"  override="true"  allowLinking="true">
                <Resource name="jdbc/mysql" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
                           poolPreparedStatements="true"
                           validationQuery="SELECT * FROM orbeon_form_data"
               url="jdbc:mysql://localhost:3306/orbeon"/>
</context>

2. Then I ahve added resource configuration in orbeon webapps web.xml file as

<resource-ref>
        <description>DataSource</description>
        <res-ref-name>jdbc/mysql</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

3. Then  added properties-local.xml file under orbeon\WEB-INF\resources\config with below contents

<?xml version="1.0" encoding="UTF-8"?>
<properties xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:oxf="http://www.orbeon.com/oxf/processors">
<property as="xs:string" name="oxf.fr.persistence.provider.myapp.*.*" value="mysql"/> 
<property as="xs:string" name="oxf.fr.persistence.mysql.datasource" value="mysql"/>
</properties>

4. Then started tomcat server &  tested orbeon form builder.
I have created a form form1 with app name myapp and added 2-3 input textbox.
when I try to save the form it gives an error "There was an error communicating with the database..."

I have also checked orbeon.log file but i haven;t found anything realted to db error. I have also tried with enabling log for sqlprocessor on log4j xml of orbeon. Still not got any error in orbeon.log file.

so please let me know what i missed.


Thanks
Ashok
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

Alessandro  Vernet
Administrator
Hi Ashok,

Just by reading your config, I don't see any obvious problem. If you get the "There was an error communicating with the database" error message, you should really have something in the orbeon.log about it. Could you set your logging to the Development config (see below), stop Tomcat, delete the orbeon.log, restart Tomcat, reproduce the problem, and attach your orbeon.log to your response?

http://doc.orbeon.com/configuration/advanced/xforms-logging.html#development-configuration

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
Hi Alex,
Thanks for reply i fixed the issue & got it working. Now my xforms xml & data getting saved into database.
Next what I am exploring is to call my custom REST api on form definition CRUD or on form data save/update. I found some property configuration  as like below

<property as="xs:string"  name="oxf.fr.detail.buttons.*.*" value="workflow-send clear"/>
<property as="xs:anyURI" name="oxf.fr.detail.send.uri.*.*" value="http://myapp/createPost"/>

This property i have tried. I have added this property in my WEB-INF/resources/config/properties-local.xml

& restarted the app. so here I am expecting two service call on save button of form(data save)
1. /orbeon/xforms-server
2. /myapp/createPost

but I am getting only one i.e. /orbeon/xforms-server which saved x-form into database handled by orbeon.

I want this thing like it will also call custom api of my application so that i can log these things for further processing.


Please let me know how I can do this.

Thanks,
Ashok Wagh
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

ashok@orb
Hi Alex,

Now I am able to call my custom REST api on save of orbeon form. Now I am integrating HTTP services for drop downs and other controls in a form. My REST api's are secured with oauth. So when orbeon hits the rest api for drop down data, those http call should have authorization header having token. Otherwise my application denies access to resources. So can you please tell me about how can I include my custom headers  headers to these REST calls.


Thanks,
Ashok Wagh
Reply | Threaded
Open this post in threaded view
|

Re: Need help to integrate orbeon form builder & runner with java spring webapp

Alessandro  Vernet
Administrator
Hi Ashok,

This the actual Authorization header that you need to set? Where would Orbeon Forms get the value from? Is it the value sent in the request done by the browser that should be forwarded?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet