From java servlet to orbeon context

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

From java servlet to orbeon context

Bart Ottenkamp
Hai all,

I'm looking for is a way to get a hold on a model instance (an xml instance) in a 'normal' servlet living in the same container as my orbeon processors. I think I should be able to derive it using the sessionid from the request to my servlet I think?
Does anybody know how I'll do that?
I think I should start with getting the orbeon context?

So, in my xhtml file I have this instance:

            <xforms:instance id = "form-instance">
                <form name = "AAAAA">
                    <formcontent>
........
     </formcontent>
   </form>
</forms:instance>

which is the instance that holds my form data and for which the state is kept on the server.

And tus, the question is how I can get a hold on this instance in a servlet...

Best regards,
Bart Ottenkamp


 



--
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: From java servlet to orbeon context

Alessandro Vernet
Administrator
Bart,

bartottenkamp wrote
I'm looking for is a way to get a hold on a model instance (an xml instance)
in a 'normal' servlet living in the same container as my orbeon processors.
I think I should be able to derive it using the sessionid from the request
to my servlet I think?
Does anybody know how I'll do that?
I think I should start with getting the orbeon context?

So, in my xhtml file I have this instance:

            <xforms:instance id = "form-instance">
                <form name = "AAAAA">
                    <formcontent>
........
     </formcontent>
   </form>
</forms:instance>

which is the instance that holds my form data and for which the state is
kept on the server.
If you'd like to access in your servlet to an instance with the data entered by the user in an XForms form, then you need to submit the instance from XForms to your servlet with an <xforms:submission>. Here your servlet living in the same web app doesn't really make a difference. I hope this helps,

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: From java servlet to orbeon context

Bart Ottenkamp
Hello Alex,

thank you very much for replying this fast.
Never thought of that! Thanks for this, because this is exactly what I want; get the power of the xforms/submission (filtering al irrelevant nodes) and still end up in my own servlet and start doing my own things...

Since you answereed me this quick though, here comes the next one.... :-):
To go short (cutting come corners), this is what I want:
I have my own java code to generate PDF documents (all generic, using IText and FOP, creatng Pdf document for all kinds of forms). Now, what I want is to be able to click on a link in an xforms form to generate this PDF (thus basically activate my 'Pdf code, but that is the easy part...), present it and NOT LOOSE the information filled in in the form by the user. The user should be presented a pdf and if hitting the back button, the form should be presented as it was before...
Of course I tried a couple of things, starting with simply putting the generated pdf on the outputstream of a response from a servlet.. and this worked, also with hiitting the back button, but I was working in FireFox 3 or IE 8... working with IE 7 or earlyer and hitting the back button gets me back to the page BEFORE the xform I opened..! And I loose all information on the screen when hiiting the forward button...

Well, I guess my question is, do you know of this problem or don't you know the proble but do you know a way to present a pdf to the user and not loose data when hitting back and forward buttons...

To be even more preciseI I seem to not be able to present the user of an xforms form a pdf presentation of what her or she filled in whithout loosing the ability to go back to the form, change something and see again...

Can you help?

Best regards,
Bart
 

On Thu, Jul 16, 2009 at 9:51 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> I'm looking for is a way to get a hold on a model instance (an xml
> instance)
> in a 'normal' servlet living in the same container as my orbeon
> processors.
> I think I should be able to derive it using the sessionid from the request
> to my servlet I think?
> Does anybody know how I'll do that?
> I think I should start with getting the orbeon context?
>
> So, in my xhtml file I have this instance:
>
>             <xforms:instance id = "form-instance">
>                 <form name = "AAAAA">
>                     <formcontent>
> ........
>      </formcontent>
>    </form>
> </forms:instance>
>
> which is the instance that holds my form data and for which the state is
> kept on the server.
>

If you'd like to access in your servlet to an instance with the data entered
by the user in an XForms form, then you need to submit the instance from
XForms to your servlet with an <xforms:submission>. Here your servlet living
in the same web app doesn't really make a difference. I hope this helps,

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24511946.html
Sent from the ObjectWeb 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: From java servlet to orbeon context

Alessandro Vernet
Administrator
Bart,

bartottenkamp wrote
Since you answereed me this quick though, here comes the next one.... :-):
To go short (cutting come corners), this is what I want:
I have my own java code to generate PDF documents (all generic, using IText
and FOP, creatng Pdf document for all kinds of forms). Now, what I want is
to be able to click on a link in an xforms form to generate this PDF (thus
basically activate my 'Pdf code, but that is the easy part...), present it
and NOT LOOSE the information filled in in the form by the user. The user
should be presented a pdf and if hitting the back button, the form should be
presented as it was before...
Of course I tried a couple of things, starting with simply putting the
generated pdf on the outputstream of a response from a servlet.. and this
worked, also with hiitting the back button, but I was working in FireFox 3
or IE 8... working with IE 7 or earlyer and hitting the back button gets me
back to the page BEFORE the xform I opened..! And I loose all information on
the screen when hiiting the forward button...
One way is to open the PDF in an new window. If you do this with an <xforms:submission replace="all"/>, add an xxforms:target="_blank" attribute.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
Hai Alex,

thanks again. This indeed seems to solve the loosing of data in the form thing. And if you say this is the way, then I'll do it this way. Thanks. Now I only have to figure out how my customers handle popup blocking..

But.... here comes the next thing to figure out:
Now I also want to add a link to mail the PDF (as an attachment). With that functionallity I want the form to stay the same, meaning on the same case of a switch for instance, and I want a message on the screen with the result of the mail process....

I can get this behaviour with:

<xforms:setvalue value = "xxforms:call-xpl('oxf:/apps/e-formulieren/forms/xpl/mail.xpl', 'data', instance('form-instance')/formcontent, 'data')" ref = "instance('result-instance')/success"/>

But, this will submit the complete node 'instance('form-instance')/formcontent' instead of only the relevant parts in this tree (specified in the bindings). In other words, I loose the orbeon submit functionallity.

So, how to solve this?
I thought of:
- trying to call some orbeon functionallity in my own java code to turn the complete node into a stripped one that only has the relevant nodes.. You do this somewhere in orbeon code, don't you? Can I call this code? Since I have the context available?
- Using <xforms:submission anyway with replace="instance" and instance="result"...

I guess (hope) the latter is possible, but I get the message:
"XFormsServer  - XForms - submission - instance replacement did not take place upon successful response because no body was provided. Submission: mail-submission"

these are parts from my form:
            <xforms:instance id = "result-instance">
                <root>
                    <result/>
                    <failure/>
                    <success/>
                </root>
            </xforms:instance>
and
            <xforms:submission
                id = "mail-submission"
                ref = "instance('form-instance')/formcontent"
                xxforms:show-progress = "false"
                method = "post"
                action = "/e-formulieren/mail"
replace="instance"
instance="result-instance">
            </xforms:submission>

and in code I return a Document of form
<root>
                    <result/>
</root>

Can you help (again)?


On Fri, Jul 17, 2009 at 1:43 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> Since you answereed me this quick though, here comes the next one.... :-):
> To go short (cutting come corners), this is what I want:
> I have my own java code to generate PDF documents (all generic, using
> IText
> and FOP, creatng Pdf document for all kinds of forms). Now, what I want is
> to be able to click on a link in an xforms form to generate this PDF (thus
> basically activate my 'Pdf code, but that is the easy part...), present it
> and NOT LOOSE the information filled in in the form by the user. The user
> should be presented a pdf and if hitting the back button, the form should
> be
> presented as it was before...
> Of course I tried a couple of things, starting with simply putting the
> generated pdf on the outputstream of a response from a servlet.. and this
> worked, also with hiitting the back button, but I was working in FireFox 3
> or IE 8... working with IE 7 or earlyer and hitting the back button gets
> me
> back to the page BEFORE the xform I opened..! And I loose all information
> on
> the screen when hiiting the forward button...
>

One way is to open the PDF in an new window. If you do this with an
<xforms:submission replace="all"/>, add an xxforms:target="_blank"
attribute.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24526328.html
Sent from the ObjectWeb 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: From java servlet to orbeon context

Alessandro Vernet
Administrator
Hi Bart,

<quote author="bartottenkamp">
I thought of:
- trying to call some orbeon functionallity in my own java code to turn the
complete node into a stripped one that only has the relevant nodes.. You do
this somewhere in orbeon code, don't you? Can I call this code? Since I have
the context available?
- Using <xforms:submission anyway with replace="instance" and
instance="result"...
</quote>

I would do the latter. (In fact, I often prefer the latter to using xxforms:call-xpl(), as it is more standard, easier to debug, and also exposes that functionality to other systems if needed.)

bartottenkamp wrote
I guess (hope) the latter is possible, but I get the message:
"XFormsServer  - XForms - submission - instance replacement did not take
place upon successful response because no body was provided. Submission:
mail-submission"
Is this because the service doesn't return anything? If this is the case, then you can use replace="none". If it is supposed to return something but that the XForms engine says the body of the response is empty, I'd recommend you use an HTTP sniffer to figure out what is really going over the wire.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
Hai Alex,

I indeed do not see a response when I turn on Firebug in Firefox, so could you inspect the following:

I submit using:

            <xforms:submission
                id = "mail-submission"
                ref = "instance('form-instance')/formcontent"
                xxforms:show-progress = "false"
                method = "post"
                action = "/e-formulieren/mail"
                replace="instance"
                instance="result-instance">

the /e-formulieren/mail is mapped in page-flow.xml as follows:
 

On Sat, Jul 18, 2009 at 1:11 AM, Alessandro Vernet <[hidden email]> wrote:

Hi Bart,


bartottenkamp wrote:
>
> I thought of:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> - Using <xforms:submission anyway with replace="instance" and
> instance="result"...
>

I would do the latter. (In fact, I often prefer the latter to using
xxforms:call-xpl(), as it is more standard, easier to debug, and also
exposes that functionality to other systems if needed.)


bartottenkamp wrote:
>
> I guess (hope) the latter is possible, but I get the message:
> "XFormsServer  - XForms - submission - instance replacement did not take
> place upon successful response because no body was provided. Submission:
> mail-submission"
>

Is this because the service doesn't return anything? If this is the case,
then you can use replace="none". If it is supposed to return something but
that the XForms engine says the body of the response is empty, I'd recommend
you use an HTTP sniffer to figure out what is really going over the wire.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24542979.html
Sent from the ObjectWeb 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: Re: From java servlet to orbeon context

Bart Ottenkamp
In reply to this post by Alessandro Vernet
hai Alex,

sorry, sent you half a mail... here is the complete one

I indeed do not see a response when I turn on Firebug in Firefox, so could you inspect the following:

I submit using:

            <xforms:submission
                id = "mail-submission"
                ref = "instance('form-instance')/formcontent"
                xxforms:show-progress = "false"
                method = "post"
                action = "/e-formulieren/mail"
                replace="instance"
                instance="result-instance">

the /e-formulieren/mail is mapped in page-flow.xml as follows:

            <page path-info="/e-formulieren/mail" model="forms/xpl/mail.xpl" />

the mail.xpl looks like:

<p:config
    xmlns:p = "http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf = "http://www.orbeon.com/oxf/processors"
    xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
    xmlns:divosa = "http://www.divosa.com/ops/processors">
    <p:param name = "instance" type = "input"/>
    <p:param name = "data" type = "output"/>
    <p:processor name = "divosa:mailProcessor">
        <p:input name = "data" href = "#instance"/>
        <p:output name = "data" ref = "data"/>
    </p:processor>
</p:config>

and my java code (divosa:mailProcessor):

    public void generateData(PipelineContext context, ContentHandler contentHandler) throws SAXException, DocumentException {
        Document inputDocument = readInputAsDOM4J(context, "data");
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(inputDocument.asXML());
        }
        org.dom4j.Document doc = DocumentHelper.createDocument();
        org.dom4j.Element root = doc.addElement("root");
        org.dom4j.Element result = root.addElement("result");
        // do the actual processing on the submitted information
        try {
            FormSubmitHandler formSubmitHandler = FormSubmitHandlerFactory.getFormSubmitHandler(Constants.FORM_SUBMIT_MAIL);
            String r = (String) formSubmitHandler.handle(inputDocument);
            result.addText("Het formulier is succesvol gemaild op "
                    + new SimpleDateTimeFormatter("dd-MM-YYYY HH:mm:ss").formatSimpleDateTime(new DateTime()));
        } catch (Exception e) {
            result.addText("Er is een fout opgetreden bij het mailen: " + e.getMessage());
        }
        populateContentHandler(contentHandler, doc);
    }

    protected void populateContentHandler(ContentHandler contentHandler, Document document) throws SAXException,
            DocumentException {
        // write the document to the contenthandler
        LocationSAXWriter saxWriter = new LocationSAXWriter();
        saxWriter.setContentHandler(contentHandler);
        saxWriter.write(document);
    }

can you see what happens? All my other processors return xml like this, so I think there's no fault in returning the xml from the processor. Do I loosing it in the pipeline somewhere then?

Thanks for helping.
Bart Ottenkamp

On Sat, Jul 18, 2009 at 1:11 AM, Alessandro Vernet <[hidden email]> wrote:

Hi Bart,


bartottenkamp wrote:
>
> I thought of:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> - Using <xforms:submission anyway with replace="instance" and
> instance="result"...
>

I would do the latter. (In fact, I often prefer the latter to using
xxforms:call-xpl(), as it is more standard, easier to debug, and also
exposes that functionality to other systems if needed.)


bartottenkamp wrote:
>
> I guess (hope) the latter is possible, but I get the message:
> "XFormsServer  - XForms - submission - instance replacement did not take
> place upon successful response because no body was provided. Submission:
> mail-submission"
>

Is this because the service doesn't return anything? If this is the case,
then you can use replace="none". If it is supposed to return something but
that the XForms engine says the body of the response is empty, I'd recommend
you use an HTTP sniffer to figure out what is really going over the wire.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24542979.html
Sent from the ObjectWeb 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: Re: From java servlet to orbeon context

Bart Ottenkamp
In reply to this post by Alessandro Vernet
Hai Alex,

still got the problem that the result of the submit is not transferred back. I use  Release 3.7.0beta1.200808260135, can this be the problem?

Best reagrads,
Bart

On Sat, Jul 18, 2009 at 1:11 AM, Alessandro Vernet <[hidden email]> wrote:

Hi Bart,


bartottenkamp wrote:
>
> I thought of:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> - Using <xforms:submission anyway with replace="instance" and
> instance="result"...
>

I would do the latter. (In fact, I often prefer the latter to using
xxforms:call-xpl(), as it is more standard, easier to debug, and also
exposes that functionality to other systems if needed.)


bartottenkamp wrote:
>
> I guess (hope) the latter is possible, but I get the message:
> "XFormsServer  - XForms - submission - instance replacement did not take
> place upon successful response because no body was provided. Submission:
> mail-submission"
>

Is this because the service doesn't return anything? If this is the case,
then you can use replace="none". If it is supposed to return something but
that the XForms engine says the body of the response is empty, I'd recommend
you use an HTTP sniffer to figure out what is really going over the wire.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24542979.html
Sent from the ObjectWeb 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: Re: From java servlet to orbeon context

Alessandro Vernet
Administrator
Bart,

bartottenkamp wrote
still got the problem that the result of the submit is not transferred back.
I use  Release 3.7.0beta1.200808260135, can this be the problem?
What do you mean by "the result of the submit is not transferred back"? To what part of my message were you responding? Just to make sure, Is there a way you can try this on a more recent build?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: From java servlet to orbeon context

Alessandro Vernet
Administrator
In reply to this post by Bart Ottenkamp
Bart,

bartottenkamp wrote
can you see what happens? All my other processors return xml like this, so I
think there's no fault in returning the xml from the processor. Do I loosing
it in the pipeline somewhere then?
It is my turn to apologize; I didn't see all your messages before responding. Can you add a debug="My pipeline output" on the <p:output name = "data" ref = "data"/>, so you can see what is output by the pipeline? You should then see the output in the orbeon.log.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
In reply to this post by Alessandro Vernet
Hai Alex,

first of all, yes, I'll try the latest build then.

then a couple of things:

1.
Did you have a look at what I mailed you what's in my java code, page-flow and .xpl? You might see a thing missing or something done wrong...
This is what is returned to the client from the java code I mailed you:

<?xml version="1.0" encoding="utf-8"?><xxf:event-response xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
/></xxf:action></xxf:event-response>
so this indeed seems empy and I guess the logging of XFormsServer is therefore correct:

WARN  XFormsServer  - XForms - submission - instance replacement did not take place upon successful response because no body was provided. Submission: mail-submission

so that's what I mean with, the aswer of my java processor seems not to be transferred back to the client.

2.
Can you maybe point me to an example of what I want; a submit that 'goes' to java and returns the result? Like 'success' or 'failure'... There should be one or two I think...?

3.
I also asked you this question:
- trying to call some orbeon functionallity in my own java code to turn the complete node into a stripped one that only has the relevant nodes.. You do this somewhere in orbeon code, don't you? Can I call this code? Since I have the context available?
Do you know an answer to this one?

4.
Back to my problem with popup blocking:
I' m always working with FF3 and IE8 and everything works fine there, but if I use IE6 en IE7, popup blocking is in the way and if I then choose to allow popups, the pdf is NOT downloaded AND the form is refreshed and all data id gone...
My quess my first question is; doesn't ring this a bell somewhere with you? Am I the only one with this problem as you know?

Sorry to ask you so many questions, but I building some cool stuff with orbeon and would like to have this tackled to go life as soon as possible.
Thanks in advance

Bart Ottenkamp

On Tue, Jul 21, 2009 at 3:01 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> still got the problem that the result of the submit is not transferred
> back.
> I use  Release 3.7.0beta1.200808260135, can this be the problem?
>

What do you mean by "the result of the submit is not transferred back"? To
what part of my message were you responding? Just to make sure, Is there a
way you can try this on a more recent build?

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24580083.html
Sent from the ObjectWeb 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: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
In reply to this post by Alessandro Vernet
Nope.... installing the latest dev build doesn't do it either. Still getting:
WARN  XFormsServer  - XForms - submission - instance replacement did not take place upon successful response because no body was provided. Submission: mail-submission

I get kind of desperate...
Best regards,
Bart

On Tue, Jul 21, 2009 at 3:07 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> can you see what happens? All my other processors return xml like this, so
> I
> think there's no fault in returning the xml from the processor. Do I
> loosing
> it in the pipeline somewhere then?
>

It is my turn to apologize; I didn't see all your messages before
responding. Can you add a debug="My pipeline output" on the <p:output name =
"data" ref = "data"/>, so you can see what is output by the pipeline? You
should then see the output in the orbeon.log.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24580138.html
Sent from the ObjectWeb 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: Re: Re: From java servlet to orbeon context

Alessandro Vernet
Administrator
In reply to this post by Bart Ottenkamp
Bart,

bartottenkamp wrote
1.
Did you have a look at what I mailed you what's in my java code, page-flow
and .xpl? You might see a thing missing or something done wrong...
This is what is returned to the client from the java code I mailed you:

<?xml version="1.0" encoding="utf-8"?><xxf:event-response
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
/></xxf:action></xxf:event-response>

so this indeed seems empy and I guess the logging of XFormsServer is
therefore correct:

WARN  XFormsServer  - XForms - submission - instance replacement did not
take place upon successful response because no body was provided.
Submission: mail-submission
Not quite. There are 2 distinct requests:

* The Ajax request made from the browser to the server and its response. This is what you see in Firebug, and is "internal" to Orbeon Forms.
* The submission done from the server to your service. That is the submission that contains the data you are interested it. If you get a nightly build and set the XFormsModelSubmission to log at the debug level (see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging), you can see what is sent to your service, and what comes back. This is what we are interested in.

So in addition to testing this with nightly build, I recommend you add XFormsModelSubmission in debug mode to you log4j.xml and see what is sent and received by the service. Also add a debug on the output of the pipeline to see what is returned by the pipeline.

bartottenkamp wrote
2.
Can you maybe point me to an example of what I want; a submit that 'goes' to
java and returns the result? Like 'success' or 'failure'... There should be
one or two I think...?
Using the Java processor there is generic-init-database.xpl in the examples, but it doesn't return any data.

bartottenkamp wrote
3.
I also asked you this question:
- trying to call some orbeon functionallity in my own java code to turn the
complete node into a stripped one that only has the relevant nodes.. You do
this somewhere in orbeon code, don't you? Can I call this code? Since I have
the context available?
Do you know an answer to this one?
What do you mean by stripped node? I assume you have a DOM in Java, from which you want to remove node; which one?

bartottenkamp wrote
4.
Back to my problem with popup blocking:
I' m always working with FF3 and IE8 and everything works fine there, but if
I use IE6 en IE7, popup blocking is in the way and if I then choose to allow
popups, the pdf is NOT downloaded AND the form is refreshed and all data id
gone...
My quess my first question is; doesn't ring this a bell somewhere with you?
Am I the only one with this problem as you know?
You're not. And the only reliable way I know to do this, at the HTML level, is to have in the page a simple link Download PDF. If you have the file you want to serve in a node (base64 or URI to temporary file), you can use an <xforms:output ref="file1" appearance="xxforms:download">. You'll find an example of this in output-download.xhtml, and more documentation on:

http://www.orbeon.com/ops/doc/reference-xforms-extensions#xxforms-download-appearance

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
Hai Alex,
thanks for the answers. I'm past my release date now, so I skipped some functionality and have some more time now to get things rights.
I included some comments/questions in below conversation... they're in red

On Wed, Jul 22, 2009 at 12:36 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> 1.
> Did you have a look at what I mailed you what's in my java code, page-flow
> and .xpl? You might see a thing missing or something done wrong...
> This is what is returned to the client from the java code I mailed you:
>
> <?xml version="1.0" encoding="utf-8"?><xxf:event-response
> xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
> /></xxf:action></xxf:event-response>
>
> so this indeed seems empy and I guess the logging of XFormsServer is
> therefore correct:
>
> WARN  XFormsServer  - XForms - submission - instance replacement did not
> take place upon successful response because no body was provided.
> Submission: mail-submission
>

Not quite. There are 2 distinct requests:

* The Ajax request made from the browser to the server and its response.
This is what you see in Firebug, and is "internal" to Orbeon Forms.
* The submission done from the server to your service. That is the
submission that contains the data you are interested it. If you get a
nightly build and set the XFormsModelSubmission to log at the debug level
(see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging), you
can see what is sent to your service, and what comes back. This is what we
are interested in.

So in addition to testing this with nightly build, I recommend you add
XFormsModelSubmission in debug mode to you log4j.xml and see what is sent
and received by the service. Also add a debug on the output of the pipeline
to see what is returned by the pipeline.

I'll do that. Didn't have time yet. I understand the difference in the submission and the ajax request, but am still wondering; the result of the service should be passed to the ajax call and be visible in the response on that Ajax call? Anyway, I'll see what the debugging results are..


bartottenkamp wrote:
>
> 2.
> Can you maybe point me to an example of what I want; a submit that 'goes'
> to
> java and returns the result? Like 'success' or 'failure'... There should
> be
> one or two I think...?
>

Using the Java processor there is generic-init-database.xpl in the examples,
but it doesn't return any data.

No, to bad. I found that one alright. But you don't plan to include (or already have waiting somewhere) an example that really dows give you back a response? I figure that a lot of people want their submission to result in a message from the server that indicates whether things went right or wrong..


bartottenkamp wrote:
>
> 3.
> I also asked you this question:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> Do you know an answer to this one?
>

What do you mean by stripped node? I assume you have a DOM in Java, from
which you want to remove node; which one?

What I really mean is this:
I'm building forms that have a lot of question-answer functionality and lead the customer through different possible flows to come to the end. In these forms, with submission at the end, I'm very much interested in which flow the customer took. This is of course done with relevances in bindings. Now, if I use the submission functionallity and I point the submission to a custom processor, that processor receives the 'stripped' model. I mean, the complete model is posted, but the nodes that are not relevant (due to binding and user input in the form) are already stripped and gone from the xml my custom processor receives... You see what I mean? I'm wondering where that 'magic' happens... If I can call the code that does the trick myself, then I could use the xxforms:call-xpl() again, because in that case I can strip the node myself.. and I can get messages from my processors back to the browser that way...


bartottenkamp wrote:
>
> 4.
> Back to my problem with popup blocking:
> I' m always working with FF3 and IE8 and everything works fine there, but
> if
> I use IE6 en IE7, popup blocking is in the way and if I then choose to
> allow
> popups, the pdf is NOT downloaded AND the form is refreshed and all data
> id
> gone...
> My quess my first question is; doesn't ring this a bell somewhere with
> you?
> Am I the only one with this problem as you know?
>

You're not. And the only reliable way I know to do this, at the HTML level,
is to have in the page a simple link  ... Download PDF . If you have the
file you want to serve in a node (base64 or URI to temporary file), you can
use an <xforms:output ref="file1" appearance="xxforms:download">. You'll
find an example of this in output-download.xhtml, and more documentation on:

http://www.orbeon.com/ops/doc/reference-xforms-extensions#xxforms-download-appearance

OK, I understand. To make this a serious option though, the customer should not have to 'click twice'. This means temporarily saving the file and then download it should be possible as a result of just one user click. I'll go figur eout how to do that...

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24597044.html
Sent from the ObjectWeb 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: Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
In reply to this post by Alessandro Vernet
hai Alex,

I've been doing some other work for a while but now returning to these issues we've been discussing:

first this conversation:

===============================================================================================================================================

bartottenkamp wrote:
>
> 1.
> Did you have a look at what I mailed you what's in my java code, page-flow
> and .xpl? You might see a thing missing or something done wrong...
> This is what is returned to the client from the java code I mailed you:
>
> <?xml version="1.0" encoding="utf-8"?><xxf:event-
response
> xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
> /></xxf:action></xxf:event-response>
>
> so this indeed seems empy and I guess the logging of XFormsServer is
> therefore correct:
>
> WARN  XFormsServer  - XForms - submission - instance replacement did not
> take place upon successful response because no body was provided.
> Submission: mail-submission
>

Alex wrote:

Not quite. There are 2 distinct requests:

* The Ajax request made from the browser to the server and its response.
This is what you see in Firebug, and is "internal" to Orbeon Forms.
* The submission done from the server to your service. That is the
submission that contains the data you are interested it. If you get a
nightly build and set the XFormsModelSubmission to log at the debug level
(see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging), you
can see what is sent to your service, and what comes back. This is what we
are interested in.

So in addition to testing this with nightly build, I recommend you add
XFormsModelSubmission in debug mode to you log4j.xml and see what is sent
and received by the service. Also add a debug on the output of the pipeline
to see what is returned by the pipeline.

bart Ottenkamp wrote:

I'll do that. Didn't have time yet. I understand the difference in the submission and the ajax request, but am still wondering; the result of the service should be passed to the ajax call and be visible in the response on that Ajax call? Anyway, I'll see what the debugging results are..

===============================================================================================================================================

SO, I tried the logging, but it didn't show me more than I already knew. I included mail.log, that shows the orbeon logging and my own logging... maybe you can have a look. It also shows the message
"WARN  XFormsServer  - XForms - submission - instance replacement did not take place upon successful response because no body was provided. Submission: mail-submission"
but no other clues....?

Then, can you tell me how to put a debug on the output of my pipeline?

Thanks again
Bart Ottenkamp




On Wed, Jul 22, 2009 at 12:36 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> 1.
> Did you have a look at what I mailed you what's in my java code, page-flow
> and .xpl? You might see a thing missing or something done wrong...
> This is what is returned to the client from the java code I mailed you:
>
> <?xml version="1.0" encoding="utf-8"?><xxf:event-response
> xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
> /></xxf:action></xxf:event-response>
>
> so this indeed seems empy and I guess the logging of XFormsServer is
> therefore correct:
>
> WARN  XFormsServer  - XForms - submission - instance replacement did not
> take place upon successful response because no body was provided.
> Submission: mail-submission
>

Not quite. There are 2 distinct requests:

* The Ajax request made from the browser to the server and its response.
This is what you see in Firebug, and is "internal" to Orbeon Forms.
* The submission done from the server to your service. That is the
submission that contains the data you are interested it. If you get a
nightly build and set the XFormsModelSubmission to log at the debug level
(see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging), you
can see what is sent to your service, and what comes back. This is what we
are interested in.

So in addition to testing this with nightly build, I recommend you add
XFormsModelSubmission in debug mode to you log4j.xml and see what is sent
and received by the service. Also add a debug on the output of the pipeline
to see what is returned by the pipeline.


bartottenkamp wrote:
>
> 2.
> Can you maybe point me to an example of what I want; a submit that 'goes'
> to
> java and returns the result? Like 'success' or 'failure'... There should
> be
> one or two I think...?
>

Using the Java processor there is generic-init-database.xpl in the examples,
but it doesn't return any data.


bartottenkamp wrote:
>
> 3.
> I also asked you this question:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> Do you know an answer to this one?
>

What do you mean by stripped node? I assume you have a DOM in Java, from
which you want to remove node; which one?


bartottenkamp wrote:
>
> 4.
> Back to my problem with popup blocking:
> I' m always working with FF3 and IE8 and everything works fine there, but
> if
> I use IE6 en IE7, popup blocking is in the way and if I then choose to
> allow
> popups, the pdf is NOT downloaded AND the form is refreshed and all data
> id
> gone...
> My quess my first question is; doesn't ring this a bell somewhere with
> you?
> Am I the only one with this problem as you know?
>

You're not. And the only reliable way I know to do this, at the HTML level,
is to have in the page a simple link  ... Download PDF . If you have the
file you want to serve in a node (base64 or URI to temporary file), you can
use an <xforms:output ref="file1" appearance="xxforms:download">. You'll
find an example of this in output-download.xhtml, and more documentation on:

http://www.orbeon.com/ops/doc/reference-xforms-extensions#xxforms-download-appearance

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24597044.html
Sent from the ObjectWeb 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: Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
In reply to this post by Alessandro Vernet
Hai Alex,

I (still) have trouble giving back a result to the client after a submission...
Please, forget all other things mentioned in this mail conversation, because I mostly resolved them, but this one is still hard to figure out.
I'm really desperate now, because if I don't fix this now, I'll be forced to drop using orbeon and advice my client to use something else. And I don't want that, because I came all this way...

Here is my mail again (please reply):

First question is:
does anybody have an example of a form, that submits a part of the model via a pipeline to a custom java processor and than gives back a result (just a message is enough) to the client?
I think it should be possible (would be very weird if it is not possible, I think!) and if anybody knows how to do this, I think it should help if we make an example for it and add it to the xforms-sandbox...

I really think I just have a very small error in configuration somewhere and I cannot find what is going wrong. Here is what I have:

in my .xhtml:

            <xforms:instance id = "result-instance">
                <root>
                    <result/>
                    <failure/>
                    <success/>
                </root>
            </xforms:instance>

and

            <xforms:submission
                id = "mail-submission"
                ref = "instance('form-instance')/
formcontent"
                xxforms:show-progress = "false"
                method = "post"
                action = "/e-formulieren/mail"
                replace = "instance"
                instance = "result-instance">
                <xforms:setvalue ev:event = "xforms-submit-done" ref = "instance('result-instance')/success">success</xforms:setvalue>
                <xforms:message ev:event = "xforms-submit-error" level = "modal">error occurred</xforms:message>
            </xforms:submission>

in my page-flow.xml:
    <!-- mail -->
    <page path-info="/e-formulieren/mail" model="forms/xpl/mail.xpl" />

in forms/xpl/mail.xpl:

<p:config
    xmlns:p = "http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf = "http://www.orbeon.com/oxf/processors"
    xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
    xmlns:divosa = "http://www.divosa.com/ops/processors">
    <p:param name = "instance" type = "input"/>
    <p:param name = "data" type = "output"/>
    <p:processor name = "divosa:mailProcessor">
        <p:input name = "data" href = "#instance"/>
        <p:output name = "data" ref = "data"/>
    </p:processor>
</p:config>

and then my mailProcessor:
public class MailProcessor extends SimpleProcessor {

    private static Logger LOGGER = Logger.getLogger(MailProcessor.class);

    public MailProcessor() {
        addInputInfo(new ProcessorInputOutputInfo("instance"));
        addOutputInfo(new ProcessorInputOutputInfo(OUTPUT_DATA));
    }

   
    @Override
    public void generateData(PipelineContext context, ContentHandler contentHandler) throws SAXException, DocumentException {
        Document inputDocument = readInputAsDOM4J(context, "data");
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(inputDocument.asXML());
        }
       
        org.dom4j.Document doc = DocumentHelper.createDocument();
        org.dom4j.Element root = doc.addElement("root");
        org.dom4j.Element result = root.addElement("result");
        // do the actual processing on the submitted information
        try {
            FormSubmitHandler formSubmitHandler = FormSubmitHandlerFactory.getFormSubmitHandler(Constants.FORM_SUBMIT_MAIL);
            String r = (String) formSubmitHandler.handle(inputDocument);
            result.addText("Het formulier is succesvol gemaild op "
                    + new SimpleDateTimeFormatter("dd-MM-YYYY HH:mm:ss").formatSimpleDateTime(new DateTime()));
        } catch (Exception e) {
            result.addText("Er is een fout opgetreden bij het mailen: " + e.getMessage());
        }
       
        LocationSAXWriter saxWriter = new LocationSAXWriter();
        saxWriter.setContentHandler(contentHandler);
        saxWriter.write(doc);
    }

As you can see, with the declaration in the submission:
                replace = "instance"
                instance = "result-instance"
I try to replace the result instance with what I construct in the MailProcessor...

The logging put to debug, this is (all) what I see:
2009-09-01 09:52:20,055 WARN  XFormsServer  - XForms - submission - instance replacement did not take place upon successful response because no body was provided. Submission: mail-submission

Can you help??? Do you see where I go wrong?

And I really think it would help to add an example to the sandbox.. then I won't have to bother you about thiss...

Thanks and best regards,
Bart Ottenkamp


On Wed, Jul 22, 2009 at 12:36 AM, Alessandro Vernet <[hidden email]> wrote:

Bart,


bartottenkamp wrote:
>
> 1.
> Did you have a look at what I mailed you what's in my java code, page-flow
> and .xpl? You might see a thing missing or something done wrong...
> This is what is returned to the client from the java code I mailed you:
>
> <?xml version="1.0" encoding="utf-8"?><xxf:event-response
> xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
> /></xxf:action></xxf:event-response>
>
> so this indeed seems empy and I guess the logging of XFormsServer is
> therefore correct:
>
> WARN  XFormsServer  - XForms - submission - instance replacement did not
> take place upon successful response because no body was provided.
> Submission: mail-submission
>

Not quite. There are 2 distinct requests:

* The Ajax request made from the browser to the server and its response.
This is what you see in Firebug, and is "internal" to Orbeon Forms.
* The submission done from the server to your service. That is the
submission that contains the data you are interested it. If you get a
nightly build and set the XFormsModelSubmission to log at the debug level
(see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging), you
can see what is sent to your service, and what comes back. This is what we
are interested in.

So in addition to testing this with nightly build, I recommend you add
XFormsModelSubmission in debug mode to you log4j.xml and see what is sent
and received by the service. Also add a debug on the output of the pipeline
to see what is returned by the pipeline.


bartottenkamp wrote:
>
> 2.
> Can you maybe point me to an example of what I want; a submit that 'goes'
> to
> java and returns the result? Like 'success' or 'failure'... There should
> be
> one or two I think...?
>

Using the Java processor there is generic-init-database.xpl in the examples,
but it doesn't return any data.


bartottenkamp wrote:
>
> 3.
> I also asked you this question:
> - trying to call some orbeon functionallity in my own java code to turn
> the
> complete node into a stripped one that only has the relevant nodes.. You
> do
> this somewhere in orbeon code, don't you? Can I call this code? Since I
> have
> the context available?
> Do you know an answer to this one?
>

What do you mean by stripped node? I assume you have a DOM in Java, from
which you want to remove node; which one?


bartottenkamp wrote:
>
> 4.
> Back to my problem with popup blocking:
> I' m always working with FF3 and IE8 and everything works fine there, but
> if
> I use IE6 en IE7, popup blocking is in the way and if I then choose to
> allow
> popups, the pdf is NOT downloaded AND the form is refreshed and all data
> id
> gone...
> My quess my first question is; doesn't ring this a bell somewhere with
> you?
> Am I the only one with this problem as you know?
>

You're not. And the only reliable way I know to do this, at the HTML level,
is to have in the page a simple link  ... Download PDF . If you have the
file you want to serve in a node (base64 or URI to temporary file), you can
use an <xforms:output ref="file1" appearance="xxforms:download">. You'll
find an example of this in output-download.xhtml, and more documentation on:

http://www.orbeon.com/ops/doc/reference-xforms-extensions#xxforms-download-appearance

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24597044.html
Sent from the ObjectWeb 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: Re: Re: Re: Re: From java servlet to orbeon context

Erik Bruchez-3
Bart,

This is due to the fact that the data output of a model, i.e.
model="mail.xpl", is not automatically serialized. You can do your own
serialization in mail.,xpl with oxf:xml-converter /
oxf:http-serializer, or you can try to switch to view="mail.xpl" and
see if that works.

-Erik

On Thu, Sep 10, 2009 at 7:08 AM, Bart Ottenkamp <[hidden email]> wrote:

> Hai Alex,
>
> I (still) have trouble giving back a result to the client after a
> submission...
> Please, forget all other things mentioned in this mail conversation, because
> I mostly resolved them, but this one is still hard to figure out.
> I'm really desperate now, because if I don't fix this now, I'll be forced to
> drop using orbeon and advice my client to use something else. And I don't
> want that, because I came all this way...
>
> Here is my mail again (please reply):
>
> First question is:
> does anybody have an example of a form, that submits a part of the model via
> a pipeline to a custom java processor and than gives back a result (just a
> message is enough) to the client?
> I think it should be possible (would be very weird if it is not possible, I
> think!) and if anybody knows how to do this, I think it should help if we
> make an example for it and add it to the xforms-sandbox...
>
> I really think I just have a very small error in configuration somewhere and
> I cannot find what is going wrong. Here is what I have:
>
> in my .xhtml:
>
>             <xforms:instance id = "result-instance">
>                 <root>
>                     <result/>
>                     <failure/>
>                     <success/>
>                 </root>
>             </xforms:instance>
>
> and
>
>             <xforms:submission
>                 id = "mail-submission"
>                 ref = "instance('form-instance')/
> formcontent"
>                 xxforms:show-progress = "false"
>                 method = "post"
>                 action = "/e-formulieren/mail"
>                 replace = "instance"
>                 instance = "result-instance">
>                 <xforms:setvalue ev:event = "xforms-submit-done" ref =
> "instance('result-instance')/success">success</xforms:setvalue>
>                 <xforms:message ev:event = "xforms-submit-error" level =
> "modal">error occurred</xforms:message>
>             </xforms:submission>
>
> in my page-flow.xml:
>     <!-- mail -->
>     <page path-info="/e-formulieren/mail" model="forms/xpl/mail.xpl" />
>
> in forms/xpl/mail.xpl:
>
> <p:config
>     xmlns:p = "http://www.orbeon.com/oxf/pipeline"
>     xmlns:oxf = "http://www.orbeon.com/oxf/processors"
>     xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
>     xmlns:divosa = "http://www.divosa.com/ops/processors">
>     <p:param name = "instance" type = "input"/>
>     <p:param name = "data" type = "output"/>
>     <p:processor name = "divosa:mailProcessor">
>         <p:input name = "data" href = "#instance"/>
>         <p:output name = "data" ref = "data"/>
>     </p:processor>
> </p:config>
>
> and then my mailProcessor:
> public class MailProcessor extends SimpleProcessor {
>
>     private static Logger LOGGER = Logger.getLogger(MailProcessor.class);
>
>     public MailProcessor() {
>         addInputInfo(new ProcessorInputOutputInfo("instance"));
>         addOutputInfo(new ProcessorInputOutputInfo(OUTPUT_DATA));
>     }
>
>
>     @Override
>     public void generateData(PipelineContext context, ContentHandler
> contentHandler) throws SAXException, DocumentException {
>         Document inputDocument = readInputAsDOM4J(context, "data");
>         if (LOGGER.isDebugEnabled()) {
>             LOGGER.debug(inputDocument.asXML());
>         }
>
>         org.dom4j.Document doc = DocumentHelper.createDocument();
>         org.dom4j.Element root = doc.addElement("root");
>         org.dom4j.Element result = root.addElement("result");
>         // do the actual processing on the submitted information
>         try {
>             FormSubmitHandler formSubmitHandler =
> FormSubmitHandlerFactory.getFormSubmitHandler(Constants.FORM_SUBMIT_MAIL);
>             String r = (String) formSubmitHandler.handle(inputDocument);
>             result.addText("Het formulier is succesvol gemaild op "
>                     + new SimpleDateTimeFormatter("dd-MM-YYYY
> HH:mm:ss").formatSimpleDateTime(new DateTime()));
>         } catch (Exception e) {
>             result.addText("Er is een fout opgetreden bij het mailen: " +
> e.getMessage());
>         }
>
>         LocationSAXWriter saxWriter = new LocationSAXWriter();
>         saxWriter.setContentHandler(contentHandler);
>         saxWriter.write(doc);
>     }
>
> As you can see, with the declaration in the submission:
>                 replace = "instance"
>                 instance = "result-instance"
> I try to replace the result instance with what I construct in the
> MailProcessor...
>
> The logging put to debug, this is (all) what I see:
> 2009-09-01 09:52:20,055 WARN  XFormsServer  - XForms - submission - instance
> replacement did not take place upon successful response because no body was
> provided. Submission: mail-submission
>
> Can you help??? Do you see where I go wrong?
>
> And I really think it would help to add an example to the sandbox.. then I
> won't have to bother you about thiss...
>
> Thanks and best regards,
> Bart Ottenkamp
>
> On Wed, Jul 22, 2009 at 12:36 AM, Alessandro Vernet <[hidden email]>
> wrote:
>>
>> Bart,
>>
>>
>> bartottenkamp wrote:
>> >
>> > 1.
>> > Did you have a look at what I mailed you what's in my java code,
>> > page-flow
>> > and .xpl? You might see a thing missing or something done wrong...
>> > This is what is returned to the client from the java code I mailed you:
>> >
>> > <?xml version="1.0" encoding="utf-8"?><xxf:event-response
>> > xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>>
>> >> >><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
>> > /></xxf:action></xxf:event-response>
>> >
>> > so this indeed seems empy and I guess the logging of XFormsServer is
>> > therefore correct:
>> >
>> > WARN  XFormsServer  - XForms - submission - instance replacement did not
>> > take place upon successful response because no body was provided.
>> > Submission: mail-submission
>> >
>>
>> Not quite. There are 2 distinct requests:
>>
>> * The Ajax request made from the browser to the server and its response.
>> This is what you see in Firebug, and is "internal" to Orbeon Forms.
>> * The submission done from the server to your service. That is the
>> submission that contains the data you are interested it. If you get a
>> nightly build and set the XFormsModelSubmission to log at the debug level
>> (see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging),
>> you
>> can see what is sent to your service, and what comes back. This is what we
>> are interested in.
>>
>> So in addition to testing this with nightly build, I recommend you add
>> XFormsModelSubmission in debug mode to you log4j.xml and see what is sent
>> and received by the service. Also add a debug on the output of the
>> pipeline
>> to see what is returned by the pipeline.
>>
>>
>> bartottenkamp wrote:
>> >
>> > 2.
>> > Can you maybe point me to an example of what I want; a submit that
>> > 'goes'
>> > to
>> > java and returns the result? Like 'success' or 'failure'... There should
>> > be
>> > one or two I think...?
>> >
>>
>> Using the Java processor there is generic-init-database.xpl in the
>> examples,
>> but it doesn't return any data.
>>
>>
>> bartottenkamp wrote:
>> >
>> > 3.
>> > I also asked you this question:
>> > - trying to call some orbeon functionallity in my own java code to turn
>> > the
>> > complete node into a stripped one that only has the relevant nodes.. You
>> > do
>> > this somewhere in orbeon code, don't you? Can I call this code? Since I
>> > have
>> > the context available?
>> > Do you know an answer to this one?
>> >
>>
>> What do you mean by stripped node? I assume you have a DOM in Java, from
>> which you want to remove node; which one?
>>
>>
>> bartottenkamp wrote:
>> >
>> > 4.
>> > Back to my problem with popup blocking:
>> > I' m always working with FF3 and IE8 and everything works fine there,
>> > but
>> > if
>> > I use IE6 en IE7, popup blocking is in the way and if I then choose to
>> > allow
>> > popups, the pdf is NOT downloaded AND the form is refreshed and all data
>> > id
>> > gone...
>> > My quess my first question is; doesn't ring this a bell somewhere with
>> > you?
>> > Am I the only one with this problem as you know?
>> >
>>
>> You're not. And the only reliable way I know to do this, at the HTML
>> level,
>> is to have in the page a simple link  ... Download PDF . If you have the
>> file you want to serve in a node (base64 or URI to temporary file), you
>> can
>> use an <xforms:output ref="file1" appearance="xxforms:download">. You'll
>> find an example of this in output-download.xhtml, and more documentation
>> on:
>>
>>
>> http://www.orbeon.com/ops/doc/reference-xforms-extensions#xxforms-download-appearance
>>
>> Alex
>>
>> -----
>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
>> Orbeon's Blog: http://www.orbeon.com/blog/
>> Personal Blog: http://avernet.blogspot.com/
>> Twitter - http://twitter.com/avernet
>> --
>> View this message in context:
>> http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24597044.html
>> Sent from the ObjectWeb 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
>
>


--
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: Re: Re: Re: Re: Re: From java servlet to orbeon context

Bart Ottenkamp
All right!!
the view=".." instead of the model=".." works for me..
Kept me busy for over a month!
Thanks for helping!

Bart


On Fri, Sep 18, 2009 at 1:00 AM, Erik Bruchez <[hidden email]> wrote:
Bart,

This is due to the fact that the data output of a model, i.e.
model="mail.xpl", is not automatically serialized. You can do your own
serialization in mail.,xpl with oxf:xml-converter /
oxf:http-serializer, or you can try to switch to view="mail.xpl" and
see if that works.

-Erik

On Thu, Sep 10, 2009 at 7:08 AM, Bart Ottenkamp <[hidden email]> wrote:
> Hai Alex,
>
> I (still) have trouble giving back a result to the client after a
> submission...
> Please, forget all other things mentioned in this mail conversation, because
> I mostly resolved them, but this one is still hard to figure out.
> I'm really desperate now, because if I don't fix this now, I'll be forced to
> drop using orbeon and advice my client to use something else. And I don't
> want that, because I came all this way...
>
> Here is my mail again (please reply):
>
> First question is:
> does anybody have an example of a form, that submits a part of the model via
> a pipeline to a custom java processor and than gives back a result (just a
> message is enough) to the client?
> I think it should be possible (would be very weird if it is not possible, I
> think!) and if anybody knows how to do this, I think it should help if we
> make an example for it and add it to the xforms-sandbox...
>
> I really think I just have a very small error in configuration somewhere and
> I cannot find what is going wrong. Here is what I have:
>
> in my .xhtml:
>
>             <xforms:instance id = "result-instance">
>                 <root>
>                     <result/>
>                     <failure/>
>                     <success/>
>                 </root>
>             </xforms:instance>
>
> and
>
>             <xforms:submission
>                 id = "mail-submission"
>                 ref = "instance('form-instance')/
> formcontent"
>                 xxforms:show-progress = "false"
>                 method = "post"
>                 action = "/e-formulieren/mail"
>                 replace = "instance"
>                 instance = "result-instance">
>                 <xforms:setvalue ev:event = "xforms-submit-done" ref =
> "instance('result-instance')/success">success</xforms:setvalue>
>                 <xforms:message ev:event = "xforms-submit-error" level =
> "modal">error occurred</xforms:message>
>             </xforms:submission>
>
> in my page-flow.xml:
>     <!-- mail -->
>     <page path-info="/e-formulieren/mail" model="forms/xpl/mail.xpl" />
>
> in forms/xpl/mail.xpl:
>
> <p:config
>     xmlns:p = "http://www.orbeon.com/oxf/pipeline"
>     xmlns:oxf = "http://www.orbeon.com/oxf/processors"
>     xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
>     xmlns:divosa = "http://www.divosa.com/ops/processors">
>     <p:param name = "instance" type = "input"/>
>     <p:param name = "data" type = "output"/>
>     <p:processor name = "divosa:mailProcessor">
>         <p:input name = "data" href = "#instance"/>
>         <p:output name = "data" ref = "data"/>
>     </p:processor>
> </p:config>
>
> and then my mailProcessor:
> public class MailProcessor extends SimpleProcessor {
>
>     private static Logger LOGGER = Logger.getLogger(MailProcessor.class);
>
>     public MailProcessor() {
>         addInputInfo(new ProcessorInputOutputInfo("instance"));
>         addOutputInfo(new ProcessorInputOutputInfo(OUTPUT_DATA));
>     }
>
>
>     @Override
>     public void generateData(PipelineContext context, ContentHandler
> contentHandler) throws SAXException, DocumentException {
>         Document inputDocument = readInputAsDOM4J(context, "data");
>         if (LOGGER.isDebugEnabled()) {
>             LOGGER.debug(inputDocument.asXML());
>         }
>
>         org.dom4j.Document doc = DocumentHelper.createDocument();
>         org.dom4j.Element root = doc.addElement("root");
>         org.dom4j.Element result = root.addElement("result");
>         // do the actual processing on the submitted information
>         try {
>             FormSubmitHandler formSubmitHandler =
> FormSubmitHandlerFactory.getFormSubmitHandler(Constants.FORM_SUBMIT_MAIL);
>             String r = (String) formSubmitHandler.handle(inputDocument);
>             result.addText("Het formulier is succesvol gemaild op "
>                     + new SimpleDateTimeFormatter("dd-MM-YYYY
> HH:mm:ss").formatSimpleDateTime(new DateTime()));
>         } catch (Exception e) {
>             result.addText("Er is een fout opgetreden bij het mailen: " +
> e.getMessage());
>         }
>
>         LocationSAXWriter saxWriter = new LocationSAXWriter();
>         saxWriter.setContentHandler(contentHandler);
>         saxWriter.write(doc);
>     }
>
> As you can see, with the declaration in the submission:
>                 replace = "instance"
>                 instance = "result-instance"
> I try to replace the result instance with what I construct in the
> MailProcessor...
>
> The logging put to debug, this is (all) what I see:
> 2009-09-01 09:52:20,055 WARN  XFormsServer  - XForms - submission - instance
> replacement did not take place upon successful response because no body was
> provided. Submission: mail-submission
>
> Can you help??? Do you see where I go wrong?
>
> And I really think it would help to add an example to the sandbox.. then I
> won't have to bother you about thiss...
>
> Thanks and best regards,
> Bart Ottenkamp
>
> On Wed, Jul 22, 2009 at 12:36 AM, Alessandro Vernet <[hidden email]>
> wrote:
>>
>> Bart,
>>
>>
>> bartottenkamp wrote:
>> >
>> > 1.
>> > Did you have a look at what I mailed you what's in my java code,
>> > page-flow
>> > and .xpl? You might see a thing missing or something done wrong...
>> > This is what is returned to the client from the java code I mailed you:
>> >
>> > <?xml version="1.0" encoding="utf-8"?><xxf:event-response
>> > xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
>>
>> >> >><xxf:dynamic-state>pers:784A27F5-359A-CFA7-F395-2C0DFFDB57FB</xxf:dynamic-state><xxf:action><xxf:control-values
>> > /></xxf:action></xxf:event-response>
>> >
>> > so this indeed seems empy and I guess the logging of XFormsServer is
>> > therefore correct:
>> >
>> > WARN  XFormsServer  - XForms - submission - instance replacement did not
>> > take place upon successful response because no body was provided.
>> > Submission: mail-submission
>> >
>>
>> Not quite. There are 2 distinct requests:
>>
>> * The Ajax request made from the browser to the server and its response.
>> This is what you see in Firebug, and is "internal" to Orbeon Forms.
>> * The submission done from the server to your service. That is the
>> submission that contains the data you are interested it. If you get a
>> nightly build and set the XFormsModelSubmission to log at the debug level
>> (see: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-logging),
>> you
>> can see what is sent to your service, and what comes back. This is what we
>> are interested in.
>>
>> So in addition to testing this with nightly build, I recommend you add
>> XFormsModelSubmission in debug mode to you log4j.xml and see what is sent
>> and received by the service. Also add a debug on the output of the
>> pipeline
>> to see what is returned by the pipeline.
>>
>>
>> bartottenkamp wrote:
>> >
>> > 2.
>> > Can you maybe point me to an example of what I want; a submit that
>> > 'goes'
>> > to
>> > java and returns the result? Like 'success' or 'failure'... There should
>> > be
>> > one or two I think...?
>> >
>>
>> Using the Java processor there is generic-init-database.xpl in the
>> examples,
>> but it doesn't return any data.
>>
>>
>> bartottenkamp wrote:
>> >
>> > 3.
>> > I also asked you this question:
>> > - trying to call some orbeon functionallity in my own java code to turn
>> > the
>> > complete node into a stripped one that only has the relevant nodes.. You
>> > do
>> > this somewhere in orbeon code, don't you? Can I call this code? Since I
>> > have
>> > the context available?
>> > Do you know an answer to this one?
>> >
>>
>> What do you mean by stripped node? I assume you have a DOM in Java, from
>> which you want to remove node; which one?
>>
>>
>> bartottenkamp wrote:
>> >
>> > 4.
>> > Back to my problem with popup blocking:
>> > I' m always working with FF3 and IE8 and everything works fine there,
>> > but
>> > if
>> > I use IE6 en IE7, popup blocking is in the way and if I then choose to
>> > allow
>> > popups, the pdf is NOT downloaded AND the form is refreshed and all data
>> > id
>> > gone...
>> > My quess my first question is; doesn't ring this a bell somewhere with
>> > you?
>> > Am I the only one with this problem as you know?
>> >
>>
>> You're not. And the only reliable way I know to do this, at the HTML
>> level,
>> is to have in the page a simple link  ... Download PDF . If you have the
>> file you want to serve in a node (base64 or URI to temporary file), you
>> can
>> use an <xforms:output ref="file1" appearance="xxforms:download">. You'll
>> find an example of this in output-download.xhtml, and more documentation
>> on:
>>
>>
>> http://www.orbeon.com/ops/doc/reference-xforms-extensions#xxforms-download-appearance
>>
>> Alex
>>
>> -----
>> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
>> Orbeon's Blog: http://www.orbeon.com/blog/
>> Personal Blog: http://avernet.blogspot.com/
>> Twitter - http://twitter.com/avernet
>> --
>> View this message in context:
>> http://www.nabble.com/From-java-servlet-to-orbeon-context-tp24479768p24597044.html
>> Sent from the ObjectWeb 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
>
>


--
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