• 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

HTTP Request froward to other application

 
Greenhorn
Posts: 23
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way, i can forward the request to some other application running on some other server and get the response back?
I tried to use Apache HTTPClient API, but it is not letting me send the original request, and constructs a new request.

Basically, i want to have a HTTP Proxy, but i want to perform some operations on incoming request and possibly also on the response, so i'm not using socket programming.
If there isn't a way to forward the request, can i construct the same request and send it?
Thanks in advanced....
 
Ranch Hand
Posts: 448
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can visualize you want the behavior where I book the train tickets and I am forwarded to payment gateway and after payment is processed I am shown the seat confirmation page on the railway website...right?
 
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
No, you need to use a different request.
 
Tejas Shah
Greenhorn
Posts: 23
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How?

Any other way to send a duplicate request?
I may have SOAP requests as well as HTTPRequest,
So it is not working with Apache HTTPClient API. It can construct new requests with parameters or attributes, but how can i attache SOAP envelope to this?
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,

Http is a protrocol that limits the communication between only two ends(one cliente and one server), thus you can forward the request only to resources located in that server. If you need to communicate with another server , you need another conection and another request. What you are trying to accomplish, is create a pipeline of comunication between your servers (see Pipes and Filters -POSA). You will need to use one application as a httpProxy (You can implement this using a Front Controller and App.Controller or an an Intercepting Filter-JEE Core Patterns) in front of target server, handle the request, extract the http message payload, create another request, copy old payload to the new request, forward the new request to the target server(you can use java.net). Also you can use SAAJ with that strategy to handle soap messages. I'm not very familiar with Apache HttpClient API, but i'm pretty sure it's an abstraction layer for what i described here.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic