本文整理汇总了Java中org.apache.cxf.endpoint.Client类的典型用法代码示例。如果您正苦于以下问题:Java Client类的具体用法?Java Client怎么用?Java Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Client类属于org.apache.cxf.endpoint包,在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSoapClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
public <T> T createSoapClient(Class<T> serviceClass, URL endpoint, String namespace)
{
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
Bus bus = new ExtensionManagerBus(null, null, Bus.class.getClassLoader());
factory.setBus(bus);
factory.setServiceClass(serviceClass);
factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
factory.setAddress(endpoint.toString());
factory.getServiceFactory().getServiceConfigurations().add(0, new XFireCompatabilityConfiguration());
factory.setDataBinding(new AegisDatabinding());
@SuppressWarnings("unchecked")
T soapClient = (T) factory.create();
Client client = ClientProxy.getClient(soapClient);
client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(600000);
policy.setAllowChunking(false);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.setClient(policy);
return soapClient;
}
示例2: AdministrationWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/administrationWS?wsdl
*
* @param wsdlLocation IWS Administration WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public AdministrationWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, AdministrationWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a load balancer and/or proxies, this address may
// not be available or resolvable via DNS. Instead, we force using the
// same WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}
示例3: sendMessageWithUsernameToken
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
protected String sendMessageWithUsernameToken(String username, String password, String message) throws Exception {
final javax.xml.ws.Service svc = javax.xml.ws.Service.create(WSDL_LOC, SERVICE_QNAME);
final Greeter greeter = svc.getPort(PORT_QNAME, Greeter.class);
Client client = ClientProxy.getClient(greeter);
Map<String, Object> props = new HashMap<String, Object>();
props.put("action", "UsernameToken");
props.put("user", username);
// Set the the password type to be plain text,
// so we can keep using the password to authenticate with spring security
props.put("passwordType", "PasswordText");
WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor(props);
client.getOutInterceptors().add(wss4jOut);
((BindingProvider)greeter).getRequestContext().put("password", password);
return greeter.greetMe(message);
}
示例4: testRoutes
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
@Test
public void testRoutes() throws Exception {
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, QName.valueOf(getServiceName()));
Person client = ss.getSoap();
Client c = ClientProxy.getClient(client);
((BindingProvider)client).getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:" + port1 + "/" + getClass().getSimpleName() + "/PersonService");
c.getInInterceptors().add(new LoggingInInterceptor());
c.getOutInterceptors().add(new LoggingOutInterceptor());
Holder<String> personId = new Holder<String>();
personId.value = "hello";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
client.getPerson(personId, ssn, name);
assertEquals("Bonjour", name.value);
}
示例5: disableCertificateChecks
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
private void disableCertificateChecks(Client cxfClient) {
HTTPConduit httpConduit = (HTTPConduit) cxfClient.getConduit();
TLSClientParameters tlsCP = new TLSClientParameters();
tlsCP.setTrustManagers(getNoCertificationCheckTrustManager());
tlsCP.setDisableCNCheck(true);
httpConduit.setTlsClientParameters(tlsCP);
}
示例6: createSoap
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T> T createSoap(Class<T> serviceClass, URL endpoint, String namespace, Object previousSession)
{
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setServiceClass(serviceClass);
factory.setServiceName(new QName(namespace, serviceClass.getSimpleName()));
factory.setAddress(endpoint.toString());
List<AbstractServiceConfiguration> configs = factory.getServiceFactory().getServiceConfigurations();
configs.add(0, new XFireReturnTypeConfig());
factory.setDataBinding(new AegisDatabinding());
T service = (T) factory.create();
Client client = ClientProxy.getClient(service);
client.getRequestContext().put(Message.MAINTAIN_SESSION, true);
HTTPClientPolicy policy = new HTTPClientPolicy();
policy.setReceiveTimeout(600000);
policy.setAllowChunking(false);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
conduit.setClient(policy);
if( previousSession != null )
{
copyCookiesInt(conduit, previousSession);
}
return service;
}
示例7: test
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
@GET
@Path("test")
public String test() {
TestService_Service s = new TestService_Service();
TestService ts = s.getTestServicePort();
// 设置客户端的配置信息,超时等.
Client proxy = ClientProxy.getClient(ts);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
HTTPClientPolicy policy = new HTTPClientPolicy();
// 连接服务器超时时间
policy.setConnectionTimeout(30000);
// 等待服务器响应超时时间
policy.setReceiveTimeout(30000);
conduit.setClient(policy);
ts.echo();
return "web service perfect";
}
示例8: configureClientConnection
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
public static void configureClientConnection(Object wsPort)
{
Client cxfClient = ClientProxy.getClient(wsPort);
HTTPConduit httpConduit = (HTTPConduit)cxfClient.getConduit();
configureSsl(httpConduit);
configureTimeout(httpConduit);
if(OscarProperties.getInstance().getProperty("INTEGRATOR_COMPRESSION_ENABLED","false").equals("true")) {
configureGZIP(cxfClient);
}
if(OscarProperties.getInstance().getProperty("INTEGRATOR_LOGGING_ENABLED","false").equals("true")) {
configureLogging(cxfClient,true);
}
}
示例9: configureHttp
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private static Object configureHttp(Object obj, Class clz)
{
Client client = ClientProxy.getClient(obj);
addInterceptor(client);
interceptorLoggingCtrl(client);
HTTPConduit http = (HTTPConduit)client.getConduit();
if (null == http)
{
return null;
}
configHttpClientPolicy(http);
clientMap.put(clz.getName(), obj);
return obj;
}
示例10: StorageWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/storageWS?wsdl
*
* @param wsdlLocation IWS Storage WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public StorageWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, StorageWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a load balancer and/or proxies, this address may
// not be available or resolvable via DNS. Instead, we force using the
// same WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}
示例11: AccessWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/accessWS?wsdl
*
* @param wsdlLocation IWS Access WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public AccessWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, AccessWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a load balancer and/or proxies, this address may
// not be available or resolvable via DNS. Instead, we force using the
// same WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}
示例12: ExchangeWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/exchangeWS?wsdl
*
* @param wsdlLocation IWS Exchange WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public ExchangeWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, ExchangeWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a load balancer and/or proxies, this address may
// not be available or resolvable via DNS. Instead, we force using the
// same WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}
示例13: CommitteeWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/committeeWS?wsdl
*
* @param wsdlLocation IWS Committees WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public CommitteeWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, CommitteeWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a load balancer and/or proxies, this address may
// not be available or resolvable via DNS. Instead, we force using the
// same WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}
示例14: StudentWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/studentWS?wsdl
*
* @param wsdlLocation IWS Students WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public StudentWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, StudentWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a load balancer and/or proxies, this address may
// not be available or resolvable via DNS. Instead, we force using the
// same WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}
示例15: AccessWSClient
import org.apache.cxf.endpoint.Client; //导入依赖的package包/类
/**
* IWS Access WebService Client Constructor. Takes the URL for the WSDL as
* parameter, to generate a new WebService Client instance.<br />
* For example: https://iws.iaeste.net:9443/iws-ws/accessWS?wsdl
*
* @param wsdlLocation IWS Access WSDL URL
* @throws MalformedURLException if not a valid URL
*/
public AccessWSClient(final String wsdlLocation) throws MalformedURLException {
super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
client = getPort(ACCESS_SERVICE_PORT, AccessWS.class);
// The CXF will by default attempt to read the URL from the WSDL at the
// Server, which is normally given with the server's name. However, as
// we're running via a loadbalancer and/or proxies, this address may not
// be available or resolvable via DNS. Instead, we force using the same
// WSDL for requests as we use for accessing the server.
// Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);
// The CXF has a number of default Policy settings, which can all be
// controlled via the internal Policy Scheme. To override or update the
// default values, the Policy must be exposed. Which is done by setting
// a new Policy Scheme which can be access externally.
// Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
final Client proxy = ClientProxy.getClient(client);
final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
// Finally, set the Policy into the HTTP Conduit.
conduit.setClient(policy);
}