Skip to Content

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

XML file is not being displayed in browser? Why?

Hi all!

I have a secnario file->XI->J2EE appl.

I am using File sender adapter and HTTP Receiver adapter.

I placed XML file in D:\somedir of my machine, it is picking up well by XI, <b>all i want to know is how XI sends this XML file to my J2EE Appl.</b>Because my servlet should display the same XML file in browser. I deployed my J2EE appl on weblogic application server9.0 I am getting the following error:

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

-


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

These are settings that i have given in my Receiver HTTP adapter:

Aadapter Type: HTTP

Receiver

Transport Protocol: HTTP1.0

Message Protocol: XI payload in HTTP body

Adapter Engine: Integration Server

Addressing Type: URL address

Target host: localhost

Service Number: 7001(Port number of Weblogic appl server--where my J2EE appl is deployed).

Path : /Invoke/DisplayRes/(Context path of J2EE appl)

Authentication Type:Use Logon Data for SAP System

Content Type: text/xml

Username: xiappluser

password: xx

XML code: UTF-8

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.println(sBuf.toString());

brin.close();

out.flush();

}

}

Where i went wrong please help me,

NOTE: I want to know how XI sends XML file to my J2EE appl. I suppose my servlet receives it in request object.If so can i use like:

response.setContentType("text/xml");

String xmlFile = request.getParameter("myXMLFile");

PrintWriter out = response.getWriter();

out.write(xmlFile);

out.flush();

out.close();

Please help me!

Thanks a lot!

Former Member

Helpful Answer

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