How to display XML file that XI sent to my j2ee appl?

Hi,
In my scenario File->XI->J2EE appl.
I got 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.All helpful answers are highly rewarded.
Thanks

Hi
Can anyone tell me how XI sends messages to applications like J2EE. In REceiver comm channel, I think we specify about the target system like J2EE appl.
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/
Authentication Type:Use Logon Data for SAP System
Content Type: text/xml
Username:   xiappluser
password:   xx
XML code:   UTF-8
I suppose XI sends msgs to http://localhost:7001/Invoke/DisplayRes/........
in this example if am correct?
Then I have given all tyhe necessary setting but my servlet is not able to display XML msg in browser?
This is my servlet code:
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
     PrintWriter out = response.getWriter();
     BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
     String inputLine;
     StringBuffer sBuf = new StringBuffer();
        response.setContentType("text/xml");
     while ((inputLine = brin.readLine()) != null)
         sBuf.append(inputLine);
         out.println("hi");            
            out.println(sBuf.toString());
         brin.close();
         out.flush();
What went wrong?
Help me, all helpful answers are highly rewarded.
Thanks

Similar Messages

  • How to display XML file in java swing

    hi all
    now i do my M.Sc., project on data maining.this time i have one problem,thats i can't display XML file in swing frame.so any one know this plz give me that idea or code.
    Thanks to all.
    RSK

    One way of doing that is to use JDOM...
    u create an xml tree, and then output using XMLOutputter class...it will be displayed in text...im not sure if thats what u want...however, if u do want to represent it visually then u may need to draw a tree...u may use the Graphics2D for that...there are alot of ways to do such thing, and the 2 possibilities arent the best...depends on what u want...elaborate more pls.

  • 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

    Hi
    Can anyone tell me how XI sends messages to applications like J2EE. In REceiver comm channel, I think we specify about the target system like J2EE appl.
    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/
    Authentication Type:Use Logon Data for SAP System
    Content Type: text/xml
    Username:   xiappluser
    password:   xx
    XML code:   UTF-8
    I suppose XI sends msgs to http://localhost:7001/Invoke/DisplayRes/........
    in this example if am correct?
    Then I have given all tyhe necessary setting but my servlet is not able to display XML msg in browser?
    This is my servlet code:
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
         PrintWriter out = response.getWriter();
         BufferedReader brin =new BufferedReader(new InputStreamReader(request.getInputStream()));
         String inputLine;
         StringBuffer sBuf = new StringBuffer();
            response.setContentType("text/xml");
         while ((inputLine = brin.readLine()) != null)
             sBuf.append(inputLine);
             out.println("hi");            
                out.println(sBuf.toString());
             brin.close();
             out.flush();
    What went wrong?
    Help me, all helpful answers are highly rewarded.
    Thanks

  • How to get XML file using servlets that XI sent to my J2EE appl?

    Hi All!
    I have a scenario like XI sends xml file to j2ee application. In my J2EE application my servlet receives this xml. Will the xml file be in my HTTPServletRequest object? if so how to get that file from Request object.
    Please help me its urgent, Any code help is highly appreciated.
    My xml file will be like this:
    <ns0:Http_Message_Type_Demo
    xmlns:ns0="http://abcdemo.com">
    <Name>ABC</Name>
    <RollNo>123</RollNo>
    <Address>a-4</Address>
    </ns0:Http_Message_Type_Demo>
    somebody should help me!please
    Thanks

    Hi,
    You can use HTTPServletRequest object to get the XML payload.
    BufferedReader reader = request.getReader(); //gets XML payload
    String line = reader.readLine(); // to read the XML payload line by line
    (request is the HTTPServletRequest object)
    Regards,
    Uma

  • Hi How to get XML file from servlet that XI sent to my J2EE appl?

    Hi All!
    I have a scenario like XI sends xml file to j2ee application. In my J2EE application my servlet receives this xml. Will the xml file be in my HTTPServletRequest object? if so how to get that file from Request object.
    Please help me its urgent, Any code help is highly appreciated.
    My xml file will be like this:
    <ns0:Http_Message_Type_Demo
    xmlns:ns0="http://abcdemo.com">
    <Name>ABC</Name>
    <RollNo>123</RollNo>
    <Address>a-4</Address>
    </ns0:Http_Message_Type_Demo>
    somebody should help me!please
    Thanks

    Hi,
    You can use HTTPServletRequest object to get the XML payload.
    BufferedReader reader = request.getReader(); //gets XML payload
    String line = reader.readLine(); // to read the XML payload line by line
    (request is the HTTPServletRequest object)
    Regards,
    Uma

  • Hi all! I want to display xml file that i receive in my request object.

    I am a newbie to servlet technology, my requirement is like thsi:
    the XML file is like this:
    <ns0:Http_Message_Type_Demo xmlns:ns0="http://abcdemo.com">
    <Name>ABC</Name>
    <RollNo>123</RollNo>
    <Address>a-2</Address>
    </ns0:Http_Message_Type_Demo>
    I will receive an xml file in my HTTPRequest object. How to display the xml file as it is in browser.
    Please help me Its urgent!
    Thanks in advance!

    Hi
    please have a look at the test code which generates a static xml code , might be the change reqd here is that the request you are getting is xml which has to be passed to the response object
    public class test extends HttpServlet
      public void doGet
        HttpServletRequest  req,   // This provides information sent by the browser
        HttpServletResponse res    // This is used to send information back to the browser
      ) throws
        ServletException,          // General exception that should be thrown if there
                                   // is a unrecoverable error in the Servlet
        IOException              
        // Set the MIME type for the information being sent to the browser.
        // In this case, we are going to send back HTML
        <i> <b>  res.setContentType( "text/xml" );</b></i>
        // Get a reference to the output stream.
        // Anything written to this stream is sent directly to the browser
        // (The browser sees this as its input).
           ServletOutputStream out = res.getOutputStream();
        // The following println statements create an HTML page.
        // Notice that the <html></html>, <head></head>, and <body></body>
        // tags are all properly formed HTML syntax.
           out.println("<?xml version=\"1.0\"?>" );
           out.println("<?xml:stylesheet type=\"text/xsl\" href=\"file:///c:/servlets/test.xsl\"?>");
           out.println("<persons>");
           out.println("<person><firstname>Oren</firstname><lastname>Ben-KiKi</lastname></person>");
           out.println("</persons>");
    hope this helps , please mark helpul answers
    regards
    rajeshkr

  • How to display XML file in browser using Servlets?

    Hi My XML file is like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:purchase_order_MT xmlns:ns0="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>
    My Servlet receives this XML file and it should display the above XML as it is, How to do that?
    Please help me I have posted same question in many forums but i got no proper reply.
    Thanks a lot

    If you only need to display it, consider your HttpServletRequest just as byte stream. :) Just read from ServletInputStream and write it back into ServletOutputStream of HttpServletResponse.
    If you want to process incoming XML, please give some details first, what exactly you want to do. :)

  • How to display XML file as is it is in my browser using servlets???

    I have a question like my servlet receives an XML file in its request object. I just need display the same XML file as it is in my browser. How to do that? Please help me out. I have searched so many blogs, but i did not get right solution.
    My XML file file will be like this:
    <ns0:Http_Message_Type_Demo xmlns:ns0="http://abcdemo.com">
    <Name>A</Name>
    <RollNo>123</RollNo>
    <Address>a2</Address>
    </ns0:Http_Message_Type_Demo>
    Thnks

    You mean you want to see the XML source?
    You need to replace the characters '<' and '&' with corresponding entities '&lt;' and '&amp;'. You can use replaceAll, but do the ampersands first.
    Then I suggest you probably want to put them in a <PRE> block.

  • How to display XML file(as markup) in jsp page..?

    Hi All,
    * I have to display the XML file(as markup) in jsp page (Tree Format)....
    * My XML file is an java.io.file object , and how to view this XML file on my JSP page...........
    Thanks in Advance,
    JavaImran

    You mean you want to see the XML source?
    You need to replace the characters '<' and '&' with corresponding entities '&lt;' and '&amp;'. You can use replaceAll, but do the ampersands first.
    Then I suggest you probably want to put them in a <PRE> block.

  • How to read xml file that has changing element names?

    Idon't know much about xml, nor reading it with java, but I have this problem with reading xml file. The file something like this:
    <configuration>
       <DEV001>
          <serial>001</serial>
          <id>number 1</id>
       </DEV001>
       <DEV002>
          <serial>002</serial>
          <id>number 2</id>
       </DEV002>
    </configuration>I have imported the org.w3c.dom.* api, that I use for parsing. I don't know is this a generic or a parser specific issue, but how can I get all the nodes starting with "DEV" into a NodeList?
    If you know a solution for this with another parser, please share it. I have no reason to use that specific parser, I just found a sample using that.
    kari-matti

    Well, NodeList is an interface, so you cannot construct one and put the "good" elements into it. But, you might be able to cast the NodeList with all of the children of the root into an IIOMetadaNode (which is the class that implements the NodeList interface. That class has a removeChild() method that might be able to remove the text nodes and any that don't start with DEV.
    But, if you remove nodes, and still want to do things with the full DOM Document, be very careful and run tests. It may remove those nodes from the full Document.
    If, on the other hand, the printingData( Nodelist nl) method could be modified so it takes an ArrayList or some other collection, it is very simple.
    Just create an ArrayList, and when you find an element starting with DEV, add it to the ArrayList. When you are done, process that list and you are finished.
    Dave Patterson

  • How to Display XML in a UIWebView?

    Hi everybody. I like how Safari displays XML files and I would like to emulate that functionality in an iPhone UIWebView. However, I just can't get it to look the same when passing a URL to the UIWebView.
    For example, take a simple XML file like http://molottery.com/rss-num.xml. Viewing that in Safari looks okay, but passing that same URL into a UIWebView just shows a blank page.
    I changed the web protocol from http to feed (feed://molottery.com/rss-num.xml) and it launches the page in Safari instead of my UIWebView. Looks good, but it quit my app... :- (
    I noticed that XML files on the iPhone get re-routed through reader.mac.com so I tried appending that to my URL (http://reader.mac.com/mobile/v1/http://molottery.com/rss-num.xml) but that did not work either.
    When I tried URLEncoding the string like Safari does (http://reader.mac.com/mobile/v1/http%3A%2F%2Fmolottery.com%2Frss-num.xml) I get a UIWebView saying that "This Application Is Viewable Only On iPhone".
    So how can I emulate the regular Safari XML functionality inside my UIWebView? I will post my code upon request, if that will help. Any assistance from the Developer Community would be greatly appreciated.
    Thanks!

    You may have better luck in the iPhone dev forums...
    https://devforums.apple.com/community/iphone/web

  • How do i edit a PDF file that was sent to me in an email?

    How do i edit a PDF file that was sent to me in an email?

    Depends on the extent of the edits. You will need Acrobat in any case. If the edits or minor, you can use the text edit tool. For major edits, you need to request the original file be sent or see if you can Save As a DOC or related file type. PDFs are not really structured for editing and you are asking for a lot of grief if you want to do much. Exporting is the best way, or even better simply asking the author for the original (non-PDF type).

  • I can not print a pdf file that was sent in an email.  I get the error message that adobe could not

    I can not print a pdf file that was sent in an email.  I get an adobe error message that it can not print with an ok to check and when i do I get another adobe error message that says I did not select a page to print. I have downloaded the latest adobe download.  I forwarded the email to my husband and he printed the document just fine.

    This first question which comes to mind is how do you display the pdf file in the browser?
    For this the browser uses a plug in (e.g. adobe reader) which already has the ability to print the pdf file. Depending on the version of your plug in, printing is started differently.
    Timo
    Ps: which jdev version do you use?

  • Not able to display XML file

    I'm running Safari 6.0.2. And previous to a recent update I was able to drag a XML file into the browser and it would display the contents. Now it does nothing. I'm guessing with the last update it removed an extension that used to allow this to happen. Can anyone suggest a good XML display extention they've had good luck with.
    Thanks!

    The only browser I am aware of that currently knows how to
    display XML is IE5. Otherwise, you will need to convert the XML
    into well-formed HTML or xHTML through and XSLT stylesheet.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Ravinder Kamal (guest) wrote:
    : I not able to display the XML file in my browser even after
    using
    : using an XSL Stylesheet. I am not using IE5 browser.
    : The output of command :
    : C\>java XSLSample iden.xsl empl.xml
    : <root>
    : <ROWSET>
    : <ROW num="1">
    : <EMP_ID>PMA42628M</EMP_ID>
    : <FNAME>Paolo</FNAME>
    : <MINIT>M</MINIT>
    : <LNAME>Accorti</LNAME>
    : <JOB_ID>13</JOB_ID>
    : <JOB_LVL>35</JOB_LVL>
    : <PUB_ID>0877</PUB_ID>
    : <HIRE_DATE>1992-08-27 00:00:00.0</HIRE_DATE>
    : </ROW>
    : </root>
    : where iden.xsl is :-
    : <?xml version="1.0"?>
    : <!-- Identity transformation -->
    : <xsl:stylesheet
    xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    : <xsl:template match="*|@*|comment()|pi()|text()">
    : <xsl:copy>
    : <xsl:apply-templates
    : select="*|@*|comment()|pi()|text()"/>
    : </xsl:copy>
    : </xsl:template>
    : </xsl:stylesheet>
    : -R.S.Kamal
    null

  • How to generate xml-file for SAP Fiori (UI add-on) with Solution Manager 7.0.1?

    Hello Guru,
    could you please help with my issue with Fiori Installation.
    We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
    Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
    But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
    But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option  "install Add-on" as it written in Guide for ui add-on installation.
    Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
    If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
    Thanks in advance for any help!!!
    Bets regards,
    Natalia.

    Hello Guru,
    could you please help with my issue with Fiori Installation.
    We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
    Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
    But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
    But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option  "install Add-on" as it written in Guide for ui add-on installation.
    Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
    If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
    Thanks in advance for any help!!!
    Bets regards,
    Natalia.

Maybe you are looking for

  • Discrepancy in Purchasing cube

    Hi Frndz, There is a problem in Invoice amount.Total invoice amount is coming differently in BW side compared to R/3. Even i am not able to get how they are calculating invoice amount as posting date. Please help me on this regard.

  • Scope of Planning for Total Planning

    Hi SAP Gurus, My Client Scenario is as follows They import Spare Part materials from abroad to a Main Warehouse (defined as Plant in SAP) and then do stock transfer to around 60+ warehouse in different states (each defined as Plant in SAP). At any ti

  • Problem in creating model

    Hi, While creating model i am getting this error in the last step i.e. after selecting the BAPI function. what might be the pro blem can any one help me plz. [Warning]:     Creating a connection with Metamodel language <en> failed.  Continuing with l

  • How to write this query.. Please Help

    Hello Guys, I have a table that contains all possible leave types, it is a look up table. Table name is Att_Leave_Types and data in the table is: Leavetype_ID Leavetype_Desc 1 Annaul 2 Sick 3 Casual 4 Long 5 Maternity Now, another table Att_Emp_Leave

  • Why can't I import non photographic jpg images into iPhoto?

    I'd really love to use this feature as I have some vector based jpgs I'd loive to sue in a calendar! They are now jogs but when I try to import them it says " the file could not be imported" import failed