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 Josh123 <jo...@gmail.com> on 2009/12/19 02:26:48 UTC

Number of HTTP sessions increasing

Hi,
I am using Axis 2 client to access a web service written using .net.
The client gets a record from the database, convert it into SOAP message,
and sends it to service, gets a response back and process the record in the
database, and then gets another record and so on.

Now when I start the process and run netstat on the client machine, I see
number of connections to server and database increasing drastically. (in
couple of minutes it reaches 200 to 300) and after some time i start getting
socket errors on the server side.
Now
1. Is the socket error caused due to these http sessions opened in excess?
2. Is it normal when using Axis 2 client for sending multiple records
(synchronously), to have multiple http sessions, or have I messed up in my
code?

Any help will be appreciated.

I have generated the client side service stub using WSDL2JAVA and the code
to invoke the service stub is as follow:
public class Client {
	
	private static ServiceStub service;
	
	private static void getService(String endPointUrl) throws AxisFault{
		if (service == null){
			service = new ServiceStub(endPointUrl);
		}
	}

	public static Response sendData(Object obj,
			String endPointUrl, long socketTimeOut, String userName,
			String password) {
		Operation operation = (Operation) obj;
		OperationResponse response = new OperationResponse();
		try {
			getService(endPointUrl);

			Authenticator auth = new Authenticator();

			auth.setUsername(userName);
			auth.setPassword(password);
			auth.setPreemptiveAuthentication(true);
			service._getServiceClient().getOptions().setProperty(
					org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
					auth);

			response = service.Operation(operation, socketTimeOut);
		} catch (AxisFault e1) {

			e1.printStackTrace();
		} catch (RemoteException e) {
			e1.printStackTrace();
		} catch (Exception e) {
			e1.printStackTrace();
		}
		return response;
	}
}

-- 
View this message in context: http://old.nabble.com/Number-of-HTTP-sessions-increasing-tp26851898p26851898.html
Sent from the Axis - User mailing list archive at Nabble.com.


Re: Number of HTTP sessions increasing

Posted by Amila Suriarachchi <am...@gmail.com>.
what is the Axis2 version you use? try with Axis2 1.5.1.

thanks,
Amila.

On Sat, Dec 19, 2009 at 6:56 AM, Josh123 <jo...@gmail.com>wrote:

>
> Hi,
> I am using Axis 2 client to access a web service written using .net.
> The client gets a record from the database, convert it into SOAP message,
> and sends it to service, gets a response back and process the record in the
> database, and then gets another record and so on.
>
> Now when I start the process and run netstat on the client machine, I see
> number of connections to server and database increasing drastically. (in
> couple of minutes it reaches 200 to 300) and after some time i start
> getting
> socket errors on the server side.
> Now
> 1. Is the socket error caused due to these http sessions opened in excess?
> 2. Is it normal when using Axis 2 client for sending multiple records
> (synchronously), to have multiple http sessions, or have I messed up in my
> code?
>
> Any help will be appreciated.
>
> I have generated the client side service stub using WSDL2JAVA and the code
> to invoke the service stub is as follow:
> public class Client {
>
>        private static ServiceStub service;
>
>        private static void getService(String endPointUrl) throws AxisFault{
>                if (service == null){
>                        service = new ServiceStub(endPointUrl);
>                }
>        }
>
>        public static Response sendData(Object obj,
>                        String endPointUrl, long socketTimeOut, String
> userName,
>                        String password) {
>                Operation operation = (Operation) obj;
>                OperationResponse response = new OperationResponse();
>                try {
>                        getService(endPointUrl);
>
>                        Authenticator auth = new Authenticator();
>
>                        auth.setUsername(userName);
>                        auth.setPassword(password);
>                        auth.setPreemptiveAuthentication(true);
>
>  service._getServiceClient().getOptions().setProperty(
>
>  org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
>                                        auth);
>
>                        response = service.Operation(operation,
> socketTimeOut);
>                } catch (AxisFault e1) {
>
>                        e1.printStackTrace();
>                } catch (RemoteException e) {
>                        e1.printStackTrace();
>                } catch (Exception e) {
>                        e1.printStackTrace();
>                }
>                return response;
>        }
> }
>
> --
> View this message in context:
> http://old.nabble.com/Number-of-HTTP-sessions-increasing-tp26851898p26851898.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/