BPS
BPS

Reputation: 1231

How to properly embed form served by Orbeon Forms in HTML document?

I'm new to orbeon Forms and I have trouble to embed form into my PHP application.

I have virtual machine with ubuntu-server 16.04 with installed:

  1. NGINX + PHP application on https://localhost/
  2. Tomcat8 + Orbeon Forms 2016.3 CE serving simple form on https://localhost:8443/orbeon/testapp/form

Now I want to embed my form into my site so in my index.php I do:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <h1>My form:</h1>
        <?php
            $arrContextOptions=array(
                "ssl"=>array(
                    "verify_peer"=>false,
                    "verify_peer_name"=>false,
                ),
            );
            echo file_get_contents('https://localhost:8443/orbeon/testapp/form?orbeon-embeddable=true', false, stream_context_create($arrContextOptions));
            foreach ($http_response_header as $header){
                $groups = [];
                if (preg_match('/Set\-Cookie: JSESSIONID=(.*?);/i', $header, $groups)){
                    setcookie('JSESSIONID', $groups[1], 0, '/orbeon/', '', true, true);
                    break;
                }
        }
        ?>
    </body>
</html>

and this shows me broken form. What I'm doing wrong?

Upvotes: 0

Views: 266

Answers (1)

ebruchez
ebruchez

Reputation: 7857

Embedding is much more difficult than that, unfortunately. There is an old document, Embedding and Proxying Orbeon Forms, which covers some of the things to do.

Orbeon Forms puts this in practice in the Java embedding API, which is implemented in Scala here as of 2017-05.

There is also an outdated TYPO3 extension which you could download for inspiration, as it is implemented in PHP.

Upvotes: 1

Related Questions