File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Return XML/HTTP frm a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Return XML/HTTP frm a servlet" Watch "Return XML/HTTP frm a servlet" New topic

Return XML/HTTP frm a servlet

Sunetra Sen
Ranch Hand

Joined: Feb 17, 2005
Posts: 43
I want to design a servlet which will will be invoked from an application residing in a different web server and the second application will get back an XML blob as a return.
The whole connection will be based on HTTP ofcourse(no SOAP etc).
Any suggestions on how to achieve this?

Thanks in advance,
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
It seems like you have answered your own question almost.

1. Servlet gets invoked with request
2. Build relevant XML
3. Get response output stream
4. Write content type
5. Dump XML
6. Profit!

Do you have a more specific question?

I'd recommend reading this servlet tutorial.

This code might be a very simple example of what you want. It doen't do any error checking and I make no guarantees to it's correctness!

I agree. Here's the link:
subject: Return XML/HTTP frm a servlet
It's not a secret anymore!