Trying to get the xforms-models.xpl pipeline to work...

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

Trying to get the xforms-models.xpl pipeline to work...

pfennell
I’m interested in being able to send an XHTML page containing XForms, with in-line instance data, to Orbeon so that it will be processed server-side, applying calculations, constraints, etc, and the updated instance data returned to the client. I found the xforms-models.xpl pipeline, dating back to 2009, and thought that this might be of help. Unfortunately, I’m having trouble running the pipeline in a modern instance of Orbeon. I have set-up a page-flow that calls the pipeline and I’m currently experimenting with just the first step of the pipeline that appears to extract the models and instances from the input form. The problem I’m getting is that Orbeon is complaining about the function call:
context:encodeXML($static-state)
The error in the logs is:
 Error at line 79 of oxf:/apps/sandbox/xforms-models-test.xpl:                                                         |
|XPath syntax error at char 32 on line 79 in {context:enc                                                              |
|odeXML($static-stat...}:                                                                                              |
|    Cannot find a matching 1-argument function named {java:org.orbeon.oxf.pipeline.StaticExte                         |
|rnalContext}encodeXML()                                                                                               |
|Error at line 97 of oxf:/apps/sandbox/xforms-models-test.xpl:                                                         |
|XPath syntax error at char 33 on                                                                                      |
| line 97 in {context:encodeXML($dynamic-sta...}:                                                                      |
|    Cannot find a matching 1-argument function named {java:org.orbeon                                                 |
|.oxf.pipeline.StaticExternalContext}encodeXML()
In other tests it also complained about:
context:decodeXML(normalize-space(xxforms:event-response/xxforms:dynamic-state))
Am I right in assuming that things have changed internally since 2009 and that aspects of this pipeline need to be rewritten to reflect Orbeon’s current APIs and internals? If so, I’d really appreciate some pointers as to how and where to start. Regards Philip
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get the xforms-models.xpl pipeline to work...

pfennell
Further to my previous e-mail I have made some more investigations and found that there must have been some changes to the forms-server-request.rng schema because the structure of the
xxforms:event-request
 document being assembled in the first XSLT transform is no longer valid. I have made suitable corrections but the big issue is the fact that the
java:org.orbeon.oxf.pipeline.StaticExternalContext.encodeXML
 method no longer exists. I tried an, albeit in vain, test the see if
java:org.orbeon.oxf.xforms.XFormsUtils.encodeXML
 method would do the job but I just receive a NULL Pointer exception.

Any comments or thoughts would be much appreciated.


Regards

Philip
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get the xforms-models.xpl pipeline to work...

Erik Bruchez
Administrator
Philip,

It's tricky to get right! We should have some standard support for this, along the lines of:

    https://github.com/orbeon/orbeon-forms/issues/1357

This said the `encode-xml()` function can be called with:

    xpl:encodeXML($server-events)

where:

    xmlns:xpl="java:org.orbeon.oxf.pipeline.api.FunctionLibrary"

Note that this is an internal function.

There are somes uses here:

    https://github.com/orbeon/orbeon-forms/blob/master/src/test/resources/org/orbeon/oxf/xforms/tests-xforms-ajax.xml

I hope this helps!

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

Re: Trying to get the xforms-models.xpl pipeline to work...

pfennell

Hello Erik,

 

I tried this out and:

 

    xpl:encodeXML($server-events)

 

works in my pipeline.

 

The only issue I have now is that after running the result of the encoding transform into the oxf:xforms-server step I get the following response:

 

<error>

    <title>Session has expired. Unable to process incoming request.</title>

</error>

 

It doesn’t seem to matter which serialiser/convert I use I always get the same error which suggests that the problem is in the oxf:xforms-server step.

 

I have attached the pipeline, submitted instance and pageflow. I have been using Postman to test this, I’ve attached its collection. They’re all in the ZIP.

 

 

Regards

 

Philip

 

 

 

 

From: "Erik Bruchez [via Orbeon Forms community mailing list]" <ml-node+[hidden email]>
Date: Monday, 10 October 2016 20:06
To: Philip Fennell <[hidden email]>
Subject: Re: Trying to get the xforms-models.xpl pipeline to work...

 

Philip,

It's tricky to get right! We should have some standard support for this, along the lines of:

    https://github.com/orbeon/orbeon-forms/issues/1357

This said the `encode-xml()` function can be called with:

    xpl:encodeXML($server-events)

where:

    xmlns:xpl="java:org.orbeon.oxf.pipeline.api.FunctionLibrary"

Note that this is an internal function.

There are somes uses here:

    https://github.com/orbeon/orbeon-forms/blob/master/src/test/resources/org/orbeon/oxf/xforms/tests-xforms-ajax.xml

I hope this helps!

-Erik


If you reply to this email, your message will be added to the discussion below:

http://discuss.orbeon.com/Trying-to-get-the-xforms-models-xpl-pipeline-to-work-tp4661836p4661847.html

To unsubscribe from Trying to get the xforms-models.xpl pipeline to work..., click here.
NAML


sandbox.zip (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get the xforms-models.xpl pipeline to work...

Erik Bruchez
Administrator
Philip,

I don't want you to think that I forgot about this, but I haven't yet managed to look at it yet. I will do my best to look at this early the coming week.

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

Re: Trying to get the xforms-models.xpl pipeline to work...

Erik Bruchez
Administrator
Philip,

I hope this is still useful, but here is a simple example:

    https://gist.github.com/ebruchez/71968da1af24186b99c68a0de51a3604

The service:

- preprocesses the incoming XHTML to add a custom model
- the custom model, upon xforms-ready, submits the first instance to the output

There is no need to encode/decode XML as the older pipelines were showing.

I hope this helps!

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

Re: Trying to get the xforms-models.xpl pipeline to work...

pfennell

Hello Erik,

 

I just got around to trying this and it works reeeeal sweet, thanks very much :-)

 

 

Philip

 

From: "Erik Bruchez [via Orbeon Forms community mailing list]" <ml-node+[hidden email]>
Date: Friday, 4 November 2016 00:05
To: Philip Fennell <[hidden email]>
Subject: Re: Trying to get the xforms-models.xpl pipeline to work...

 

Philip,

I hope this is still useful, but here is a simple example:

    https://gist.github.com/ebruchez/71968da1af24186b99c68a0de51a3604

The service:

- preprocesses the incoming XHTML to add a custom model
- the custom model, upon xforms-ready, submits the first instance to the output

There is no need to encode/decode XML as the older pipelines were showing.

I hope this helps!

-Erik


If you reply to this email, your message will be added to the discussion below:

http://discuss.orbeon.com/Trying-to-get-the-xforms-models-xpl-pipeline-to-work-tp4661836p4661928.html

To unsubscribe from Trying to get the xforms-models.xpl pipeline to work..., click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Trying to get the xforms-models.xpl pipeline to work...

Erik Bruchez
Administrator
Philip,

Excellent, thanks for confirming!

-Erik