You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Pader, Erwin" <Er...@hma.org> on 2006/09/19 21:26:03 UTC
RE: [Axis2] Socket connection on Client and Server not disconnect
ing
one of the workaround i did to clean up conn and invalidate sessions is to
add a custom handler in axis2.xml (phase operation in phase). the custom
handler gets a reference to the messagecontext thru the invoke method. you
can get the session context from msg context and invalidate your session.
code snippet:
public void invoke(MessageContext msgContext) throws AxisFault {
SessionContext sessionContext = msgContext.getSessionContext();
Object obj =
msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
if (obj != null) {
HttpServletRequest request = (HttpServletRequest) obj;
request.getSession().invalidate();
}
}
-----Original Message-----
From: Brian Bacsu [mailto:bbacsu@csc.com]
Sent: Tuesday, September 19, 2006 3:16 PM
To: axis-user@ws.apache.org
Subject: Re: [Axis2] Socket connection on Client and Server not
disconnecting
Robert
Is this an issue with ServiceClient's finalizeInvoke() method not properly
cleaning up the connection? Would I experience the same socket resource
starvation with Axis2 if I reverted to a simpler implementation using the
ServiceClient.sendReceive() method, rather than the
OperationClient.execute() method?
Thanks,
Brian Bacsu
"robert lazarski" <ro...@gmail.com>
09/19/2006 01:42 PM
Please respond to
axis-user@ws.apache.org
To
axis-user@ws.apache.org
cc
Subject
Re: [Axis2] Socket connection on Client and Server not disconnecting
This is a known issue:
http://issues.apache.org/jira/browse/AXIS2-935
There is a patch submitted. If you could attach your test case to it
I'll take a look at the patch.
Robert
On 9/19/06, Brian Bacsu <bb...@csc.com> wrote:
>
> Hi,
>
> We have implemented an Axis2 client to call web services exposed through
> both .NET and Axis1 running on Microsoft Server 2003. I have encountered
an
> issue with the Axis2 client with regard to disconnecting the client and
> server socket connections. The server-side connection will finally
time-out
> and drop (It looks like Microsoft Server will hang onto connections for 60
> seconds, even after close requested), but the client side connections
> continue to collect until the server begins to run out of
> resources/connections. The client connections show CLOSE_WAIT status when
> viewed with netstat .
>
> Any suggestions would be appreciated.
>
> Here is a sample of the client code:
>
> Options options = new Options();
>
>
> options.setExceptionToBeThrownOnSOAPFault(Boolean.TRUE);
>
> options.setTo(new EndpointReference(url.toString()));
> ServiceClient serviceClient = null;
> MessageContext requestContext =
> CFWsoapClient.getMessageContext(OM_Msg,this,soapRoot, logger, traceLevel);
> requestContext.setSoapAction(action);
> try {
>
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> options.setProperty(HTTPConstants.SO_TIMEOUT,1000);
> options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
> Boolean.FALSE);
>
> options.setProperty(HTTPConstants.CONNECTION_TIMEOUT,
> (int)timeout);
>
> serviceClient = new ServiceClient();
> serviceClient.setOptions(options);
> OperationClient opClient =
> serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP);
> opClient.addMessageContext(requestContext);
> opClient.execute(true);
>
> MessageContext resultContext =
> opClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
>
> SOAPEnvelope resEnvelope = resultContext.getEnvelope();
> SOAPBody body = resEnvelope.getBody();
>
> opClient.complete(resultContext);
> return body;
> }
> catch (AxisFault e1) {
> e1.printStackTrace();
> throw new AxisFault(e1.getMessage());
> }
> finally {
> try {
> serviceClient.finalizeInvoke();
> } catch (AxisFault axisFault) {
> logger.error(axisFault.getMessage() +
> axisFault.toString());
> } catch (Exception e) {
> logger.error(e.getMessage() + e.toString());
> }
>
> }
>
> Thanks,
>
> Brian Bacsu
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org