use of org.jboss.wsf.stack.cxf.client.UseThreadBusFeature in project jbossws-cxf by jbossws.
the class HelloDigestTestCase method testDigest.
@Test
@RunAsClient
public void testDigest() throws Exception {
final Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
try {
QName serviceName = new QName("http://jboss.org/http/security", "HelloService");
URL wsdlURL = getResourceURL("jaxws/cxf/httpauth/WEB-INF/wsdl/hello.wsdl");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
Hello proxy = (Hello) service.getPort(Hello.class);
((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL.toString());
((BindingProvider) proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "jbossws");
((BindingProvider) proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "jbossws");
HTTPConduit cond = (HTTPConduit) ClientProxy.getClient(proxy).getConduit();
cond.setAuthSupplier(new DigestAuthSupplier());
int result = proxy.helloRequest("number");
assertEquals(100, result);
} finally {
bus.shutdown(true);
}
}
use of org.jboss.wsf.stack.cxf.client.UseThreadBusFeature in project jbossws-cxf by jbossws.
the class FastInfosetTestCase method testInfosetUsingFeature.
@Test
@RunAsClient
@OperateOnDeployment(DEP1)
public void testInfosetUsingFeature() 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));
URL wsdlURL = new URL(baseURL + "HelloWorldService/HelloWorldFeatureImpl?wsdl");
QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/fastinfoset", "HelloWorldFeatureService");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
QName portQName = new QName("http://org.jboss.ws/jaxws/cxf/fastinfoset", "HelloWorldFeatureImplPort");
HelloWorldFeature port = (HelloWorldFeature) service.getPort(portQName, HelloWorldFeature.class);
assertEquals("helloworldFeature", port.echo("helloworldFeature"));
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.wsf.stack.cxf.client.UseThreadBusFeature in project jbossws-cxf by jbossws.
the class JBWS4046TestCase method callVersionService.
public String callVersionService(String path) throws Exception {
URL wsdlURL = new URL(baseURL.toString() + "/" + path + "?wsdl");
QName serviceName = new QName("http://org.jboss.ws/jaxws/cxf/jbws4046", "DemoService");
Service service = Service.create(wsdlURL, serviceName, new UseThreadBusFeature());
QName portQName = new QName("http://org.jboss.ws/jaxws/cxf/jbws4046", "DemoServicePort");
return service.getPort(portQName, DemoInterface.class, null).version();
}
Aggregations