use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class ManagedBusTest method testTwoSameNamedEndpoint.
@Test
public void testTwoSameNamedEndpoint() throws Exception {
SpringBusFactory factory = new SpringBusFactory();
Bus bus = factory.createBus();
try {
InstrumentationManager im = bus.getExtension(InstrumentationManager.class);
assertNotNull(im);
InstrumentationManagerImpl imi = (InstrumentationManagerImpl) im;
imi.setServer(ManagementFactory.getPlatformMBeanServer());
imi.setEnabled(true);
imi.init();
Greeter greeter1 = new GreeterImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello");
svrFactory.setServiceBean(greeter1);
svrFactory.getProperties(true).put("managed.endpoint.name", "greeter1");
svrFactory.create();
Greeter greeter2 = new GreeterImpl();
svrFactory = new JaxWsServerFactoryBean();
svrFactory.setAddress("http://localhost:" + SERVICE_PORT + "/Hello2");
svrFactory.setServiceBean(greeter2);
svrFactory.getProperties(true).put("managed.endpoint.name", "greeter2");
svrFactory.create();
MBeanServer mbs = im.getMBeanServer();
ObjectName name = new ObjectName(ManagementConstants.DEFAULT_DOMAIN_NAME + ":type=Bus.Service.Endpoint,*");
Set<?> s = mbs.queryMBeans(name, null);
assertEquals(2, s.size());
} finally {
bus.shutdown(true);
}
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class MtomPolicyTest method setupServer.
public void setupServer(boolean mtomRequired, String address) throws Exception {
getStaticBus().getExtension(PolicyEngine.class).setAlternativeSelector(new FirstAlternativeSelector());
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceBean(new EchoService());
sf.setBus(getStaticBus());
sf.setAddress(address);
WSPolicyFeature policyFeature = new WSPolicyFeature();
List<Element> policyElements = new ArrayList<>();
if (mtomRequired) {
policyElements.add(StaxUtils.read(getClass().getResourceAsStream("mtom-policy.xml")).getDocumentElement());
} else {
policyElements.add(StaxUtils.read(getClass().getResourceAsStream("mtom-policy-optional.xml")).getDocumentElement());
}
policyFeature.setPolicyElements(policyElements);
sf.getFeatures().add(policyFeature);
sf.create();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class Server11 method run.
protected void run() {
Object implementor = new GreeterImpl11();
String address = "http://localhost:" + PORT + "/SoapContext/GreeterPort";
// 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 nutzboot by nutzam.
the class CxfStarter method loadBus.
protected void loadBus(ServletConfig sc) {
super.loadBus(sc);
for (Class<?> klass : Scans.me().scanPackage(appContext.getPackage(), null)) {
// 有@WebService和@IocBean注解的非接口类
WebService ws = klass.getAnnotation(WebService.class);
if (ws == null || klass.isInterface())
continue;
if (Strings.isBlank(ws.serviceName())) {
log.infof("%s has @WebService but serviceName is blank, ignore", klass.getName());
continue;
}
log.debugf("add WebService addr=/%s type=%s", ws.serviceName(), klass.getName());
JaxWsServerFactoryBean sfb = new JaxWsServerFactoryBean();
sfb.setServiceBean(ioc.get(klass));
sfb.create();
}
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project Activiti by Activiti.
the class AbstractWebServiceTaskTest method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
webServiceMock = new WebServiceMockImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(WebServiceMock.class);
svrFactory.setAddress(WEBSERVICE_MOCK_ADDRESS);
svrFactory.setServiceBean(webServiceMock);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
Aggregations