public < T > T getClient ( ClientBuilder < T > clientBuilder ) { JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean ( ) ; proxyFactory . setServiceClass ( clientBuilder . getServiceClass ( ) ) ; proxyFactory . setAddress ( clientBuilder . getAddress ( ) ) ; // JAX-WS handlers if ( clientBuilder . getHandlers ( ) != null ) { for ( Handler h : clientBuilder . getHandlers ( ) ) { proxyFactory . getHandlers ( ) . add ( h ) ; } } // ClientProxyFactoryBean bindingId if ( clientBuilder . getBindingId ( ) != null ) { proxyFactory . setBindingId ( clientBuilder . getBindingId ( ) ) ; } // CXF interceptors if ( clientBuilder . getCxfInInterceptors ( ) != null ) { proxyFactory . getInInterceptors ( ) . addAll ( clientBuilder . getCxfInInterceptors ( ) ) ; } if ( clientBuilder . getCxfInFaultInterceptors ( ) != null ) { proxyFactory . getInFaultInterceptors ( ) . addAll ( clientBuilder . getCxfInFaultInterceptors ( ) ) ; } if ( clientBuilder . getCxfOutInterceptors ( ) != null ) { proxyFactory . getOutInterceptors ( ) . addAll ( clientBuilder . getCxfOutInterceptors ( ) ) ; } if ( clientBuilder . getCxfOutFaultInterceptors ( ) != null ) { proxyFactory . getOutFaultInterceptors ( ) . addAll ( clientBuilder . getCxfOutFaultInterceptors ( ) ) ; } T proxy = clientBuilder . getServiceClass ( ) . cast ( proxyFactory . create ( ) ) ; // MTOM support if ( clientBuilder . isMtomEnabled ( ) ) { BindingProvider bp = ( BindingProvider ) proxy ; SOAPBinding binding = ( SOAPBinding ) bp . getBinding ( ) ; binding . setMTOMEnabled ( true ) ; } HTTPConduit http = ( HTTPConduit ) ClientProxy . getClient ( proxy ) . getConduit ( ) ; HTTPClientPolicy client = http . getClient ( ) ; client . setConnectionTimeout ( clientBuilder . getConnectTimeout ( ) ) ; client . setReceiveTimeout ( clientBuilder . getReceiveTimeout ( ) ) ; return proxy ; }
JAX - WS client factory