Separate deployment and GWT client

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

Separate deployment and GWT client

Nobry
Hello,

I've been searching for a while but I'm stuck on this:

I'd like to generate an xform, possibly in xhtml if needed, from a GWT client and get it rendered by Orbeon.
According to the wiki documentation I can pass the generated xhtml/xform document as a POST attribute and get back the transformed document.

I'm in the separate deployment mode and so far the forwarding seem to work since I can request a regular form in form-runner.
e.g.: http://my-tomcat.com/my-app/orbeon/fr/orbeon/some_formrunner_form (unless I misunderstood the forwarding role).

But then I'm stuck here, I don't know where to send the POST request and data.
I tried at 'my-app/orbeon' but nothing happens, at 'my-app/orbeon/xforms-renderer' I only get an xml with '<null xsi:nil="true"/>'

Did I read or did something wrong? Or am I missing something?
Reply | Threaded
Open this post in threaded view
|

Re: Separate deployment and GWT client

Erik Bruchez
Administrator
Hi,

The forwarding mentioned in the doc specifically refers to a mechanism
of Java servlets: one web app forwards content to another web app (the
Orbeon Forms web app).

Now if you want to to an HTTP POST from a client, you could try to
POST to /xforms-renderer.

-Erik

On Wed, May 25, 2011 at 1:21 PM, Nobry <[hidden email]> wrote:

> Hello,
>
> I've been searching for a while but I'm stuck on this:
>
> I'd like to generate an xform, possibly in xhtml if needed, from a GWT
> client and get it rendered by Orbeon.
> According to
> http://wiki.orbeon.com/forms/doc/developer-guide/xforms-with-java-applications#TOC-Passing-XHTML-and-XForms-as-a-reque
> the wiki documentation  I can pass the generated xhtml/xform document as a
> POST attribute and get back the transformed document.
>
> I'm in the separate deployment mode and so far the forwarding seem to work
> since I can request a regular form in form-runner.
> e.g.: http://my-tomcat.com/my-app/orbeon/fr/orbeon/some_formrunner_form
> (unless I misunderstood the forwarding role).
>
> But then I'm stuck here, I don't know where to send the POST request and
> data.
> I tried at 'my-app/orbeon' but nothing happens, at
> 'my-app/orbeon/xforms-renderer' I only get an xml with '<null
> xsi:nil="true"/>'
>
> Did I read or did something wrong? Or am I missing something?
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Separate-deployment-and-GWT-client-tp3550902p3550902.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Separate deployment and GWT client

Nobry
Hi Erik,

I already sent things to the "/xforms-renderer" path but only received a "xsi:nil=true" answer, but maybe I've sent the wrong parameter, some malformed page/xform or do I need specific credential to get my page rendered?

What I sent in the POST:
oxf.xforms.renderer.document=<xhtml xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms"><head><title>Hello World in XForms</title><xf:model><xf:instance xmlns=""><data><PersonGivenName/></data></xf:instance></xf:model></head><body><p>Type your first name in the input box. <br />If you are running XForms, the output should be displayed in the output area.</p><xf:input ref="PersonGivenName" incremental="true"><xf:label>Please enter your first name: </xf:label></xf:input><br /><xf:output value="concat('Hello ', PersonGivenName, '. We hope you like XForms!')"><xf:label>Output: </xf:label></xf:output></body></xhtml>

What I received in the answer:
<?xml version="1.0" encoding="utf-8"?><null xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
Reply | Threaded
Open this post in threaded view
|

Re: Re: Separate deployment and GWT client

Erik Bruchez
Administrator
Actually I looked at the code of the renderer, and it doesn't support
a POST: it only supports setting a request property,
oxf.xforms.renderer.document, which must be done on the server side.

You could easily modify this to support a POST though. Keep in mind
that it might be unsafe to allow POSTing random XForms from untrusted
sources.

Here is the code that runs when hitting /xforms-renderer:

https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/ops/xforms/xforms-renderer.xpl

-Erik

On Tue, May 31, 2011 at 9:22 AM, Nobry <[hidden email]> wrote:

> Hi Erik,
>
> I already sent things to the "/xforms-renderer" path but only received a
> "xsi:nil=true" answer, but maybe I've sent the wrong parameter, some
> malformed page/xform or do I need specific credential to get my page
> rendered?
>
> What I sent in the POST:
> oxf.xforms.renderer.document=<xhtml xmlns="http://www.w3.org/1999/xhtml"
> xmlns:xf="http://www.w3.org/2002/xforms"><head><title>Hello World in
> XForms</title><xf:model><xf:instance
> xmlns=""><data><PersonGivenName/></data></xf:instance></xf:model></head><body><p>Type
> your first name in the input box. <br />If you are running XForms, the
> output should be displayed in the output area.</p><xf:input
> ref="PersonGivenName" incremental="true"><xf:label>Please enter your first
> name: </xf:label></xf:input><br /><xf:output value="concat('Hello ',
> PersonGivenName, '. We hope you like XForms!')"><xf:label>Output:
> </xf:label></xf:output></body></xhtml>
>
> What I received in the answer:
> <?xml version="1.0" encoding="utf-8"?><null
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Separate-deployment-and-GWT-client-tp3550902p3563602.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Separate deployment and GWT client

Nobry
Thanks for the reply,

I've checked the xpl file you showed as well as the orbeon-forms-filter java code to replace things in context.

If I read things correctly, the filter "simply" does add some needed attributes to a request and transparently forward the original client request to /xforms-renderer.
Now the possible client requests are GET, POST, PUT. So the renderer code can process those.

I've checked it with a curl command and tried a PUT on the location and it would indeed return me an error "PUT not supported" while the GET and POST would give me a "xml:nil" answer.

I also tried writing a servlet that talk to the renderer so that everything is on the server side, and kind of mimicking a jsp/php script, but I still have the same nil output.

Now in the xpl file, there is in a few places the "xml:nil" declaration so I think the information I'm sending to this address doesn't have the right format, but I'm at loss at what I should send.

Also, I'm well aware of the security implications, but it is quite possible to restrict any access to Orbeon with a firewall accepting a limited number of IP address.


Nobry
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Separate deployment and GWT client

Erik Bruchez
Administrator
Nobry,

Whatever the servlet filter does, you should be able to do on the server-side.

The format of the document is just a regular XHTML+XForms document.

-Erik

On Tue, Jun 14, 2011 at 11:27 AM, Nobry <[hidden email]> wrote:

> Thanks for the reply,
>
> I've checked the xpl file you showed as well as the orbeon-forms-filter java
> code to replace things in context.
>
> If I read things correctly, the filter "simply" does add some needed
> attributes to a request and transparently forward the original client
> request to /xforms-renderer.
> Now the possible client requests are GET, POST, PUT. So the renderer code
> can process those.
>
> I've checked it with a curl command and tried a PUT on the location and it
> would indeed return me an error "PUT not supported" while the GET and POST
> would give me a "xml:nil" answer.
>
> I also tried writing a servlet that talk to the renderer so that everything
> is on the server side, and kind of mimicking a jsp/php script, but I still
> have the same nil output.
>
> Now in the xpl file, there is in a few places the "xml:nil" declaration so I
> think the information I'm sending to this address doesn't have the right
> format, but I'm at loss at what I should send.
>
> Also, I'm well aware of the security implications, but it is quite possible
> to restrict any access to Orbeon with a firewall accepting a limited number
> of IP address.
>
>
> Nobry
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Separate-deployment-and-GWT-client-tp3550902p3597382.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Separate deployment and GWT client

Nobry
Just posting as a closure.

I finally made it work, my problem was with setAttribute with the request, and creating another connection and using setParameter.
The second method would always send me a nil xml file.

So thanks Erik, I can move forward now.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Separate deployment and GWT client

Erik Bruchez
Administrator
Great to hear that you solved it! -Erik

On Tue, Jun 21, 2011 at 9:31 AM, Nobry <[hidden email]> wrote:

> Just posting as a closure.
>
> I finally made it work, my problem was with setAttribute with the request,
> and creating another connection and using setParameter.
> The second method would always send me a nil xml file.
>
> So thanks Erik, I can move forward now.
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Separate-deployment-and-GWT-client-tp3550902p3614647.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws