• 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

Sending XML files using HTTP Request/Response?

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all!

I am not sure if this is the right forum for this question, please redirect me if this is not.

With that, here is a question ... from a novice really.

We have a situation where we need to send an XML file from our server to another server..URL really (http:// abc.com/xyz.crspx). This URL expects this XML file, reads and sends us back a response (with success or error codes etc) which I need to write to a file and save. The XML file itself contains the authentication information which the remote server will use before it sends a response back.

Is this something I should use HTTP Request/Response for. Can I do this in a batch mode where this program runs every 10 mts and picks up an XML file in a predetermined location and transmits it. Are there limitations to the size of the XML file.

Any direction on how to proceed will be very helpful. Suggestions & resources are appreciated.

Thanks much!
V
[ August 09, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you are desribing (I think) is a file upload from one server to another. And yes, this can be performed using the request/response mechanism just as a file can be uploaded from a client to a server.

You'll need to make sure to follow the HTTP protocol carefully with regards to file uploading using a multi-part request.

First thing I'd do is to check out tools like HttpUnit to see if they have already done a lot of the heavy lifting for you.
 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear!

I looked up HTTPUnit on Google for a bit. It looks like a framework for website testing and is quite comprehensive. But upon a first look, I couldn't find anything quite that relevant to what I am trying to do.

Could you, perhaps, recommend any other simpler resources that might help me get started on developing the Http request/response streams. The XML files that we plan to transmit may not be too big and atleast for the first pass, I hope to get them transmitted in one request without having to break them down and make it a multi-part transmission.

Thanks in Advancnce
Veni
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Veni Velkoor:

I looked up HTTPUnit on Google for a bit. It looks like a framework for website testing and is quite comprehensive. But upon a first look, I couldn't find anything quite that relevant to what I am trying to do.



Even though HttpUnit is a testing framework, it has tool classes that make it easy to initiate requests of various types under program control that are intended to be used when writing automated tests, but are also very useful for doing the types of things you are doing as well. What support they may have for file uploading requests, I do not know, but it's the first thing I'd check before striving out to write something on my own.

Setting out from scratch, I'd get a good handle on how to make HTTP multi-part requests and employ the URL and URLConnection classes.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpClient supports file uploads too:
http://jakarta.apache.org/commons/httpclient/
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:
HttpClient supports file uploads too:
http://jakarta.apache.org/commons/httpclient/



Excellent!
 
Veni Velkoor
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ben & Bear! That is some useful information.

I will check in to it and get back.

Have a good one!
V
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, HTTPUnit is more than a testing framework. I once used it to create a BOT that picks a randomn page from encylopedia (http://en.wikipedia.org/wiki/Special:Randompage), parse the text and post it in a forum every 2 minutes. Ah! that was fun....
 
reply
    Bookmark Topic Watch Topic
  • New Topic