Passing XML into a page from a separate Java app

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

Passing XML into a page from a separate Java app

Dustin Henson-3
I'm running Orbeon 3.6 as a separate service from my JSP application. I
have a simple Java controller that does some processing and then directs
the flow to the next page. I am reading the XML response from the
previous page with the code below. Can anyone tell me how, after I make
changes to the XML, I can pass the new version into the following page?

        // Check the XML payload
        ServletInputStream xmlStream = request.getInputStream();
        InputStreamReader xmlStreamReader = new InputStreamReader(xmlStream);
        BufferedReader xmlReader = new BufferedReader(xmlStreamReader);

        StringBuffer xml = new StringBuffer();
        String line = null;
        while((line = xmlReader.readLine()) != null)
        {
            xml.append(line+"\n");
        }
        System.out.println("\t XML Payload: " + xml.toString());


Thanks,
Dustin


--
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: Passing XML into a page from a separate Java app

Alessandro Vernet
Administrator
Dustin,

On Jan 14, 2008 10:04 PM, Dustin Henson <[hidden email]> wrote:

> I'm running Orbeon 3.6 as a separate service from my JSP application. I
> have a simple Java controller that does some processing and then directs
> the flow to the next page. I am reading the XML response from the
> previous page with the code below. Can anyone tell me how, after I make
> changes to the XML, I can pass the new version into the following page?
>
>         // Check the XML payload
>         ServletInputStream xmlStream = request.getInputStream();
>         InputStreamReader xmlStreamReader = new InputStreamReader(xmlStream);
>         BufferedReader xmlReader = new BufferedReader(xmlStreamReader);
>
>         StringBuffer xml = new StringBuffer();
>         String line = null;
>         while((line = xmlReader.readLine()) != null)
>         {
>             xml.append(line+"\n");
>         }
>         System.out.println("\t XML Payload: " + xml.toString());
So you have XML posted to your servlet/JSP and you would like in turn
to post it back to another URL on the same server; is that it? In Java
you should be able to do that doing a forward with the servlet API.
Maybe I am asking too many questions :), but I am wondering why you
would need to do that, and if there is another way to do it within
Orbeon that wouldn't require you to write Java code.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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
Reply | Threaded
Open this post in threaded view
|

Re: Passing XML into a page from a separate Java app

Dustin Henson-2

Hi Alex,

Thanks for responding:

Here's the background:
While adding the hibernate database access tools to our initial all Orbeon app. the database developer ran into a series of xml parsing conflicts with the Orbeon libraries that we couldn't resolve. For this and other reasons we have opted to deploy the dynamic processing side of the application from a separate WAR that uses JSP pages to send xhtml back. Using the new 3.6 functionality the Orbeon engine applies all the Ajax and cool GUI to the output. We have this working, the user can step through our series of screens, the Java controller receives the XML output from each page, etc.

The problem:
Right now XML exchange from page to page is broken. The java application sees the XML, but it does not flow into the following data entry page to have additional data added to it. I could probably accomplish this with standard Orbeon configuration, but the controller will also need to insert data into the XML document. For instance the java code will need to add a dynamically generated transaction number to the XML that the user can keep for his records.

I haven't found any documentation on how to pass data from a JSP page in a separate WAR so that Orbeon will include it in the final page. I'm continuing to try different approaches to pass the XML on, but I though I'd through it up to the list to see if anyone has already done this.


Thanks for any help you can give.
-Dustin



On 1/15/08, Alessandro Vernet <[hidden email]> wrote:
Dustin,

On Jan 14, 2008 10:04 PM, Dustin Henson <[hidden email]> wrote:

> I'm running Orbeon 3.6 as a separate service from my JSP application. I
> have a simple Java controller that does some processing and then directs
> the flow to the next page. I am reading the XML response from the
> previous page with the code below. Can anyone tell me how, after I make
> changes to the XML, I can pass the new version into the following page?
>
>         // Check the XML payload
>         ServletInputStream xmlStream = request.getInputStream();
>         InputStreamReader xmlStreamReader = new InputStreamReader(xmlStream);
>         BufferedReader xmlReader = new BufferedReader(xmlStreamReader);
>
>         StringBuffer xml = new StringBuffer();
>         String line = null;
>         while((line = xmlReader.readLine ()) != null)
>         {
>             xml.append(line+"\n");
>         }
>         System.out.println("\t XML Payload: " + xml.toString());

So you have XML posted to your servlet/JSP and you would like in turn
to post it back to another URL on the same server; is that it? In Java
you should be able to do that doing a forward with the servlet API.
Maybe I am asking too many questions :), but I am wondering why you
would need to do that, and if there is another way to do it within
Orbeon that wouldn't require you to write Java code.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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: Passing XML into a page from a separate Java app

Alessandro Vernet
Administrator
Dustin,

On Jan 15, 2008 8:04 PM, Dustin Henson <[hidden email]> wrote:

> The problem:
> Right now XML exchange from page to page is broken. The java application
> sees the XML, but it does not flow into the following data entry page to
> have additional data added to it. I could probably accomplish this with
> standard Orbeon configuration, but the controller will also need to insert
> data into the XML document. For instance the java code will need to add a
> dynamically generated transaction number to the XML that the user can keep
> for his records.
>
> I haven't found any documentation on how to pass data from a JSP page in a
> separate WAR so that Orbeon will include it in the final page. I'm
> continuing to try different approaches to pass the XML on, but I though I'd
> through it up to the list to see if anyone has already done this.
So it seems you are using separate deployment (as documented on
http://www.orbeon.com/ops/doc/reference-xforms-java). Is that right?
If you are, HTTP requests from the browser are always handled by your
own servlet. If you have an XML document that you want to "pass to
XFoms", you can "write it" inside an <xforms:instance> ... your XML
here ... </xforms:instance>. Or am I misunderstanding your setup?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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
Reply | Threaded
Open this post in threaded view
|

Re: Passing XML into a page from a separate Java app

Dustin Henson-2
Hi Alex,

Yes, that is exactly it and that is the guide I followed, plus a few needed tweaks I found in the forums to make paths work.. Last night I figured out that I had to insert the XML into a <xforms:instance id="default-instance"> tag. The problem I'm having what that is Orbeon is not handling the XML the same when it is hard coded in the tag as when it is in a file.

Switching from :
<xforms:instance src="/myapp/xml/who.xml" id="default-instance"/>

To:
<xforms:instance id="default-instance">
    <IDTIncident xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/idtheft/xml/who.xsd">
        <IncidentIdentifier></IncidentIdentifier>
        <IncidentReportingDate></IncidentReportingDate>
        <IncidentReportingTime></IncidentReportingTime>
        <IncidentDate></IncidentDate>
        <IncidentTime>00:00:00</IncidentTime>
        ... other data in who.xml
    </IDTIncident>
</xforms:instance>

On the resulting pages the data entry fields are missing and only their labels are showing. Any idea what would cause this?

Thanks,
Dustin

On 1/17/08, Alessandro Vernet <[hidden email]> wrote:
Dustin,

On Jan 15, 2008 8:04 PM, Dustin Henson <[hidden email]> wrote:
> The problem:
> Right now XML exchange from page to page is broken. The java application
> sees the XML, but it does not flow into the following data entry page to
> have additional data added to it. I could probably accomplish this with
> standard Orbeon configuration, but the controller will also need to insert
> data into the XML document. For instance the java code will need to add a
> dynamically generated transaction number to the XML that the user can keep
> for his records.
>
> I haven't found any documentation on how to pass data from a JSP page in a
> separate WAR so that Orbeon will include it in the final page. I'm
> continuing to try different approaches to pass the XML on, but I though I'd
> through it up to the list to see if anyone has already done this.

So it seems you are using separate deployment (as documented on
http://www.orbeon.com/ops/doc/reference-xforms-java). Is that right?
If you are, HTTP requests from the browser are always handled by your
own servlet. If you have an XML document that you want to "pass to
XFoms", you can "write it" inside an <xforms:instance> ... your XML
here ... </xforms:instance>. Or am I misunderstanding your setup?

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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: Passing XML into a page from a separate Java app

Erik Bruchez
Administrator
Yes, try to add xmlns="" on the <IDTIncident> element.

-Erik

On Jan 18, 2008, at 3:37 AM, Dustin Henson wrote:

> Hi Alex,
>
> Yes, that is exactly it and that is the guide I followed, plus a few  
> needed tweaks I found in the forums to make paths work.. Last night  
> I figured out that I had to insert the XML into a <xforms:instance  
> id="default-instance"> tag. The problem I'm having what that is  
> Orbeon is not handling the XML the same when it is hard coded in the  
> tag as when it is in a file.
>
> Switching from :
> <xforms:instance src="/myapp/xml/who.xml" id="default-instance"/>
>
> To:
> <xforms:instance id="default-instance">
>     <IDTIncident xmlns:xsi="http://www.w3.org/2001/XMLSchema- 
> instance" xsi:noNamespaceSchemaLocation="/idtheft/xml/who.xsd">
>         <IncidentIdentifier></IncidentIdentifier>
>         <IncidentReportingDate></IncidentReportingDate>
>         <IncidentReportingTime></IncidentReportingTime>
>         <IncidentDate></IncidentDate>
>         <IncidentTime>00:00:00</IncidentTime>
>         ... other data in who.xml
>     </IDTIncident>
> </xforms:instance>
>
> On the resulting pages the data entry fields are missing and only  
> their labels are showing. Any idea what would cause this?
>
> Thanks,
> Dustin
>
> On 1/17/08, Alessandro Vernet <[hidden email]> wrote: Dustin,
>
> On Jan 15, 2008 8:04 PM, Dustin Henson <[hidden email]>  
> wrote:
> > The problem:
> > Right now XML exchange from page to page is broken. The java  
> application
> > sees the XML, but it does not flow into the following data entry  
> page to
> > have additional data added to it. I could probably accomplish this  
> with
> > standard Orbeon configuration, but the controller will also need  
> to insert
> > data into the XML document. For instance the java code will need  
> to add a
> > dynamically generated transaction number to the XML that the user  
> can keep
> > for his records.
> >
> > I haven't found any documentation on how to pass data from a JSP  
> page in a
> > separate WAR so that Orbeon will include it in the final page. I'm
> > continuing to try different approaches to pass the XML on, but I  
> though I'd
> > through it up to the list to see if anyone has already done this.
>
> So it seems you are using separate deployment (as documented on
> http://www.orbeon.com/ops/doc/reference-xforms-java). Is that right?
> If you are, HTTP requests from the browser are always handled by your
> own servlet. If you have an XML document that you want to "pass to
> XFoms", you can "write it" inside an <xforms:instance> ... your XML
> here ... </xforms:instance>. Or am I misunderstanding your setup?
>
> Alex
> --
> Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
> http://www.orbeon.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
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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
Reply | Threaded
Open this post in threaded view
|

Re: Passing XML into a page from a separate Java app

Alessandro Vernet
Administrator
On Jan 18, 2008 11:50 AM, Erik Bruchez <[hidden email]> wrote:
> Yes, try to add xmlns="" on the <IDTIncident> element.

If that is the problem, my favorite recommendation will be not to use
default namespaces to avoid this type of problems :).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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
Reply | Threaded
Open this post in threaded view
|

Re: Passing XML into a page from a separate Java app

Dustin Henson-2

Thanks this did the trick.

The one catch is that the XML returned by the xforms has the xmlns="" removed from it. It also has <?xml version="1.0" encoding="UTF-8"?> added to the beginning. In order to make the get the XML to flow from page to page I need to remove the XML declaration and add the xmlns="" back in.

Thanks,
Dustin

On 1/23/08, Dustin Henson <[hidden email]> wrote:
Thanks this did the trick.

The one catch is that the XML returned by the xforms has the xmlns="" removed from it. It also has <?xml version="1.0" encoding="UTF-8"?> added to the beginning. In order to make the get the XML to flow from page to page I need to remove the XML declaration and add the xmlns="" back in.

Thanks,
Dustin

On 1/18/08, Alessandro Vernet <[hidden email]> wrote:
On Jan 18, 2008 11:50 AM, Erik Bruchez <[hidden email]> wrote:
> Yes, try to add xmlns="" on the <IDTIncident> element.

If that is the problem, my favorite recommendation will be not to use
default namespaces to avoid this type of problems :).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
<a href="http://www.orbeon.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.orbeon.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: <a href="http://www.ow2.org/wws" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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: Passing XML into a page from a separate Java app

Alessandro Vernet
Administrator
Dustin,

On Jan 23, 2008 7:55 PM, Dustin Henson <[hidden email]> wrote:
> The one catch is that the XML returned by the xforms has the xmlns=""
> removed from it. It also has <?xml version="1.0" encoding="UTF-8"?> added to
> the beginning. In order to make the get the XML to flow from page to page I
> need to remove the XML declaration and add the xmlns="" back in.

Right. Unless you don't have a default namespace declared in the page,
in which case you can just insert the XML without worrying about a
xmlns="".

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/


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