on 05-28-2006 7:05 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Very simple.Put some log statements in your servlet!!
If you are not aware of how to enable logging / tracing in J2EE applications in WebAS then just put System.out statements in your servlet which would be sent to your defaultTrace.trc file in WebAS. You need to do some configurations in visual administrator for the same.
As mentioned in my previous post you need to change a few settings using Visual administrator.
Log on to Visual administrator and
1. Select the LogConfigurator Service in the Cluster/Server/Services/LogConfigurator Node
2. Select the Locations Tab.
3. Expand and select ROOT LOCATION/System/out.
4. Select Severity: "All".
5. Save your changes by clicking the disk symbol.
<b>Reward helpful answers!!!</b>
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
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/
<ns0:purchase_order_MT xmlns:ns0="http://filetohttp.com">null</ns0:purchase_order_MT>
Help me
Thanks
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"?>
<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>
Please help me
Thanks
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.