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

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

 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 387
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic