Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to display an XML file as it is in browser that XI sent to my J2EE appl

Hi all!

I have a scenario like File->XI->J2EE appl.

The file is getting picked up from my machine by XI.

Now XI should send that XML file to my J2EE appl.

My servlet receives that XML and displays as it is in browser. But am getting some error like:

XML page cannot be displayed.

XML document must have a top level element. Error processing resource 'http://localhost:7001/Invoke/DisplayRes'.

I deployed my .ear file on BEA Weblogic application server9.0

I found no error when i tested in SXI_MONI and RWB->Message monitor as well.

This is my servlet code:

public class DisplayRes extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

doPost(request,response);

}

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException

{

BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));

String inputLine;

StringBuffer sBuf = new StringBuffer();

PrintWriter out = response.getWriter();

response.setContentType("text/xml");

while ((inputLine = brin.readLine()) != null)

sBuf.append(inputLine);

//out.setContentType("text/xml");

//out.println(sBuf.toString());

out.write(sBuf.toString());

brin.close();

out.flush();

}

}

what went wrong? Help me

Thanks

Former Member
Not what you were looking for? View more on this topic or Ask a question