use of org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class Helper method testGZIPServerSideOnlyInterceptorOnClient.
public boolean testGZIPServerSideOnlyInterceptorOnClient() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
HelloWorld port = getPort();
Client client = ClientProxy.getClient(port);
HTTPConduit conduit = (HTTPConduit) client.getConduit();
HTTPClientPolicy policy = conduit.getClient();
// enable Accept gzip, otherwise the server will not try to reply using gzip
policy.setAcceptEncoding("gzip;q=1.0, identity; q=0.5, *;q=0");
// add interceptor for decoding gzip message
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(port, "jaxws-client-config.xml", "Interceptor Client Config");
return ("foo".equals(port.echo("foo")));
} finally {
bus.shutdown(true);
}
}
use of org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class Helper method testConfigurationChange.
public boolean testConfigurationChange() throws Exception {
Service service = Service.create(new URL(address + "?wsdl"), serviceName);
Endpoint port = (Endpoint) service.getPort(Endpoint.class);
org.apache.cxf.endpoint.Endpoint ep = ClientProxy.getClient(port).getEndpoint();
assert (ep.get("propA") == null);
assert (ep.get("propB") == null);
ep.put("propZ", "valueZ");
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(port, "META-INF/jaxws-client-config.xml", "Custom Client Config");
if (!ep.get("propA").equals("fileValueA") || !ep.get("propB").equals("fileValueB") || !ep.get("propZ").equals("valueZ")) {
return false;
}
port.echo("Kermit");
configurer.setConfigProperties(port, "META-INF/jaxws-client-config.xml", "Another Client Config");
return (ep.get("propA") == null && ep.get("propB") == null && ep.get("propC").equals("fileValueC") && ep.get("propZ").equals("valueZ"));
}
use of org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class FastInfosetTestCase method internalTestInfosetUsingFeatureProperties.
private void internalTestInfosetUsingFeatureProperties(URL wsdlURL, QName serviceName, QName portQName) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream in = new ByteArrayOutputStream();
PrintWriter pwIn = new PrintWriter(in);
PrintWriter pwOut = new PrintWriter(out);
Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
bus.getInInterceptors().add(new LoggingInInterceptor(pwIn));
bus.getOutInterceptors().add(new LoggingOutInterceptor(pwOut));
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
HelloWorld port = (HelloWorld) service.getPort(portQName, HelloWorld.class);
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(port, "META-INF/jaxws-client-config.xml", "Custom Client Config");
assertEquals("helloworld", port.echo("helloworld"));
assertTrue("request is expected fastinfoset", out.toString().indexOf("application/fastinfoset") > -1);
assertTrue("response is expected fastinfoset", in.toString().indexOf("application/fastinfoset") > -1);
} finally {
bus.shutdown(true);
pwOut.close();
pwIn.close();
}
}
use of org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class WSReliableMessagingWithAPITestCase method testWithFeatureProperty.
@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testWithFeatureProperty() throws Exception {
final Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
Service service = Service.create(wsdlURL, serviceName);
SimpleService proxy = (SimpleService) service.getPort(SimpleService.class);
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(proxy, "META-INF/jaxws-client-config.xml", "Custom Client Config");
((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
// request response call
assertEquals("Hello World!", proxy.echo("Hello World!"));
// one way call
proxy.ping();
} finally {
bus.shutdown(true);
}
}
use of org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class Helper method testConfigurationChange.
public boolean testConfigurationChange() throws Exception {
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint port = (Endpoint) service.getPort(Endpoint.class);
BindingProvider bp = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> hc = bp.getBinding().getHandlerChain();
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
String resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
if (!"Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr)) {
return false;
}
configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Another Client Config");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
}
Aggregations