I am developing cxf client. I generate stub from wsdl and develope code from there. My code is something like that
URL WSDL_LOCATION = new URL(targetURL);
CustomerWS_Service CustomerWSService = new CustomerWS_Service (WSDL_LOCATION);
CustomerWS customerWS = CustomerWSService.getCustomerWSPort();
Now, i want to set some property to the connection:
max_total_connection: maximum number of connections allowed
max_connection_per_host: maximum number of connections allowed for a given host config
Some research tell me to set those properties in HttpUrlConnection. But i dont know how to do that Or atleast how to have HttpUrlConnection obj from the code.
You have to set this at Bus level. Bus properties can be configured as like below. You are not using async so don't need to put this property.
Also I would recommend to create client from JaxWsClientFactoryBean
SpringBus bus = new SpringBus();
bus.setProperty(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE);
bus.setProperty("org.apache.cxf.transport.http.async.SO_KEEPALIVE",Boolean.TRUE); bus.setProperty("org.apache.cxf.transport.http.async.SO_TIMEOUT",Boolean.FALSE); bus.setProperty("org.apache.cxf.transport.http.async.MAX_CONNECTIONS","totalConnections"));
bus.setProperty("org.apache.cxf.transport.http.async.MAX_PER_HOST_CONNECTIONS","connectionsPerHost"));