0

Suppose that I have Apache/lighttpd or whatever to receive http requests. Now I want the web servers to act as a proxy for my web services running on internal servers written in Java/Clojure/Erlang?

What I want is to separate the layer that handles client connections and the server that handle application logic. These two should be separated and language independent. Is JSON or XML the format for communicating? If so, how do I perform it from the web servers?

Amumu
  • 15,628
  • 24
  • 77
  • 124

1 Answers1

1

Note: May be I missed the point of your question in this response. Pls do let me know if that is the case.

I dont think you should consider this as "forwarding" of the original request. If your web-tier that receives the original request makes a call to one/more underlying services (thru HTTP or otherwise) it is part of the "processing" of the original request. So, there is nothing different here than what you are already familiar with.

i.e
You make a HTTP request in place where you would make a SOAP/XML request or a DB call or post a message.

When you say or think in terms of "forwarding", it is misleading.

Also, the data exchanged between your controller and services is solely based on your convenience. It could be XML or JSON or regular POST parameters that gets sent over HTTP transport

2020
  • 2,682
  • 1
  • 19
  • 37
  • So how do I generate request to internal services with JSON/HTTP or whatever from a web server? Can you give an example in Apache? I only wrote web pages with Apache/PHP/MySql before but not with other combinations. Now I don't want PHP/MySQL but other PL like Java/Python etc.. – Amumu May 17 '13 at 19:54
  • How to generate HTTP request from Java code to external services is given in a great detail [here](http://stackoverflow.com/a/2793153/1733060) and [here](http://stackoverflow.com/questions/1359689/how-to-send-http-request-in-java). – 2020 May 17 '13 at 20:12
  • There is also a Apache specific method using [Apache HTTP Components](http://hc.apache.org/httpcomponents-core-ga/examples.html) – 2020 May 17 '13 at 20:17