Hello,
I noticed this question has been posted multiple times before, but since it's been some years I want to check if there are at least workarounds now. I'm using the latest version of Orbeon (2017.2) and it's deployed in it's own http server (tomcat), and the application that embeds the forms is at a different url/port. I want the embedding application to deal with data storage and processing and so I defined this in properties-local-prod.xml <property as="xs:string" name="oxf.fr.detail.process.send.orbeon.test-form"> send(uri = "http://localhost/localPoint", method="POST", data-format-version="xml", prune="false") then navigate("/success") recover navigate("/failure") </property> And this works - my application receives the xml data and is free to process it. The problem is that there could be multiple applications that use the same form deployed at different urls. Is there any way to make Orbeon send the data to a relative URL (like "/localPoint"), the same way it's done with navigate ? -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
I am not sure to follow: you're saying that you'd like `send(uri = "/localPoint")` to make a query to `http://localhost/localPoint`, but then what would the downside of using `http://localhost/localPoint` instead of `/localPoint` in the `send()`? Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alessandro,
I am running everything locally just as a proof of concept. Let's assume there are two instances of the same web server, each with their own domain - http://foo-dev.com and http://foo-qa.com and the Orbeon instance is deployed at http://bar.com Both my applications will embed the same form but the send action can be configured to send the data to only one server. `send()` with a relative URL would send the data to the embedding application, rather than a hardcoded URL. -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
In reply to this post by Alessandro Vernet
Alessandro,
As per this ticket - http://discuss.orbeon.com/relative-URL-with-POST-td45314.html I tried defining a new `xf:submission` node in my form with <xf:submission id="submit-relative-url" method="post" validate="false" nonrelevant="keep" resource="/localPoint" replace="none"/> under <xf:model> tag and under <fr:body> I added this <xf:submit submission="submit-relative-url"> <xf:label>Submit to relative URL</xf:label> </xf:submit> When I press the submit button nothing happens and this line is logged in orbeon.log ERROR XFormsServer - xforms-submit-error - xf:submission for submission id: submit-relative-url, error code received when submitting instance: 404 If I put in the entire URL it works. I should mention the web server that processes form data is running at port 80 and the Orbeon server is running at port 8081. -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
Got it, and thank you for the additional information. If you're using an `<xf:submission>`, you can use `f:url-norewrite="true"`. You can find more about this on: https://doc.orbeon.com/xforms/submission-extensions.html#context-resolution You'll let me know if this works for you. Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
I tried your solution by adding xmlns:f="http://orbeon.org/oxf/xml/formatting" schema and modifying submission as such <xf:submission id="submit-relative-url" method="post" validate="false" nonrelevant="keep" resource="/localPoint" replace="none" f:url-norewrite="true"/> and I get the same issue as without the attribute with the same log error. The documentation says the attribute allows resolving resources from other web applications in the same servlet container, but I'm using 2 different servlet containers for my setup. Is there anything else I can try ? Thank you, Catalin -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
Got it, and I am not surprised that this is the way it is working. Keep in mind that your submission is made by Orbeon Forms, not the browser. If you have a single instance of Orbeon Forms and you need it to make queries to different servers depending on the situation, you could make this more explicit by having your reserve proxy (either the dev proxy or qa proxy) set a header containing the host name to use, and in your `xf:submission` use `resource="http://{xxf:get-request-header('service-host')}/localPoint"`. Would something along those lines work for you? Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
That sounds like a great idea. I've been having trouble using it locally though. No matter what header key I put in it results in an empty string. I tried using this function in 2 different places: 1. In properties-local-prod.xml I added xmlns:xxf="http://orbeon.org/oxf/xml/xforms" namespace and <property as="xs:string" name="oxf.fr.detail.process.send.orbeon.test-form"> send(uri = "http://{xxf:get-request-header('origin')}/localPoint", method="POST", data-format-version="xml", prune="false") then navigate("/success") recover navigate("/failure") </property> And I get this line in logs ERROR XFormsServer - xforms-submit-error - URI does not specify a valid host name: http:///localPoint?document=6be3f149f1878053609301c4eef4f9b64e2d9512&process=5f3a0cb9ed4c6c8449cf05f622ac9672c49a466d&data-format-version=xml&language=en&valid=true&app=orbeon&form-version=1&form=test-form 2. xf:submission in form source <xf:submission id="submit-relative-url" method="post" validate="false" nonrelevant="keep" resource="http://{xxf:get-request-header('Origin')}/localPoint" replace="none" f:url-norewrite="true"/> And I get this in the logs ERROR XFormsServer - xforms-submit-error - URI does not specify a valid host name: http:///localPoint I should mention I tried to get multiple common header values, including content-length, user-agent - both uppercase and lower case and the error messages are always the same. I also tried with a custom header value (added by filter on every request), same results. -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
Indeed, it sounds like `xxf:get-request-header('origin')` doesn't return anything, in your case. Are you indeed setting that header? How are you setting it? Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
I defined a new custom filter in the application that sets the custom header to response and then chains filters. It is mapped to all URLs ("/*"). To validate it I used browser's Network tab (Chrome) to capture requests and surely there's always a single POST request to http://localhost/orbeon/o0/xforms-server and the custom header is set whenever I click on the custom submit. What concerns me is that `xxf:get-request-header()` doesn't retrieve header values that are always set by Java or the browser (eg. Content-Length or Origin). If it would, the error message in the log should be different. Does it not allow getting the value for certain headers ? Catalin -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
So I understand you're using a servlet filter to set the header. Are you also setting the headers when the page with the form is loaded (not just for the Ajax request)? I am asking because those will be the headers that will be forwarded, not the headers Orbeon Forms received with the Ajax request. If you're setting the headers when the form is loaded and it still isn't working, could you instead try setting them in Chrome with the ModHeader extension? The idea of this test would be exclude a problem with your filter. https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
I set the headers with ModHeader extension and still get the same issue. Is there anything else I could try ? Catalin -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
I tried to reproduce this doing what follows: 1. Install verbatim 2017.2. 2. Put the `properties-local.xml` attached below. 3. Create a form in Form Builder, publish it. 4. In ModHeader, set the header `My-Header` to `42`. 5. Open the `/new` page, hit send. In the result, I can see the server report it got the request parameter with value 42, which comes from the header, as set in `properties-local.xml`. If you try this, are you seeing something different? properties-local.xml <http://discuss.orbeon.com/file/t119778/properties-local.xml> Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
With the steps provided by you and executing the submit action directly *from the form runner* it works as expected. I can see the header value in args field and in the url request parameter. What's more, with the following config <property as="xs:string" name="oxf.fr.detail.process.send.*.*"> send( uri = "{xxf:get-request-header('domain-origin')}", method = "post", replace="all" ) </property> and domain-origin value with ModHeader set to "http://localhost:80/localPoint", the POST request is made successfully to the endpoint. This also works with xf:submission. The problem is when trying to submit from the form embedded in my application. With "replace=all" instead of "replace=none" this time I get different errors in orbeon.log: 2018-02-26 17:15:24,027 ERROR ProcessorImpl - Invalid reference to captcha component `` 2018-02-26 17:15:24,064 WARN XFormsServer - instance() - instance not found {instance id: "fr-create-update-submission-response"} 2018-02-26 17:15:24,079 WARN XFormsServer - xxf:instance() - instance not found {instance id: "fr-form-attachments"} 2018-02-26 17:15:24,127 WARN XFormsServer - instance() - instance not found {instance id: "fr-create-update-submission-response"} 2018-02-26 17:15:24,132 INFO lifecycle - event: {"request": "97", "session": "0CE5CDAAC8C4AC6526392B5DF39910B9", "source": "xforms", "message": "new form session", "uuid": "617839091376d1eba55d4effa53a20e0acf696f3"} 2018-02-26 17:15:24,144 ERROR XFormsServer - xf:message - Process failed with error for property: `oxf.fr.detail.process.before-data.foreground.new` 2018-02-26 17:15:24,152 ERROR XFormsServer - xf:message - Process failed with error for property: `oxf.fr.detail.process.after-data.foreground.new` After I click on send I am also redirected to "http://localhost/orbeon//xforms-server-submit" - with error 404 because it's not where Orbeon server is at. -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
Thank you for trying this out. So it seems that embedding is part of the problem, and why you might not be able to read the value of this header with `xxf:get-request-header()`. What are you using to embed a form into your own app? Are you using the Java Embedding API, or something else? https://doc.orbeon.com/form-runner/link-embed/java-api.html Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hi Alex,
Yes, I am using the Java embedding API - the API.embedFormJava() method to be exact. Catalin -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
Got it, then I think you'll need to pass that header explicitly in the last parameter to `API.embedFormJava()`. You'll let me know if this works for you. https://doc.orbeon.com/form-runner/link-embed/java-api.html Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hello Alex,
This solution works great. I just had to set replace="none" because with it set to "all" I would get redirected to a URL that gives error 404. Thank you, Catalin -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email]. |
Administrator
|
Hi Catalin,
Yes, indeed, with the embedding API, `replace="all"` isn't supported yet (as mentioned in the "Limitations" section; see below). And I'm glad this works for you! https://doc.orbeon.com/form-runner/link-embed/java-api.html#limitations Alex ----- -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- Sent from: http://discuss.orbeon.com/ -- 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 [hidden email]. To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |