• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Listener on URL

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok guys and gals, please be nice to me. This may seem like a newb question and it probably is, but here is my situation.

I need to write a servlet (or web service or whatever I need to write) that listens for xml code that will be streamed to it and then parses the xml and processes it.

In other words, the servlet (or jsp) just sits there and waits for an incoming request. Another server will call this jsp or servlet and pass it an xml stream. I'll input the stream and process it.

I know how to parse and process the xml. i just need to get started on writing the file that will listen and stream in the xml.

Hopefully this makes sense and somebody may be willing to help me out.

Thanks for the help
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if I am getting the requirement right. Are you trying to log or write processed XML to files on the server?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you talking about controller servlet ?
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All servlets listen. They're not continuously-executing processes, nor are they callable subroutines. They're modules that process requests routed to them by the webapp dispatcher.

In the case of processing an XML upload, you'd typically embed the XML in an HTTP POST request. You would then put the parsing/processing code in the servlet's doPost() method. The raw data stream is accessible via the request.getInputStream() method, although if you use a form with a file upload button, the data will instead usually be spooled to a temporary location that you would access.
 
George Carlson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:All servlets listen. They're not continuously-executing processes, nor are they callable subroutines. They're modules that process requests routed to them by the webapp dispatcher.

In the case of processing an XML upload, you'd typically embed the XML in an HTTP POST request. You would then put the parsing/processing code in the servlet's doPost() method. The raw data stream is accessible via the request.getInputStream() method, although if you use a form with a file upload button, the data will instead usually be spooled to a temporary location that you would access.



Thanks. So, I don't need to do anything different if the servers are posting a stream from another server (possibly in another state or country). I've done a lot of servlet work, but I always call it from my local server.

Thanks again.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's right. When your servlet processes a request, it doesn't know or care where the request comes from or how it was produced or what was in the mind of the person who caused it to be produced.
 
George Carlson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:That's right. When your servlet processes a request, it doesn't know or care where the request comes from or how it was produced or what was in the mind of the person who caused it to be produced.



Great. Thanks for the help.
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic