Hi, Oleg:
I feels sorry that I have not expressed clearly.
>
> (1) Status of what request are you checking? Client to synapse?
No , not client to synapse, but the request synapse relayed to axisServer
axisClient--->synapse--->axisServer
I just add code to check the status of http-request relayed from synapse to
axisServer .
More details about how to do this is :
In NHttpClientHandler error report callback, I check if the request sent from
synapse to axisServer has finished.Here "finish" means received response back
from axisServer;
If finished , synapse will ommit the exception, and just simply close
connection. But if not finish , we will not only close http connection, but
also we should send back a error-message-context to axisClient.
Synapse
> to target server? Do not forget Synapse is a proxy, whereas HttpCore is
> meant to be a generic transport library. It is not meant to provide
> functions applicable to HTTP proxies only.
> (2) NHttpClientConnection handles requests and responses completely
> asynchronously. It can receive several pipelined requests before sending
> out the first response. So, for instance, if an I/O exception occurs
> while sending out a response, there is no point passing the status of
> the _current_ request because there is no guarantee this request
Yes the NHttpClientHandler itself cannot identify which is the
_current_request. so I must save the http-request in connection's context(
conn.getContext().setAttribute(AXIS2_HTTP_REQUEST, axis2Req),
> corresponds to the failed response. This decision can be made at the
> protocol handler level only.
Yes, httpCore is and should be a generic http protocol library. And
NHttpClientHandler should generally indicate event of protocol level . and it
does works very well.
But my matter is while exception occured, I must make sure if the request
relayed to axisServer has finished.
If it's not finished, synapse should send a failure-message-context back to
axisClient to indicate the failure.
---------------------------------------------------------------------------------------------------------------------
and after I writted the patch, I found that all the patch code's work is just
detecting if a http-request send to http-server has received a response , when
http connection cannot be used any more (due to exception or time-out).
and the patch code looks very awkward ... ...; so I think if http-core could
support Callback to detecting http-request status(yet, I think maybe
SessionRequestCallback could do this. (I am not sure about this). but in my
test, SessionRequestCallback can only report limited error).
>
> (3) You can use the state of the encoder / decoder passed in the
> NHttpClientHandler#outputReady() / NHttpServiceHandler#inputReady()
> events to determine whether a request has been fully sent / received.
>
> Hope this helps somewhat
>
> Oleg
>>