File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Creating a HTTP request in java and getting it's request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Creating a HTTP request in java and getting it Watch "Creating a HTTP request in java and getting it New topic
Author

Creating a HTTP request in java and getting it's request

David Rocks
Ranch Hand

Joined: Apr 24, 2001
Posts: 162
Hi,
i am trying to discover a way of creating a HTTP request in java. sending it and recieving the response in the code. I have to create an integration in my system with a 'web service' of sorts that returns XML from HTTP. I was going to grap the HTTP attributes from my page in a struts action class and then forward it on. Hopefully i can then block until i get the request of XML and then use that to create my next page on the fly. Does anybody know how this can be done. I am not sure if this is the best forum on JR but there are none more appropriate i believe.
Cheers for any help.
David
Dan Bizman
Ranch Hand

Joined: Feb 25, 2003
Posts: 387
Well, I think you're handling this all wrong, but here's the code you asked for:

Personally, I think you'd be better off if you had the XML-ifier be a part of your web app. You realize that what you're doing is creating two requests for every request? This means that if your server can normally handle a load of about 1000 concurrent requests (I'm making up numbers here), then with your method you'd probably only be able to handle about half that, 500. Not a good idea.
David Rocks
Ranch Hand

Joined: Apr 24, 2001
Posts: 162
Cheers,
I think that is what i am looking for. You are completely right in the fact that this is not the best way for our app to go. Unfortunately we create a portal for a large client that intregrates with an number of mickey mouse web sites that provide 'web services'. They wish to use a HTTP server to take in a URL with params and return XML. we have to make the form on our site and post the results to a remote HTTP server. i want to be able to post in java code and get the 'XML request' in code so that i can pase the XML response to produce some type of HTML page to tell the user if the entered data is correct.Why oh why they wish to send a respose from HTTP back as xml this way i don't know. if they build cars as well as they create portals don't but japanese cars.
Cheers,
David
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating a HTTP request in java and getting it's request