Hi Oleg,

When I use a common socket communication I can get InputStream and
OutputStream from the connection. Then I am able to read and write as many
times I need without closing the connection at all.

The same I need to do over http and have it done many times but without
using httpclient component up to now. 

Let say the scenario is as follows:

1. there are 2 applications (A and B)
2. A posts data (HTTP POST) to B
3. B posts back to A the data received (2) plus providing an authentication
key
4. A compares what has been initially sent (2) against what has been
recently received from B (3)
5. A responses back to B with OK or FALSE
6. A checks whether the status for the last post (5) is HTTP 200 OK (the
request has been properly received from B)

I can do this only using socket connection but then I need to deal with all
HTTP protocol's stuffs. Therefore I want to use org.apache.httpcomponents in
order to facilitate the work. The whole communication described must be done
without session tracing and using the same connection initially established
by application A. Finally, A is responsible to close it.

@Simeon



-----Original Message-----
From: Oleg Kalnichevski [mailto:[email protected]] 
Sent: Mittwoch, 11. November 2009 20:55
To: HttpClient User Discussion
Subject: Re: bidirectional communication based on HttpDefaultClient

Simeon Mitev wrote:
>  
> 
> Hi guys,
> 
>  
> 
> I am pretty new to the mailing list and I already have a question :-)
> 
>  
> 
> If you are familiar with PayPal instant payment notifications (IPN) you
> probably know the mechanism:
> 
>  
> 
> 1.    PayPal server sends (http post) a notification to provide by the
> customer URL.
> 2.    The receiver is obligated to send back received data and provide
> a secured key in addition.
> 3.    PayPal server validates and confirms whether the data has been
> really sent by him and whether the data is properly parsed by the
> receiver.
> 
>  
> 
> I need to implement the same kind of proof of receive via http and the
> question is how can I do this using 
> 
> HttpDefaultClient, HttpPost and ResponseHandler ? 
> 
>  
> 
> Is it possible once to open communication channels (read and write) and
> then reuse them until the communication between both sides completes?
> 
>  

I am not entirely sure I understand the question. Of course, HttpClient 
supports bidirectional communication as required by the HTTP spec. 
However, HTTP protocol is based on the concept of request / response 
exchanges. The client must issue a request in order to get a response 
from the server, or, in other words, HTTP client is always an initiator 
of a request / response exchange.

For details on HttpClient programming see:

http://hc.apache.org/httpcomponents-client/tutorial/html/

Hope this helps

Oleg


> Thanks 
> 
> @Simeon
> 
>  
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to