aspose file tools*
The moose likes XML and Related Technologies and the fly likes passing xml on wire Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "passing xml on wire" Watch "passing xml on wire" New topic
Author

passing xml on wire

sony gam
Greenhorn

Joined: Jun 20, 2001
Posts: 28
Hi,
I have a jsp page (which is actually an XML file, with some java code scriplets in it).
When a client request through a ejb, in my ejb I will connect to this jsp page, so that it excutes and then I will have to send the input stream from this httpconnection to the client, which is over a wire.
So I need some serializble object as a return value.
I was wondering if anyone could help me out here.
Thanks,
Sony Gam
Ganesh Ram
Ranch Hand

Joined: Jul 20, 2001
Posts: 33
I am not sure what the exact issue is.
I am assuming that you have a InputStream to an XML doc. You need to pass this to some remote object.
Your question is how to do this.
Well, I think you can write this to a String and send the String over.
Do you think that is a feasible/possible solution.
sony gam
Greenhorn

Joined: Jun 20, 2001
Posts: 28
Hi Ganesh,
thyanks a lot for responding.
I am sorry if I could nnot make myself clear.
Well, here is my jsp page.
<%@ page import="javax.ejb.*,javax.rmi.*,javax.naming.*,examples.entities.entity.*" %>
<Tag1>
<Tag2>
<%
InitialContext ic = new InitialContext();
EntityHome sHome = (EntityHome)PortableRemoteObject.narrow((EntityHome)ic.lookup("server.entities.Entity"),EntityHome.class);
Collection entities = null;
Entity entity;

try
{
entities= sHome.findEntities();
}
catch(Exception ex)
{}
Iterator it = services.iterator();
while (it.hasNext())
{
try
{
entity = (Entity)PortableRemoteObject.narrow(it.next(),Entity.class);%>
<Entity id=<%=String.valueOf(entity.id())%> description=<%=entity.description()%>>
<% }
catch(Exception re)
{
System.out.println("Remote Exception caught in Navigation manager");
}
}

%>
</Tag2>
<Tag1>
As you can see, it is actually a xml page, but using JSP just for the java scriplets in between. (What this code does is queries the database for some values using an Entity bean)
Now I have a client who invokes an ejb bea on my server.
Then in the server code, using a httpurlconnection object I just connect to the url location where the above jsp page is located.
so the java code embedded in the page gets executed and I have the complete xml file, which looks like this:
<Tag1>
<Tag2>
<Entity id="5" Description="xyz"/>
</Tag2>
</Tag1>
Now I have to send the resultant stream to the client as retrun value for the method he invoked earlier.
What I thought I could do is obtain the inputstream object from the httpurlconnection object I previously used. But as the BufferedInputStream is not serializable I can not send it.
so I was wondering if someone could suggest me something, here.
Thanks,
Sony Gam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: passing xml on wire