Search in sources :

Example 41 with JaxWsServerFactoryBean

use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.

the class SimpleEventingIntegrationTest method createEndToEndpoint.

protected Server createEndToEndpoint(String address) {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceBean(new TestingEndToEndpointImpl());
    factory.setAddress(address);
    factory.getHandlers().add(new WSAActionAssertingHandler(EventingConstants.ACTION_SUBSCRIPTION_END));
    return factory.create();
}
Also used : TestingEndToEndpointImpl(org.apache.cxf.ws.eventing.integration.eventsink.TestingEndToEndpointImpl) WSAActionAssertingHandler(org.apache.cxf.ws.eventing.integration.notificationapi.assertions.WSAActionAssertingHandler) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 42 with JaxWsServerFactoryBean

use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.

the class SimpleEventingIntegrationTest method setUpBeforeClass.

/**
 * Prepares the Event Source and Subscription Manager services
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    bus = BusFactory.getDefaultBus();
    // create and publish event source
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceBean(new TestingEventSource());
    factory.setAddress(URL_EVENT_SOURCE);
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    eventSource = factory.create();
    // create and publish subscription manager
    factory = new JaxWsServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceBean(new TestingSubscriptionManager());
    factory.setAddress(URL_SUBSCRIPTION_MANAGER);
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    subscriptionManager = factory.create();
    new LoggingFeature().initialize(subscriptionManager, bus);
}
Also used : TestingSubscriptionManager(org.apache.cxf.ws.eventing.base.services.TestingSubscriptionManager) LoggingFeature(org.apache.cxf.ext.logging.LoggingFeature) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) TestingEventSource(org.apache.cxf.ws.eventing.base.services.TestingEventSource) BeforeClass(org.junit.BeforeClass)

Example 43 with JaxWsServerFactoryBean

use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.

the class IntegrationBaseTest method createLocalResourceFactory.

protected Server createLocalResourceFactory(ResourceManager manager) {
    ResourceFactoryImpl implementor = new ResourceFactoryImpl();
    implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_ADDRESS, manager));
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceClass(ResourceFactory.class);
    factory.setAddress(RESOURCE_FACTORY_ADDRESS);
    factory.setServiceBean(implementor);
    return factory.create();
}
Also used : SimpleResourceResolver(org.apache.cxf.ws.transfer.resourcefactory.resolver.SimpleResourceResolver) ResourceFactoryImpl(org.apache.cxf.ws.transfer.resourcefactory.ResourceFactoryImpl) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 44 with JaxWsServerFactoryBean

use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.

the class ServerMisc method run.

protected void run() {
    Factory factory = new PerRequestFactory(DocLitWrappedCodeFirstServiceImpl.class);
    factory = new PooledFactory(factory, 4);
    JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
    JaxWsServerFactoryBean factoryBean;
    Map<String, Object> properties = new HashMap<>();
    properties.put("bus.jmx.usePlatformMBeanServer", Boolean.TRUE);
    properties.put("bus.jmx.enabled", Boolean.TRUE);
    Bus b = new CXFBusFactory().createBus(null, properties);
    setBus(b);
    MetricRegistry registry = new MetricRegistry();
    CodahaleMetricsProvider.setupJMXReporter(b, registry);
    b.setExtension(registry, MetricRegistry.class);
    factoryBean = new JaxWsServerFactoryBean();
    factoryBean.setBus(b);
    factoryBean.setAddress(DOCLIT_CODEFIRST_URL);
    factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
    factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
    factoryBean.setInvoker(invoker);
    servers.add(factoryBean.create());
    factoryBean = new JaxWsServerFactoryBean();
    factoryBean.setBus(b);
    factoryBean.setAddress(DOCLIT_CODEFIRST_URL_XMLBINDING);
    factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
    factoryBean.setFeatures(Arrays.asList(new MetricsFeature()));
    factoryBean.setInvoker(invoker);
    factoryBean.setBindingId("http://cxf.apache.org/bindings/xformat");
    factoryBean.setWsdlURL("cxf6866.wsdl");
    servers.add(factoryBean.create());
    factoryBean = new JaxWsServerFactoryBean();
    factoryBean.setAddress(DOCLIT_CODEFIRST_SETTINGS_URL);
    factoryBean.setServiceClass(DocLitWrappedCodeFirstServiceImpl.class);
    factoryBean.setInvoker(invoker);
    factoryBean.getServiceFactory().setAnonymousWrapperTypes(true);
    factoryBean.getServiceFactory().getServiceConfigurations().add(0, new AbstractServiceConfiguration() {

        public Boolean isWrapperPartNillable(MessagePartInfo mpi) {
            return Boolean.TRUE;
        }

        public Long getWrapperPartMinOccurs(MessagePartInfo mpi) {
            return Long.valueOf(1L);
        }
    });
    servers.add(factoryBean.create());
    // Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
    // endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
    Object implementor7 = new DocLitBareCodeFirstServiceImpl();
    EndpointImpl ep = (EndpointImpl) Endpoint.publish(DOCLITBARE_CODEFIRST_URL, implementor7);
    ep.getServer().getEndpoint().getInInterceptors().add(new SAAJInInterceptor());
    endpoints.add(ep);
    Object implementor6 = new InterfaceInheritTestImpl();
    endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_BASE_URL, implementor6));
    Object implementor1 = new AnonymousComplexTypeImpl();
    String address = "http://localhost:" + PORT + "/anonymous_complex_typeSOAP";
    endpoints.add(Endpoint.publish(address, implementor1));
    Object implementor2 = new JaxbElementTestImpl();
    address = "http://localhost:" + PORT + "/jaxb_element_test";
    endpoints.add(Endpoint.publish(address, implementor2));
    Object implementor3 = new OrderedParamHolderImpl();
    address = "http://localhost:" + PORT + "/ordered_param_holder/";
    endpoints.add(Endpoint.publish(address, implementor3));
    // Object implementor4 = new DocLitWrappedCodeFirstServiceImpl();
    // endpoints.add(Endpoint.publish(DOCLIT_CODEFIRST_URL, implementor4));
    Object implementor5 = new RpcLitCodeFirstServiceImpl();
    endpoints.add(Endpoint.publish(RPCLIT_CODEFIRST_URL, implementor5));
    endpoints.add(Endpoint.publish("http://localhost:" + PORT + "/InheritContext/InheritPort", new InheritImpl()));
    endpoints.add(Endpoint.publish(CXF_5064_URL, new SOAPHeaderServiceImpl()));
}
Also used : HashMap(java.util.HashMap) MetricsFeature(org.apache.cxf.metrics.MetricsFeature) Factory(org.apache.cxf.service.invoker.Factory) PooledFactory(org.apache.cxf.service.invoker.PooledFactory) PerRequestFactory(org.apache.cxf.service.invoker.PerRequestFactory) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) MessagePartInfo(org.apache.cxf.service.model.MessagePartInfo) PooledFactory(org.apache.cxf.service.invoker.PooledFactory) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) CXFBusFactory(org.apache.cxf.bus.CXFBusFactory) JaxbElementTestImpl(org.apache.cxf.jaxb_element_test.JaxbElementTestImpl) Bus(org.apache.cxf.Bus) SOAPHeaderServiceImpl(org.apache.cxf.systest.jaxws.cxf5064.SOAPHeaderServiceImpl) MetricRegistry(com.codahale.metrics.MetricRegistry) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl) JAXWSMethodInvoker(org.apache.cxf.jaxws.JAXWSMethodInvoker) SAAJInInterceptor(org.apache.cxf.binding.soap.saaj.SAAJInInterceptor) AbstractServiceConfiguration(org.apache.cxf.wsdl.service.factory.AbstractServiceConfiguration) AnonymousComplexTypeImpl(org.apache.cxf.anonymous_complex_type.AnonymousComplexTypeImpl) OrderedParamHolderImpl(org.apache.cxf.ordered_param_holder.OrderedParamHolderImpl) PerRequestFactory(org.apache.cxf.service.invoker.PerRequestFactory)

Example 45 with JaxWsServerFactoryBean

use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.

the class WsdlGetUtilsTest method testNewDocumentIsCreatedForEachWsdlRequest.

@Test
public void testNewDocumentIsCreatedForEachWsdlRequest() {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceBean(new StuffImpl());
    factory.setAddress("http://localhost:" + PORT + "/Stuff");
    Server server = factory.create();
    try {
        Message message = new MessageImpl();
        Exchange exchange = new ExchangeImpl();
        exchange.put(Bus.class, getBus());
        exchange.put(Service.class, server.getEndpoint().getService());
        exchange.put(Endpoint.class, server.getEndpoint());
        message.setExchange(exchange);
        Map<String, String> map = UrlUtils.parseQueryString("wsdl");
        String baseUri = "http://localhost:" + PORT + "/Stuff";
        String ctx = "/Stuff";
        WSDLGetUtils utils = new WSDLGetUtils();
        Document doc = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());
        Document doc2 = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());
        assertFalse(doc == doc2);
    } finally {
        server.stop();
    }
}
Also used : Exchange(org.apache.cxf.message.Exchange) Server(org.apache.cxf.endpoint.Server) Message(org.apache.cxf.message.Message) WSDLGetUtils(org.apache.cxf.frontend.WSDLGetUtils) Document(org.w3c.dom.Document) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) Test(org.junit.Test)

Aggregations

JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)106 Server (org.apache.cxf.endpoint.Server)32 Test (org.junit.Test)29 Service (org.apache.cxf.service.Service)21 Bus (org.apache.cxf.Bus)15 HashMap (java.util.HashMap)13 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)13 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)13 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)9 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)8 QName (javax.xml.namespace.QName)7 AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)7 BeforeClass (org.junit.BeforeClass)7 Endpoint (org.apache.cxf.endpoint.Endpoint)6 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)6 JAXWSMethodInvoker (org.apache.cxf.jaxws.JAXWSMethodInvoker)6 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)6 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)5 URL (java.net.URL)4 Definition (javax.wsdl.Definition)4