integrating Orbeon-CE and Quercus (php java servlet)

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

integrating Orbeon-CE and Quercus (php java servlet)

DL
I need some help in integrating a Quercus PHP Servlet into Orbeon.

This integration works well when I integrate Quercus into other tomcat webapps ..

but I haven't quite got it right for Orbeon.

I think that I might be stumbling in mapping *.php files and in setting up the page-flow.xml files since php is not being interpreted inside Orbeon as I expect.

Why am I integrating php?  To experiment with some pre-processing of forms so that php spits out the dynamic xforms format.  Or even to use php apps inside Orbeon forms.

Orbeon-CE is running on Tomcat 2.0.20

Information on quercus (and resin) is here ..

http://www.caucho.com

Here are the steps I've taken so far ..

Step 1

In ..\Web-inf add ..

resin-util.jar
quercus.jar

from the caucho quercus download.

Step 2

In Orbeon-CE create xforms-php folder at same root level as xforms-jsp folder

i.e.

>web-inf
>xforms-jsp
>xforms-php


Step 3

Also try adding some test php apps in Web-inf\apps\

..\Web-inf\resources\apps\quercus\



Step 4

web.xml configuration.

First read these ..

http://wiki.caucho.com/Quercus:_Tomcat

and here ..

http://weblogs.java.net/blog/ludo/archive/2007/03/100_java_quercu.html


Then in Orbeon web-inf/web.xml include the following script to add to the existing Orbeon servlet
configuration.  i.e. merge the servlet definitions and mappings.




   
   
    <servlet>
    <servlet-name>Quercus Servlet</servlet-name>
    <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
    </servlet>

    <servlet-mapping>
    <servlet-name>Quercus Servlet</servlet-name>
    <url-pattern>*.php</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
    <welcome-file>index.php</welcome-file>
    </welcome-file-list>






    <filter-mapping>
    <filter-name>orbeon-xforms-filter</filter-name>
        <url-pattern>/xforms-php/*</url-pattern>
       
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>



Step 5

Page Flow Controllers

In Web-inf\resources\page-flow.xml

add php extension here ..

<files path-info="(?!/([^/]+)/service/).+\.(gif|css|pdf|json|js|png|jpg|xsd|htc|ico|<b>php|swf|html|txt)" matcher="oxf:perl5-matcher"/>


Step 6

In Web-inf\resources\apps\

add \quercus\phpinfo.php


<?php  phpinfo();  ?>


Step 7

Place custom php.ini into ..\web-inf\



Step 8

Edit Web-inf\resources\apps\quercus\page-flow.xml

<page path-info="/quercus/phpinfo/" view="phpinfo.php"/>



Step 9

Restart Orbeon running in tomcat.



Step 10

Try launching test phpinfo.php to see if php cose (quercus) is being interpreted inside Orbeon.

http://localhost:8080/orbeon-CE/quercus/phpinfo/

...................................................................................................

However .. Instead of the php info I get an Orbeon error message

Fatal error: Premature end of file

oxf:/page-flow.xml 42 106
reading page model data output
page id → apps
model → apps/${1}/page-flow.xml
<page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>



Any ideas on where I've gone wrong???

You can see deploy quercus.war into tomcat webapps to allow php to run on the same tomcat server as Orbeon.

But I'm pushing it further by integrating Orbeon and Quercus so that php based conponents might be added.









DL
Reply | Threaded
Open this post in threaded view
|

Re: integrating Orbeon-CE and Quercus (php java servlet)

DL
typo error in above post .. Orbeon-3.8.0 is running on Tomcat 6.0.20
DL
Reply | Threaded
Open this post in threaded view
|

Re: integrating Orbeon-CE and Quercus (php java servlet)

DL
In reply to this post by DL
Well some progress has been made ..

I've found that if I don't include this filter in web.xml


    <filter-mapping>
        <filter-name>orbeon-xforms-filter</filter-name>
        <url-pattern>/xforms-php/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
    </filter-mapping>


and then launch a php program in orbeon-CE\xforms-php\phpinfo\phpinfo.php


http://localhost:8080/orbeon-CE/xforms-php/phpinfo/phpinfo.php


I can see all the expected PHP variables in browser.

...

But if I try to run a php program from apps as a component ...


http://localhost:8080/orbeon-CE/quercus/phpinfo/

I see this error

Fatal error: Premature end of file


DL
Reply | Threaded
Open this post in threaded view
|

Re: integrating Orbeon-CE and Quercus (php java servlet)

DL
Having got quercus servlet to interpret php in ..\xforms-php\phpinfo.php (see above thread)

I now try to run phpinfo.php as a service ..

orbeon-CE\WEB-INF\resources\apps\quercus\phpinfo.php
orbeon-CE\WEB-INF\resources\apps\quercus\page-flow.xml


Quercus page-flow.xml above contains this URL mapping

<page path-info="/quercus/phpinfo/" view="phpinfo.php"/>


But in launching

http://localhost:8080/orbeon-CE/quercus/phpinfo/


I see this Orbeon error page ...
 
Fatal error: Premature end of file.


Call stack:

Resource URL       Line Col Description

oxf:/apps/quercus/phpinfo.php      N/A N/A
oxf:/page-flow.xml       42 106 reading page model data output
                                                                page id → apps model → apps/${1}/page-flow.xml
<page id="apps" path-info="/([^/]+)/.*"matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>



This is the line referred to in oxf:/page-flow.xml


<page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>



The Servlet Stack trace is

org.orbeon.oxf.xml.XMLUtils$ErrorHandler fatalError XMLUtils.java 317

...

it seems that Orbeon is parsing services\quercus\phpinfo.php as an xml file (?) before the quercus servlet kicks in.

This is the last step to integrate orbeon & quercus.   Any ideas on getting php apps to run as a service?


Reply | Threaded
Open this post in threaded view
|

Re: Re: integrating Orbeon-CE and Quercus (php java servlet)

Tambet Matiisen
AFAIK Orbeon filter expects it's input to be XML. Create a simple PHP
script that outputs valid XHTML and check if that works.

   Tambet

On 14.11.2010 14:44, DL wrote:

> Having got quercus servlet to interpret php in ..\xforms-php\phpinfo.php (see
> above thread)
>
> I now try to run phpinfo.php as a service ..
>
> orbeon-CE\WEB-INF\resources\apps\quercus\phpinfo.php
> orbeon-CE\WEB-INF\resources\apps\quercus\page-flow.xml
>
>
> Quercus page-flow.xml above contains this URL mapping
>
> <page path-info="/quercus/phpinfo/" view="phpinfo.php"/>
>
>
> But in launching
>
> http://localhost:8080/orbeon-CE/quercus/phpinfo/
>
>
> I see this Orbeon error page ...
>
> Fatal error: Premature end of file.
>
>
> Call stack:
>
> Resource URL       Line Col Description
>
> oxf:/apps/quercus/phpinfo.php      N/A N/A
> oxf:/page-flow.xml       42 106 reading page model data output
>                page id → apps model → apps/${1}/page-flow.xml
> <page id="apps" path-info="/([^/]+)/.*"matcher="oxf:perl5-matcher"
> model="apps/${1}/page-flow.xml"/>
>
>
>
> This is the line referred to in oxf:/page-flow.xml
>
> <!-- Dispatch request to a specific application -->
> <page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher"
> model="apps/${1}/page-flow.xml"/>
>
>
>
> The Servlet Stack trace is
>
> org.orbeon.oxf.xml.XMLUtils$ErrorHandler fatalError XMLUtils.java 317
>
> ...
>
> it seems that Orbeon is parsing services\quercus\phpinfo.php as an xml file
> (?) before the quercus servlet kicks in.
>
> This is the last step to integrate orbeon&  quercus.   Any ideas on getting
> php apps to run as a service?
>
>
>


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

Re: Re: integrating Orbeon-CE and Quercus (php java servlet)

DL
Tambet Matiisen wrote
AFAIK Orbeon filter expects it's input to be XML. Create a simple PHP
script that outputs valid XHTML and check if that works.

   Tambet
Thanks for that reminder ..

I hoped that this embedded php code would work ..

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xhtml:head>
<xhtml:title>Hello Orbeon and Quercus World Classic</xhtml:title>
</xhtml:head>
<xhtml:body>
<xhtml:p><?php echo ("Hello Orbeon and Quercus World!"); ?></xhtml:p>
</xhtml:body>
</xhtml:html>

But the php code inside xhtml is not interpreted.  

The "Hello Orbeon and Quercus World!" text is not echoed in browser.

It may be that content-header might be needed ..

<?php
// set content-type header for xml output
header ("Content-Type:text/xml");
?>

so I'll keep trying to embed.

Quercus works o.k. in xforms-php folder .. but that is outside Orbeon Form runner.