Search in sources :

Example 11 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.

the class DocLitBareTest method testNamespaceCrash.

@Test
public void testNamespaceCrash() {
    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setServiceClass(University.class);
    svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    svrFactory.setAddress("local://dlbTest");
    svrFactory.setServiceBean(new UniversityImpl());
    svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
    svrFactory.create();
    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.getServiceFactory().setDataBinding(new AegisDatabinding());
    factory.setServiceClass(University.class);
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    factory.setAddress("local://dlbTest");
    University client = (University) factory.create();
    Teacher tr = client.getTeacher(new Course(40, "Intro to CS", "Introductory Comp Sci"));
    assertNotNull(tr);
    assertEquals(52, tr.getAge());
    assertEquals("Mr. Tom", tr.getName());
}
Also used : ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest) Test(org.junit.Test)

Example 12 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.

the class FlatArrayTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    service = new FlatArrayService();
    ServerFactoryBean sf = new ServerFactoryBean();
    // use full parameter names.
    sf.setServiceClass(FlatArrayServiceInterface.class);
    sf.setServiceBean(service);
    sf.setAddress("local://FlatArray");
    sf.setDataBinding(new AegisDatabinding());
    sf.create();
    arrayWsdlDoc = getWSDLDocument("FlatArrayServiceInterface");
}
Also used : ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Before(org.junit.Before)

Example 13 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.

the class ClassTest method startServer.

@Before
public void startServer() throws Exception {
    AegisContext context = new AegisContext();
    context.initialize();
    context.getTypeMapping().register(new ClassAsStringType());
    ServerFactoryBean b = new ServerFactoryBean();
    b.setDataBinding(new AegisDatabinding(context));
    b.setServiceClass(GenericsService.class);
    b.setAddress("local://GenericsService");
    server = b.create();
}
Also used : AegisContext(org.apache.cxf.aegis.AegisContext) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) Before(org.junit.Before)

Example 14 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.

the class ClientServiceConfigTest method before.

@Before
public void before() throws Exception {
    super.setUp();
    ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
    factory.setInvoker(new BeanInvoker(new EchoImpl()));
    factory.setDataBinding(new AegisDatabinding());
    ServerFactoryBean svrFac = new ServerFactoryBean();
    svrFac.setAddress("local://Echo");
    svrFac.setServiceFactory(factory);
    svrFac.setServiceClass(Echo.class);
    svrFac.setBus(getBus());
    svrFac.create();
    Endpoint endpoint = Endpoint.create(new EchoImpl());
    impl = (EndpointImpl) endpoint;
    impl.setDataBinding(new AegisDatabinding());
    endpoint.publish("local://JaxWsEcho");
}
Also used : Endpoint(javax.xml.ws.Endpoint) BeanInvoker(org.apache.cxf.service.invoker.BeanInvoker) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) Before(org.junit.Before)

Example 15 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project cxf by apache.

the class JaxWsWebServicePublisherBeanPostProcessor method createAndPublishEndpoint.

private void createAndPublishEndpoint(String url, Object implementor) {
    ServerFactoryBean serverFactory = null;
    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);
    DataBinding dataBinding = null;
    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)

Aggregations

ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)48 Test (org.junit.Test)16 Server (org.apache.cxf.endpoint.Server)9 Before (org.junit.Before)9 BeforeClass (org.junit.BeforeClass)9 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)8 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)6 QName (javax.xml.namespace.QName)5 JaxWsServiceFactoryBean (org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean)5 Service (org.apache.cxf.service.Service)5 Node (org.w3c.dom.Node)5 Bus (org.apache.cxf.Bus)4 ReflectionServiceFactoryBean (org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean)4 HashMap (java.util.HashMap)3 ServerImpl (org.apache.cxf.endpoint.ServerImpl)3 ClientProxyFactoryBean (org.apache.cxf.frontend.ClientProxyFactoryBean)3 BeanInvoker (org.apache.cxf.service.invoker.BeanInvoker)3 AbstractCXFTest (org.apache.cxf.test.AbstractCXFTest)3 ServiceWSDLBuilder (org.apache.cxf.wsdl11.ServiceWSDLBuilder)3 URL (java.net.URL)2