/** * This is called by handlers for servicing requests * * @param context * @param req * @param resp * @throws IOException */ protected void doService(HttpServletRequest req, HttpServletResponse resp) throws IOException { Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); try { serviceRequest(req, resp); } catch (Exception e) { e.printStackTrace(); } finally { if (origBus != bus) { BusFactory.setThreadDefaultBus(origBus); } } }
public ServiceListGeneratorServlet(DestinationRegistry destinationRegistry, Bus bus) { this.destinationRegistry = destinationRegistry; this.bus = bus; if (this.bus == null) { this.bus = BusFactory.getDefaultBus(false); } this.title = "CXF - Service list"; }
final void initialize(Bus b, URL url, WebServiceFeature ... f) { if (b == null) { b = BusFactory.getThreadDefaultBus(true); bus.getExtension(ServiceContractResolverRegistry.class); if (null != registry) { URI uri = registry.getContractLocation(serviceName); wsdlURL = url == null ? null : url.toString();
protected void loadBus(ServletConfig sc) { this.bus = BusFactory.newInstance().createBus(); }
public void loadBus(ServletConfig servletConfig) { this.bus = BusFactory.newInstance().createBus(); Bus bus = getBus(); HeaderManager headerManager = bus.getExtension(HeaderManager.class); headerManager.registerHeaderProcessor(new HeaderProcessor() { @Override BusFactory.setDefaultBus(bus);
@org.junit.Test public void testSignedSAML() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = ActionTest.class.getResource("client.xml"); Bus bus = bf.createBus(busFile.toString()); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSignedSAMLPort"); DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class); updateAddressPort(port, PORT); assertEquals(50, port.doubleIt(25)); ((java.io.Closeable)port).close(); bus.shutdown(true); }
@Test public void testHttpWrappedContinuations() throws Exception { SpringBusFactory bf = new SpringBusFactory(); Bus bus = bf.createBus(CLIENT_CONFIG_FILE); BusFactory.setDefaultBus(bus); QName serviceName = new QName("http://cxf.apache.org/systest/jaxws", "HelloContinuationService"); URL wsdlURL = new URL("http://localhost:" + PORT + "/hellocontinuation?wsdl"); HelloContinuationService service = new HelloContinuationService(wsdlURL, serviceName); assertNotNull(service); final HelloContinuation helloPort = service.getHelloContinuationPort(); doTest(helloPort); bus.shutdown(true); }
@Test public void testClientServer() throws Exception { Bus bus = new SpringBusFactory().createBus("org/apache/cxf/systest/ws/security/handler/client.xml"); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); Service service = Service.create(new URL("http://localhost:" + PORT + "/wsse/HelloWorldWS?wsdl"), new QName("http://cxf.apache.org/wsse/handler/helloworld", "HelloWorldImplService")); QName portName = new QName("http://cxf.apache.org/wsse/handler/helloworld", "HelloWorldPort"); HelloWorld port = service.getPort(portName, HelloWorld.class); updateAddressPort(port, PORT); assertEquals("Hello CXF", port.sayHello("CXF")); bus.shutdown(true); }
Bus bus = BusFactory.getThreadDefaultBus(); WSDLManager wsdlManager = bus.getExtension(WSDLManager.class); try { Definition def = wsdlManager.getDefinition(wsdlDocumentLocation); interfaceName = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding() .getPortType().getQName(); } catch (Exception e) { ? serviceName.getNamespaceURI() + " " + wsdlDocumentLocation : wsdlDocumentLocation; writer.writeNamespace(JAXWSAConstants.WSDLI_PFX, JAXWSAConstants.WSAM_INTERFACE_NAME, JAXWSAConstants.NS_WSAM); String portTypePrefix = interfaceName.getPrefix(); if (portTypePrefix == null || portTypePrefix.isEmpty()) { portTypePrefix = "ns1";
configureObject(portName.toString() + ".jaxws-client.proxyFactory", clientFac); if (clientFac.getBus() != BusFactory.getThreadDefaultBus(false) && clientFac.getBus() != null) { clientBus = clientFac.getBus();
@org.junit.Test public void testGetWSDL() throws Exception { BusFactory bf = BusFactory.newInstance(); Bus bus = bf.createBus(); bus.getInInterceptors().add(new LoggingInInterceptor()); bus.getOutInterceptors().add(new LoggingOutInterceptor()); MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer(); bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class); JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus); factory.createClient(ADDRESS + "?wsdl"); }
private ResourceManager getResourceManager() { Bus b = bus; if (b == null) { b = BusFactory.getThreadDefaultBus(); } return b.getExtension(ResourceManager.class); }
private Bus createNewBus(final UnifiedServiceRefMetaData serviceRefMD) { final Bus bus; Bus threadBus = BusFactory.getThreadDefaultBus(false); bus = threadBus != null ? threadBus : BusFactory.newInstance().createBus(); Configurer configurer = bus.getExtension(Configurer.class); bus.setExtension(new CXFServiceRefStubPropertyConfigurer(serviceRefMD, configurer), Configurer.class); return bus; }
@AfterClass public static void reset() { Bus b = BusFactory.getDefaultBus(false); if (b == null) { b = BusFactory.getThreadDefaultBus(false); } if (b == null) { b = BusFactory.getDefaultBus(); } b.shutdown(true); }
public void createBus(String config) throws Exception { if (config != null) { bus = new SpringBusFactory().createBus(config); } else { bus = BusFactory.newInstance().createBus(); } BusFactory.setDefaultBus(bus); }
protected void run() { String configurationFile = "undertowBasicAuthServer.xml"; URL configure = UndertowBasicAuthServer.class.getResource(configurationFile); Bus bus = new SpringBusFactory().createBus(configure, true); bus.getInInterceptors().add(new LoggingInInterceptor()); bus.getOutInterceptors().add(new LoggingOutInterceptor()); BusFactory.setDefaultBus(bus); setBus(bus); GreeterImpl implementor = new GreeterImpl(); ep = Endpoint.publish(ADDRESS, implementor); }
@Before public void setUp() throws Exception { SpringBusFactory bf = new SpringBusFactory(); bus = bf.createBus(CONFIG); BusFactory.setDefaultBus(bus); manager = bus.getExtension(ServerLifeCycleManager.class); recursiveCount = 0; recursiveEndpoints = new Endpoint[RECURSIVE_LIMIT]; startNotificationMap = new HashMap<>(); stopNotificationMap = new HashMap<>(); }
protected void run() { // // Just instantiate the Bus; services will be instantiated // and published automatically through Spring // final BusFactory factory = BusFactory.newInstance(); Bus bus = factory.createBus(); setBus(bus); BusFactory.setDefaultBus(bus); BusFactory.setThreadDefaultBus(bus); }
@org.junit.Before public void setUp() { BusFactory.setThreadDefaultBus(getStaticBus()); BusFactory.getThreadDefaultBus().getOutInterceptors().add(new LoggingOutInterceptor()); BusFactory.getThreadDefaultBus().getInInterceptors().add(new LoggingInInterceptor()); BusFactory.getThreadDefaultBus().getInInterceptors().add(new MalformedResponseInterceptor()); }
public WSDiscoveryServiceImpl(Bus b) { bus = b == null ? BusFactory.newInstance().createBus() : b; client = new WSDiscoveryClient(); update(bus.getProperties()); } public WSDiscoveryServiceImpl() {