Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Return XML/HTTP frm a servlet

 
Sunetra Sen
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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,
Sunetra.
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic