Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 28, 2006 at 01:45 PM

    Hi Datta,

    <i>XML page cannot be displayed.

    XML document must have a top level element.</i>

    Check your XML output from XI is well Structured ? Pick up the XML file from the XI and check in XML SPy or any xml editors is it correct format or not..

    Or Even you can give that input to your java application and check independently..as an Independent application..

    Thanks,

    Moorthy

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi

      I opened the same XML in IE6.0, it is well formed

      This is my XML file that am giving as input for my J2EE application:

      <?xml version="1.0" encoding="UTF-8"?>

      http://filetohttp.com">

      <ORDER_HEADER_IN>

      <purchase_date/>

      <purchase_group/>

      <purchase_org/>

      </ORDER_HEADER_IN>

      <vendor/>

      <ORDER_ITEMS_IN>

      <item>

      <storage_location/>

      <plant/>

      <quantity/>

      <material/>

      </item>

      </ORDER_ITEMS_IN>

      <ORDER_SCHEDULES_IN>

      <item>

      <delivery_date/>

      </item>

      </ORDER_SCHEDULES_IN>

      </ns0:purchase_order_MT>

      Please help me

      Thanks

  • avatar image
    Former Member
    May 28, 2006 at 06:39 PM

    Datta,

    Error indicates your final XML structure is not correct. Its missing some element which result in error.

    You can copy or download XML message from SXMB_MONI and try to open same (.xml file) in XML spy ( XML tool). You can download this software from net and is free.

    Hope this will help you to solve problem.

    Cheers,

    Nilesh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi

      I got this in my browser, which says, the code is not able to retrieve the XML message sent from XI or what..?

      when i gave the following in my IE browser:

      http://localhost:7001/Invoke/DisplayRes/

      http://filetohttp.com">null

      Help me

      Thanks