Error with get-request-header in Liferay

2 views
Skip to first unread message

Ruben Garay

unread,
Dec 2, 2019, 2:19:52 PM12/2/19
to orb...@googlegroups.com
Hi,

Actually I need to send data in the header of a request, from a form 'A' to
one 'B'. The data is sent as follows:

<xf:submission id="test-submission"
resource="http://localhost:8080/group/bpm/test2"
replace="all"
relevant="true"
method="post"
serialization="application/xml"
mediatype="application/xml">
<xf:header>
<xf:name>myheader</xf:name>
<xf:value>Holassss</xf:value>
</xf:header>
</xf:submission>
.
.
.
.
<xf:trigger id="send-control" bind="send-bind">
<xf:label ref="$form-resources/send/label"/>
<xf:hint ref="$form-resources/send/hint"/>
<xf:alert ref="$fr-resources/detail/labels/alert"/>
<xf:send event="DOMActivate" submission="test-submission"/>
</xf:trigger>


On form 'B', I try to get it in two ways:

<xf:action event="xforms-model-construct-done">
<xf:setvalue ref="instance('fr-form-instance')/section-1/result2"
value="xxf:get-request-header('myheader')"/>
</xf:action>

or:
<xf:bind id="result1-bind" ref="result1" name="result1"

calculate="xxf:get-request-header('myheader')"/>


But with neither of the two ways can I access the data sent. It is necessary
to mention that the two forms are within Liferay and I have activated the
name of the header in the proxy-portlet:

<init-param>
<name>forward-headers</name>
<value>myheader</value>
</init-param>


I hope you can help me or have another solution, since I cannot use data
submission by URL.


Thank you!

--
Sent from: http://discuss.orbeon.com/

Erik Bruchez

unread,
Dec 3, 2019, 1:38:36 PM12/3/19
to orb...@googlegroups.com
Can you clarify what is running at the following URL?

http://localhost:8080/group/bpm/test2

-Erik

Ruben Garay

unread,
Dec 3, 2019, 7:10:17 PM12/3/19
to orb...@googlegroups.com
Hi Erik,

It is another Orbeon form within Liferay, with two controls of calculated
value. I try to catch the header value in two ways with
xxf:get-request-header:

<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exf="http://www.exforms.org/exf/1-0">
<xh:head>
<xh:title>Untitled Form</xh:title>
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">


<xf:instance id="fr-form-instance"
xxf:exclude-result-prefixes="#all" xxf:index="id">
<form>
<section-1>
<result1/>
<result2/>
</section-1>
</form>
</xf:instance>


<xf:bind id="fr-form-binds" ref="instance('fr-form-instance')">
<xf:bind id="section-1-bind" name="section-1"
ref="section-1">
<xf:bind id="result1-bind" ref="result1" name="result1"

calculate="xxf:get-request-header('myheader')"/>
<xf:bind id="result2-bind" ref="result2"
name="result2"/>
</xf:bind>
</xf:bind>


<xf:instance xxf:readonly="true" id="fr-form-metadata"
xxf:exclude-result-prefixes="#all">
<metadata>
<application-name>test2</application-name>
<form-name>test2</form-name>
<title xml:lang="en">Untitled Form</title>
<description xml:lang="en"/>
</metadata>
</xf:instance>


<xf:instance id="fr-form-attachments"
xxf:exclude-result-prefixes="#all">
<attachments>
<css mediatype="text/css" filename="" size=""/>
<pdf mediatype="application/pdf" filename="" size=""/>
</attachments>
</xf:instance>


<xf:instance xxf:readonly="true" id="fr-form-resources"
xxf:exclude-result-prefixes="#all">
<resources>
<resource xml:lang="en">
<section-1>
<label>Untitled Section</label>
</section-1>
<result1>
<label>Result 1</label>
<hint/>
</result1>
<result2>
<label>Result 2</label>
<hint/>
</result2>
</resource>
</resources>
</xf:instance>


<xf:instance id="fr-service-request-instance"
xxf:exclude-result-prefixes="#all">
<request/>
</xf:instance>
<xf:instance id="fr-service-response-instance"
xxf:exclude-result-prefixes="#all">
<response/>
</xf:instance>
<xf:action event="xforms-model-construct">
<xf:setvalue
ref="instance('fr-form-instance')/section-1/result2"
value="xxf:get-request-header('myheader')"/>
</xf:action>
</xf:model>
</xh:head>
<xh:body>
<fr:view>
<fr:body xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:oxf="http://www.orbeon.com/oxf/processors">
<fr:section id="section-1-control" bind="section-1-bind">
<xf:label ref="$form-resources/section-1/label"/>
<fr:grid>
<xh:tr>
<xh:td>
<xf:output id="result1-control"
bind="result1-bind">
<xf:label
ref="$form-resources/result1/label"/>
<xf:hint
ref="$form-resources/result1/hint"/>
<xf:alert
ref="$fr-resources/detail/labels/alert"/>
</xf:output>
</xh:td>
<xh:td>
<xf:output id="result2-control"
bind="result2-bind">
<xf:label
ref="$form-resources/result2/label"/>
<xf:hint
ref="$form-resources/result2/hint"/>
<xf:alert
ref="$fr-resources/detail/labels/alert"/>
</xf:output>
</xh:td>
</xh:tr>
</fr:grid>
</fr:section>
</fr:body>
</fr:view>
</xh:body>
</xh:html>

Erik Bruchez

unread,
Dec 3, 2019, 7:34:50 PM12/3/19
to orb...@googlegroups.com
> It's another Orbeon form within Liferay

The reason I was asking os that that URL doesn't look like a Form Runner URL
or a Liferay URL.

Can you reach that URL "by hand" from your browser? What does it return?

-Erik

Ruben Garay

unread,
Dec 4, 2019, 10:31:08 AM12/4/19
to orb...@googlegroups.com
Erik, this is form A, where the header is sent. The action is triggered from
the button:

<http://discuss.orbeon.com/file/t375629/Captura1.png>

When clicking, the button redirects to test2 and sends the header:

<http://discuss.orbeon.com/file/t375629/Captura2.png>

In the test2 form, this is where I try to catch the header in the result1
and result2 controls but I can't. In the log I can see that if it is sent:

<http://discuss.orbeon.com/file/t375629/Captura3.png>

Erik Bruchez

unread,
Dec 4, 2019, 2:07:04 PM12/4/19
to orb...@googlegroups.com
Thanks for the clarification.

The proxy portlet doesn't support receiving POSTs at at this point (except
the internal Ajax and upload POSTs). Header forwarding should work if you
use a GET, however.

-Erik
Reply all
Reply to author
Forward
0 new messages