Search in sources :

Example 16 with JaxWsServerFactoryBean

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

the class JaxWsWebServicePublisherBeanPostProcessor method createAndPublishEndpoint.

private void createAndPublishEndpoint(String url, Object implementor) {
    final ServerFactoryBean serverFactory;
    if (prototypeServerFactoryBeanName != null) {
        if (!beanFactory.isPrototype(prototypeServerFactoryBeanName)) {
            throw new IllegalArgumentException("prototypeServerFactoryBeanName must indicate a scope='prototype' bean");
        }
        serverFactory = beanFactory.getBean(prototypeServerFactoryBeanName, ServerFactoryBean.class);
        customizedServerFactory = true;
    } else {
        serverFactory = new JaxWsServerFactoryBean();
    }
    serverFactory.setServiceBean(implementor);
    serverFactory.setServiceClass(ClassHelper.getRealClass(implementor));
    serverFactory.setAddress(url);
    final DataBinding dataBinding;
    if (prototypeDataBindingBeanName != null) {
        if (!beanFactory.isPrototype(prototypeDataBindingBeanName)) {
            throw new IllegalArgumentException("prototypeDataBindingBeanName must indicate a scope='prototype' bean");
        }
        customizedDataBinding = true;
        dataBinding = beanFactory.getBean(prototypeDataBindingBeanName, DataBinding.class);
    } else {
        dataBinding = new JAXBDataBinding();
    }
    serverFactory.setDataBinding(dataBinding);
    serverFactory.setBus(getServletBus());
    serverFactory.create();
}
Also used : DataBinding(org.apache.cxf.databinding.DataBinding) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 17 with JaxWsServerFactoryBean

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

the class HttpTestActivator method createTestServer.

private Server createTestServer(String url) {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress(url);
    factory.setServiceBean(new GreeterImpl());
    return factory.create();
}
Also used : JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 18 with JaxWsServerFactoryBean

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

the class JmsTestActivator method publishService.

private Server publishService(ConnectionFactory connectionFactory) {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress("jms:queue:greeter");
    factory.setFeatures(Collections.singletonList(new ConnectionFactoryFeature(connectionFactory)));
    factory.setServiceBean(new GreeterImpl());
    return factory.create();
}
Also used : ConnectionFactoryFeature(org.apache.cxf.transport.jms.ConnectionFactoryFeature) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 19 with JaxWsServerFactoryBean

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

the class AbstractAegisTest method createJaxwsService.

protected Server createJaxwsService(Class<?> serviceClass, Object serviceBean, String address, QName name) {
    if (address == null) {
        address = serviceClass.getSimpleName();
    }
    JaxWsServiceFactoryBean sf = new JaxWsServiceFactoryBean();
    sf.setDataBinding(new AegisDatabinding());
    JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean();
    serverFactoryBean.setServiceClass(serviceClass);
    if (serviceBean != null) {
        serverFactoryBean.setServiceBean(serviceBean);
    }
    serverFactoryBean.setAddress("local://" + address);
    serverFactoryBean.setServiceFactory(sf);
    if (name != null) {
        serverFactoryBean.setEndpointName(name);
    }
    return serverFactoryBean.create();
}
Also used : JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 20 with JaxWsServerFactoryBean

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

the class ExceptionTest method testJaxws.

@Test(expected = HelloException.class)
public void testJaxws() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    setupAegis(sfbean);
    sfbean.setAddress("local://ExceptionService4");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionService4");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());
    ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
    clientInterface.sayHiWithException();
}
Also used : Server(org.apache.cxf.endpoint.Server) BeanInvoker(org.apache.cxf.service.invoker.BeanInvoker) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Service(org.apache.cxf.service.Service) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

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