p.setChunkLength(Integer.parseInt(v.trim())); } else if ("Connection".equals(k)) { p.setConnection(ConnectionType.valueOf(v)); } else if ("DecoupledEndpoint".equals(k)) { p.setDecoupledEndpoint(v);
p.setConnection(p1.getConnection()); } else if (p2.isSetConnection()) { p.setConnection(p2.getConnection());
URL url = null; try { url = new URL(endpoint + "/wsdl"); } catch (MalformedURLException e) { LOG.error(e.getMessage()); } javax.xml.ws.Service s = MyService.create(url, new QName(MyService.NAMESPACE, MyService.SERVICE)); ServiceSoap port = s.getPort(ServiceSoap.class); Map<String, Object> reqCtx = ((BindingProvider)port).getRequestContext(); reqCtx.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint); reqCtx.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE); reqCtx.put(BindingProvider.SOAPACTION_URI_PROPERTY, actionName); Client client = ClientProxy.getClient(port); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnection(ConnectionType.CLOSE); http.setClient(httpClientPolicy); TLSClientParameters tls = new TLSClientParameters(); tls.setSSLSocketFactory(sslFactory); tls.setDisableCNCheck(true); http.setTlsClientParameters(tls);
@Component("endpointConfigurer") public class TemplateEndpointConfigurer implements CxfEndpointConfigurer { @Override public void configure(AbstractWSDLBasedEndpointFactory factoryBean) { // Do nothing here } @Override public void configureClient(Client client) { final HTTPConduit conduit = (HTTPConduit) client.getConduit(); final HTTPClientPolicy policy = new HTTPClientPolicy(); policy.setConnectionTimeout(webServiceConnectionTimeout); policy.setReceiveTimeout(webServiceReadTimeout); policy.setConnection(ConnectionType.CLOSE); conduit.setClient(policy); } @Override public void configureServer(Server server) { // Do nothing here } }
p.setConnection(p1.getConnection()); } else if (p2.isSetConnection()) { p.setConnection(p2.getConnection());
... HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setAllowChunking(false); httpClientPolicy.setAutoRedirect(true); httpClientPolicy.setConnection(ConnectionType.KEEP_ALIVE); String proxyUrl = "http://proxy.com"; String proxyPortString = "8080"; HTTPConduit http = (HTTPConduit)client.getConduit(); SSLContext sslContext = SSLContext.getInstance("TLSv1"); sslContext.init(null, null, null); HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); TLSClientParameters tlsClientParameters = new TLSClientParameters(); tlsClientParameters.setUseHttpsURLConnectionDefaultSslSocketFactory(true); http.setTlsClientParameters(tlsClientParameters); http.setClient(httpClientPolicy);
p.setChunkLength(Integer.parseInt(v.trim())); } else if ("Connection".equals(k)) { p.setConnection(ConnectionType.valueOf(v)); } else if ("DecoupledEndpoint".equals(k)) { p.setDecoupledEndpoint(v);
public static void setKeepAliveConnection(Object proxy, boolean keepAlive, boolean force) { if (force || "HP-UX".equals(System.getProperty("os.name")) || "Windows XP".equals(System.getProperty("os.name"))) { Client client = ClientProxy.getClient(proxy); HTTPConduit hc = (HTTPConduit)client.getConduit(); HTTPClientPolicy cp = hc.getClient(); cp.setConnection(keepAlive ? ConnectionType.KEEP_ALIVE : ConnectionType.CLOSE); } }
p.setChunkLength(Integer.parseInt(v.trim())); } else if ("Connection".equals(k)) { p.setConnection(ConnectionType.valueOf(v)); } else if ("DecoupledEndpoint".equals(k)) { p.setDecoupledEndpoint(v);
private void doWork(URL wsdlUrl, String address) { SOAPService service = new SOAPService(wsdlUrl); assertNotNull(service); Greeter greeter = service.getSoapPort(); // overwrite client address InvocationHandler handler = Proxy.getInvocationHandler(greeter); BindingProvider bp = (BindingProvider)handler; bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address); Client client = ClientProxy.getClient(greeter); HTTPConduit c = (HTTPConduit)client.getConduit(); c.setClient(new HTTPClientPolicy()); c.getClient().setConnection(ConnectionType.CLOSE); // invoke twoway call greeter.sayHi(); }
httpClientPolicy.setConnection(ConnectionType.fromValue(connection));
/** * {@inheritDoc} */ @Override public void onProxyChange(ProxySettings proxySettings) { HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnection(ConnectionType.CLOSE); httpClientPolicy.setAllowChunking(true); httpClientPolicy.setCacheControl(ClientCacheControlType.NO_CACHE); if (proxySettings.isEnabled()) { httpClientPolicy.setProxyServer(proxySettings.getProxyHost()); httpClientPolicy.setProxyServerPort(proxySettings.getProxyPort()); httpClientPolicy.setProxyServerType(ProxyServerType.HTTP); } else { httpClientPolicy.setProxyServer(null); httpClientPolicy.unsetProxyServerPort(); httpClientPolicy.setProxyServerType(null); } Client client = ClientProxy.getClient(pronomService); HTTPConduit http = (HTTPConduit) client.getConduit(); http.setClient(httpClientPolicy); }
p.setConnection(p1.getConnection()); } else if (p2.isSetConnection()) { p.setConnection(p2.getConnection());
/** * {@inheritDoc} */ @Override public void onProxyChange(ProxySettings proxySettings) { HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setConnection(ConnectionType.CLOSE); httpClientPolicy.setAllowChunking(true); httpClientPolicy.setCacheControl("no-cache"); if (proxySettings.isEnabled()) { httpClientPolicy.setProxyServer(proxySettings.getProxyHost()); httpClientPolicy.setProxyServerPort(proxySettings.getProxyPort()); httpClientPolicy.setProxyServerType(ProxyServerType.HTTP); } else { httpClientPolicy.setProxyServer(null); httpClientPolicy.setProxyServerPort(null); httpClientPolicy.setProxyServerType(null); } Client client = ClientProxy.getClient(pronomService); HTTPConduit http = (HTTPConduit) client.getConduit(); http.setClient(httpClientPolicy); }