Issue when we embed the form in our application, there is an error calling the http service and the results are not displayed in the form

34 views
Skip to first unread message

Conjunction Team

unread,
Nov 11, 2023, 2:50:02 AM11/11/23
to Orbeon Forms

We are upgrading Orbeon from “Orbeon Forms 4.2.0.201305301915 PE” to “ORBEON-2020.1.6.2.202112290124-PE”.

One of the issues that we are encountering is that we created a test form in Form Builder which calls a http service and displays the results in a list a radio buttons (as you can see at the following image).

form_builder.png


The following is the code for calling the http service:


<xf:instance id="beneficiary_rest-instance" class="fr-service"
                         xxf_2:exclude-result-prefixes="#all">
                <body xmlns:xxbl="http://orbeon.org/oxf/xml/xbl"
                      xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilderXPathApi">&lt;params/&gt;</body>
            </xf:instance>
            <xf:submission id="beneficiary_rest-submission" class="fr-service"
                           resource="http://localhost:7001/testapp/rest/rd/rep?by=group&amp;byValue=1234&amp;langCode=en"
                           method="get"
                           serialization="none"
                           mediatype=""/>
            <xf:action id="send_call-binding">
                <xf:action event="fr-run-form-load-action-after-controls" ev:observer="fr-form-model"
                           if="true()">
                    <xf:send submission="beneficiary_rest-submission"/>
                </xf:action>
                <xf:action event="xforms-submit" ev:observer="beneficiary_rest-submission">
                    <xf:var name="request-instance-name" value="'beneficiary_rest-instance'"/>
                    <xf:action/>
                </xf:action>
                <xf:action event="xforms-submit-done" ev:observer="beneficiary_rest-submission">
                    <xf:action class="fr-save-to-dataset-action">
                        <xf:var name="dataset-name">test_data</xf:var>
                    </xf:action>
                </xf:action>
            </xf:action>

This test form displays the data correctly from Form Builder and Form Runner but when we embed this test form in our application, there is an error calling the http service and the results are not displayed in the form (as you can see at the following image):

form_embedded.png


and the followings are the error logs in orbeon.log:


error_logs.png

We are using the old way of JavaScript Embedding API.

Could you help please ?

Alessandro Vernet

unread,
Nov 11, 2023, 3:07:22 AM11/11/23
to orb...@googlegroups.com
Since you are upgrading, I would strongly recommend that you go for the latest 2022.1.x. The 2022.1 was released late last year, is now on its 5th point release, and should be a good modern and stable base for an upgrade.

The error seems to be a 404 Not Found when calling `beneficiary_rest-submission`, which makes a request to `http://localhost:7001/testapp/rest/rd/rep?by=group&byValue=1234&langCode=en`. And you say that this works when using Test in Form Builder, but not when embedding the form. Is it possible that a different server is being used when embedding, and it can't access the service using this URL?

-Alex

--
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+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/f2ffff1e-1912-4cf0-9464-ee32fd0d058bn%40googlegroups.com.

Conjunction Team

unread,
Nov 13, 2023, 11:54:39 AM11/13/23
to Orbeon Forms
Thank you very much Alex for the response !!! For the moment we can not go for the latest 2022.1.x because we have some technical limitations. The test form works fine in Form Builder, but not when embedding the form. The server is the
same when embedding. I was thinking that the issue could be related with xmlns:fbf="java:org.orbeon.oxf.fb.FormBuilderXPathApi" that maybe for a reason this FormBuilderXPathApi is not accessible when embedding the form. Could it be the case? If not then maybe the issue is related with the rewriting of the url used for the call. Is it possible to log the url in "orbeon.log" before calling the http service ? If yes, could you please us provide some instructions?

Many Thanks!
-Leo 

Alessandro Vernet

unread,
Nov 13, 2023, 8:14:29 PM11/13/23
to orb...@googlegroups.com
Hi Leo,

I have no idea what might be causing this to work when the form isn't embedded and fail when it is. I would recommend that you gradually remove elements from your form to get to a point where you have the simplest possible form that reproduces the problem, and replace the URL you're using with a publicly accessible service (perhaps something from https://httpbin.org/).

Once you get to that point, you may be able to figure out what's causing the problem. And if not, you'll be able to provide us with a simple, reproducible example. Sounds like a plan?

-Alex

Conjunction Team

unread,
Nov 22, 2023, 3:48:29 PM11/22/23
to Orbeon Forms
Hi Alex,
Your suggestions helped me to resolve the issue.

Many thanks!

Alessandro Vernet

unread,
Nov 22, 2023, 3:56:49 PM11/22/23
to orb...@googlegroups.com
Perfect Leo, and thank you for the confirmation.

-Alex
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages