wood burning stoves 2.0*
The moose likes Servlets and the fly likes Servlet & XML Request-Response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet & XML Request-Response" Watch "Servlet & XML Request-Response" New topic
Author

Servlet & XML Request-Response

Yuvraj Singh
Greenhorn

Joined: Apr 30, 2002
Posts: 11
Hi All,
How Servlet can accept XML request & send back XML response??
In my application I have to build a Servlet which should take request in XML format from Other Server & pass it to EJB for processing & recieve response in XML format & send it back to the other Server..
Any suggestion,
Thanks in advance...

[ May 31, 2002: Message edited by: M Sharma ]
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

sure... in your response simply set the ContentType to "text/xml"
Also, Please adjust your Displayed Name to meet the JavaRanch Naming Policy -- particularly it should be a first name, space, full last name (not initial). You can change it here.
Thanks!
Yuvraj Singh
Greenhorn

Joined: Apr 30, 2002
Posts: 11
Hi Jessica ,
You are right about Response ContentType.
But my problem is that I am getting request from other server(IIS not from HTML Browser) in the form of a String(which contains XML content).
So,how will I accept this Request(I don't know the name of String as it's dynamiclly generated so Request.getParameter("Name"); will not work) & sends back the Response(again String containing XML content).
I have changed my Displayed name..
Sorry,if am asking stupid Questions..
Regards
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
You can read the content of the request as an InputStream and handle it just as if you were reading a file.
InputStream is = req.getInputStream();
Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet & XML Request-Response