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();
}
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);
}
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();
}
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());
}
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());
}
Aggregations