Search in sources :

Example 96 with JaxWsServerFactoryBean

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

the class Server12 method run.

protected void run() {
    Object implementor = new GreeterImpl12();
    String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
    // enable the options of stack trace and the exception cause message
    Map<String, Object> properties = new HashMap<>();
    properties.put("exceptionMessageCauseEnabled", "true");
    properties.put("faultStackTraceEnabled", "true");
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setAddress(address);
    factory.setServiceBean(implementor);
    factory.setProperties(properties);
    factory.create();
}
Also used : HashMap(java.util.HashMap) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 97 with JaxWsServerFactoryBean

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

the class ActionTest method testAsymmetricActionToPolicyServerFactory.

// Here the client is using "Actions", where the server is using an AsymmetricBinding policy,
// and we are building the service in code using JaxWsServerFactoryBean instead of Spring
@org.junit.Test
public void testAsymmetricActionToPolicyServerFactory() throws Exception {
    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    URL serviceWSDL = ActionTest.class.getResource("DoubleItActionPolicy.wsdl");
    svrFactory.setWsdlLocation(serviceWSDL.toString());
    String address = "http://localhost:" + PORT2 + "/DoubleItAsymmetric";
    svrFactory.setAddress(address);
    DoubleItPortTypeImpl serviceBean = new DoubleItPortTypeImpl();
    serviceBean.setEnforcePrincipal(false);
    svrFactory.setServiceBean(serviceBean);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricPort");
    svrFactory.setEndpointName(portQName);
    Map<String, Object> props = new HashMap<>();
    props.put("security.callback-handler", "org.apache.cxf.systest.ws.common.KeystorePasswordCallback");
    props.put("security.signature.properties", "bob.properties");
    props.put("security.encryption.properties", "alice.properties");
    props.put("security.encryption.username", "alice");
    svrFactory.setProperties(props);
    org.apache.cxf.endpoint.Server server = svrFactory.create();
    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);
    DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, PORT2);
    // Successful call
    assertEquals(50, port.doubleIt(25));
    ((java.io.Closeable) port).close();
    server.destroy();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItPortTypeImpl(org.apache.cxf.systest.ws.common.DoubleItPortTypeImpl) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) DoubleItPortType(org.example.contract.doubleit.DoubleItPortType) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 98 with JaxWsServerFactoryBean

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

the class ValidationWithAttachmentTest method initServer.

private static void initServer() {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceClass(AttachmentServiceImpl.class);
    factory.setAddress(ADDRESS);
    factory.setServiceBean(new AttachmentServiceImpl());
    server = factory.create();
}
Also used : JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 99 with JaxWsServerFactoryBean

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

the class WSAFeatureXmlTest method testServerFactory.

@Test
public void testServerFactory() {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    assertNotNull(bus != null);
    sf.setServiceBean(new GreeterImpl());
    sf.setAddress("http://localhost:" + PORT + "/test");
    sf.setStart(false);
    Configurer c = getBus().getExtension(Configurer.class);
    c.configureBean("server", sf);
    Server server = sf.create();
    Endpoint endpoint = server.getEndpoint();
    checkAddressInterceptors(endpoint.getInInterceptors());
}
Also used : Server(org.apache.cxf.endpoint.Server) Endpoint(org.apache.cxf.endpoint.Endpoint) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) Configurer(org.apache.cxf.configuration.Configurer) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest)

Example 100 with JaxWsServerFactoryBean

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

the class WSAFeatureTest method testServerFactory.

@Test
public void testServerFactory() {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.getFeatures().add(new WSAddressingFeature());
    sf.setServiceBean(new GreeterImpl());
    sf.setAddress("http://localhost:" + PORT + "/test");
    sf.setStart(false);
    sf.setBus(getBus());
    Server server = sf.create();
    Endpoint endpoint = server.getEndpoint();
    checkAddressInterceptors(endpoint.getInInterceptors());
}
Also used : WSAddressingFeature(org.apache.cxf.ws.addressing.WSAddressingFeature) Server(org.apache.cxf.endpoint.Server) Endpoint(org.apache.cxf.endpoint.Endpoint) GreeterImpl(org.apache.hello_world_soap_http.GreeterImpl) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractCXFTest(org.apache.cxf.test.AbstractCXFTest)

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