Search in sources :

Example 21 with JaxWsServerFactoryBean

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

the class ExceptionTest method testJaxwsServerSimpleClient.

@Test(expected = HelloException.class)
public void testJaxwsServerSimpleClient() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    sfbean.setDataBinding(new AegisDatabinding());
    sfbean.setAddress("local://ExceptionServiceJaxWs1");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionServiceJaxWs1");
    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) ClientProxyFactoryBean(org.apache.cxf.frontend.ClientProxyFactoryBean) Service(org.apache.cxf.service.Service) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 22 with JaxWsServerFactoryBean

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

the class BraveTraceTest method createServer.

private static Server createServer(Feature logging) {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setAddress(ADDRESS);
    factory.setServiceBean(new MyServiceImpl());
    factory.setFeatures(Arrays.asList(logging));
    return factory.create();
}
Also used : JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 23 with JaxWsServerFactoryBean

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

the class MDBActivationWork method createServer.

private Server createServer(Bus bus, Class<?> serviceClass, MDBInvoker invoker) {
    // create server bean factory
    final ServerFactoryBean factory;
    if (serviceClass != null && EndpointUtils.hasWebServiceAnnotation(serviceClass)) {
        factory = new JaxWsServerFactoryBean();
    } else {
        factory = new ServerFactoryBean();
    }
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Creating a server using " + factory.getClass().getName());
    }
    if (serviceClass != null) {
        factory.setServiceClass(serviceClass);
    }
    if (spec.getWsdlLocation() != null) {
        factory.setWsdlLocation(spec.getWsdlLocation());
    }
    if (spec.getAddress() != null) {
        factory.setAddress(spec.getAddress());
    }
    factory.setBus(bus);
    if (spec.getEndpointName() != null) {
        factory.setEndpointName(QName.valueOf(spec.getEndpointName()));
    }
    if (spec.getSchemaLocations() != null) {
        factory.setSchemaLocations(getListOfString(spec.getSchemaLocations()));
    }
    if (spec.getServiceName() != null) {
        factory.setServiceName(QName.valueOf(spec.getServiceName()));
    }
    factory.setInvoker(invoker);
    // Don't start the server yet
    factory.setStart(false);
    final Server retval;
    if (factory instanceof JaxWsServerFactoryBean) {
        retval = createServerFromJaxwsEndpoint((JaxWsServerFactoryBean) factory);
    } else {
        retval = factory.create();
    }
    return retval;
}
Also used : Server(org.apache.cxf.endpoint.Server) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 24 with JaxWsServerFactoryBean

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

the class StudentTest method testReturnMapDocLiteral.

@Test
public void testReturnMapDocLiteral() throws Exception {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(StudentServiceDocLiteral.class);
    sf.setServiceBean(new StudentServiceDocLiteralImpl());
    sf.setAddress("local://StudentServiceDocLiteral");
    setupAegis(sf);
    Server server = sf.create();
    server.start();
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://StudentServiceDocLiteral");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());
    StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class);
    Map<Long, Student> fullMap = clientInterface.getStudentsMap();
    assertNotNull(fullMap);
    Student one = fullMap.get(Long.valueOf(1));
    assertNotNull(one);
    assertEquals("Student1", one.getName());
}
Also used : Server(org.apache.cxf.endpoint.Server) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 25 with JaxWsServerFactoryBean

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

the class StudentTest method testReturnMap.

@Test
public void testReturnMap() throws Exception {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(StudentService.class);
    sf.setServiceBean(new StudentServiceImpl());
    sf.setAddress("local://StudentService");
    setupAegis(sf);
    Server server = sf.create();
    server.start();
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://StudentService");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());
    StudentService clientInterface = proxyFac.create(StudentService.class);
    Map<Long, Student> fullMap = clientInterface.getStudentsMap();
    assertNotNull(fullMap);
    Student one = fullMap.get(Long.valueOf(1));
    assertNotNull(one);
    assertEquals("Student1", one.getName());
    Map<String, ?> wildMap = clientInterface.getWildcardMap();
    assertEquals("valuestring", wildMap.get("keystring"));
}
Also used : Server(org.apache.cxf.endpoint.Server) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) 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