add submit button posting to external REST service

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

add submit button posting to external REST service

samoo
Hi there,

I want to add a Send button that posts the form data to an external REST service running on the same machine. my properties-local.xml is as following, but I'm getting 404 HTTP error code, and  by looking at the orbeon logs, it seems the 'send' process is not picking the URL defined in my local property,,, any help plz?!!

<property as="xs:string" name="oxf.fr.detail.buttons.TestApp.WelcomeForm" value="save-draft send"/>

<property as="xs:string" name="oxf.fr.detail.process.send.TestApp.WelcomeForm" value="require-valid
then send("http://localhost:8080/SpringMVC/coffee/createasstring")
then navigate("/success")
recover navigate("/failure")"/>

the logs:
opening URL connection {method: "POST", URL: "http://localhost:8080/orbeon/fr/TestApp/WelcomeForm/", Content-Type: "application/xml", Cookie: "JSESSIONID=89BCC8B664861ACC5DF3D7FA59D051DA", Orbeon-Token: "2876c337c7959376faa320dbd0115157c9cc1f85"}
2014-11-27 19:23:58,610 DEBUG XFormsServer - response {status code: "404"}
Reply | Threaded
Open this post in threaded view
|

Re: add submit button posting to external REST service

samoo
I'm using Orbeon 4.7 PE, and my form is running on the form runner. We would like to create the forms using the form builder and run them on the form runner but the submission should go to our backend REST services. Is this possible with orbeon?
Reply | Threaded
Open this post in threaded view
|

Re: add submit button posting to external REST service

samoo
In reply to this post by samoo
I fixed it    the following property will do the job:

<property as="xs:string" name="oxf.fr.detail.send.success.uri.TestApp.WelcomeForm" value="http://localhost:8080/SpringMVC/coffee/createasstring"/>
Reply | Threaded
Open this post in threaded view
|

Re: add submit button posting to external REST service

samoo
so my properties-local.xml looks like this (for whoever have the same requirement as mine):



<property as="xs:string" name="oxf.fr.detail.send.success.uri.TestApp.WelcomeForm" value="http://localhost:8080/SpringMVC/coffee/createasstring"/>
                        <property
                                        as="xs:string"
                                        name="oxf.fr.detail.buttons.TestApp.WelcomeForm"
                                        value="save-draft send"/>
 
 
                         <property as="xs:string" name="oxf.fr.detail.process.send.TestApp.WelcomeForm">
                                require-uploads
                                        then validate-all
                                        then send("oxf.fr.detail.send.success")
                        </property>
Reply | Threaded
Open this post in threaded view
|

Re: add submit button posting to external REST service

Erik Bruchez
Administrator
Glad you fixed it. A possible issue in your original process might have been due to quoting of string. Putting the value inline might help:

<property as="xs:string" name="oxf.fr.detail.process.send.TestApp.WelcomeForm">
    require-valid
    then send("http://localhost:8080/SpringMVC/coffee/createasstring")
    then navigate("/success")
    recover navigate("/failure")
</property>

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: add submit button posting to external REST service

samoo
Thanks Erik :)

On Fri, Nov 28, 2014 at 8:30 PM, Erik Bruchez [via Orbeon Forms community mailing list] <[hidden email]> wrote:
Glad you fixed it. A possible issue in your original process might have been due to quoting of string. Putting the value inline might help:

<property as="xs:string" name="oxf.fr.detail.process.send.TestApp.WelcomeForm">
    require-valid
    then send("http://localhost:8080/SpringMVC/coffee/createasstring")
    then navigate("/success")
    recover navigate("/failure")
</property>

-Erik


If you reply to this email, your message will be added to the discussion below:
http://discuss.orbeon.com/add-submit-button-posting-to-external-REST-service-tp4659292p4659298.html
To unsubscribe from add submit button posting to external REST service, click here.
NAML