Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with approach to problem - HTTP POST to upload an XML file to URL  RSS feed

 
Terry Chambers
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an XML file that I need to be able to upload, via HTTP POST, to a known URL which will accept the file and process it.

I am not sure of the process that I need to take. For example, to "upload a file", do I need to read the file in line by line and then upload it line by line or is there a way to just specify a local file and then upload it?

If you can give me some direction, that would be great.

Thanks
Terry
 
Ed Ward
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kind of depends on the client interface.
If you're going to use a browser and have a user manually select the file, then no, you don't need to read the file at all on the client side. Just make use of one of the file upload utilites available:

commons fileUpload

http jsp file upload search

If this is for a web service or you're not going to use a browser for th UI, you may need to take a different approach though.
 
Terry Chambers
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I guess that is important.

I was thinking of a command line application as it will be run on a schedule.
 
Lino Larios
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, my best guess could be use from java a tool like curl, write a method where call curl and as argument the xml file .



luck!
 
Campbell Ritchie
Sheriff
Posts: 53734
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving thread: too difficult for "beginning". Not quite sure where to move it to. Sorry if I move it to the wrong place
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can very well use commons fileUpload in your programme which takes file location as argument from command line.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!