use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class ProviderServiceFactoryTest method testFromWSDL.
@Test
public void testFromWSDL() throws Exception {
URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
assertNotNull(resource);
JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(HWSoapMessageProvider.class);
JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean(implInfo);
bean.setWsdlURL(resource.toString());
Bus bus = getBus();
bean.setBus(bus);
bean.setServiceClass(HWSoapMessageProvider.class);
Service service = bean.create();
assertTrue(service.getInvoker() instanceof JAXWSMethodInvoker);
assertEquals("SOAPService", service.getName().getLocalPart());
assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI());
InterfaceInfo intf = service.getServiceInfos().get(0).getInterface();
assertNotNull(intf);
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setBus(bus);
svrFactory.setServiceFactory(bean);
svrFactory.setStart(false);
ServerImpl server = (ServerImpl) svrFactory.create();
assertTrue(server.getEndpoint().getService().getInvoker() instanceof JAXWSMethodInvoker);
Endpoint endpoint = server.getEndpoint();
Binding binding = endpoint.getBinding();
assertTrue(binding instanceof SoapBinding);
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class DOMToStaxEncryptionIdentifierTest method createService.
private Service createService() {
// Create the Service
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceBean(new EchoImpl());
factory.setAddress("local://Echo");
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
Server server = factory.create();
Service service = server.getEndpoint().getService();
service.getInInterceptors().add(new LoggingInInterceptor());
service.getOutInterceptors().add(new LoggingOutInterceptor());
return service;
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class DOMToStaxRoundTripTest method createService.
private Service createService() {
// Create the Service
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceBean(new EchoImpl());
factory.setAddress("local://Echo");
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
Server server = factory.create();
Service service = server.getEndpoint().getService();
service.getInInterceptors().add(new LoggingInInterceptor());
service.getOutInterceptors().add(new LoggingOutInterceptor());
return service;
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class RoundTripTest method setUpService.
@Before
public void setUpService() throws Exception {
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceBean(new EchoImpl());
factory.setAddress("local://Echo");
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
Server server = factory.create();
Service service = server.getEndpoint().getService();
service.getInInterceptors().add(new SAAJInInterceptor());
service.getInInterceptors().add(new LoggingInInterceptor());
service.getOutInterceptors().add(new SAAJOutInterceptor());
service.getOutInterceptors().add(new LoggingOutInterceptor());
wsIn = new WSS4JInInterceptor();
wsIn.setProperty(ConfigurationConstants.SIG_VER_PROP_FILE, "insecurity.properties");
wsIn.setProperty(ConfigurationConstants.DEC_PROP_FILE, "insecurity.properties");
wsIn.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName());
service.getInInterceptors().add(wsIn);
wsOut = new WSS4JOutInterceptor();
wsOut.setProperty(ConfigurationConstants.SIG_PROP_FILE, "outsecurity.properties");
wsOut.setProperty(ConfigurationConstants.ENC_PROP_FILE, "outsecurity.properties");
wsOut.setProperty(ConfigurationConstants.USER, "myalias");
wsOut.setProperty("password", "myAliasPassword");
wsOut.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName());
service.getOutInterceptors().add(wsOut);
// Create the client
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
echo = (Echo) proxyFac.create();
client = ClientProxy.getClient(echo);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getInInterceptors().add(wsIn);
client.getInInterceptors().add(new SAAJInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
client.getOutInterceptors().add(wsOut);
client.getOutInterceptors().add(new SAAJOutInterceptor());
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class StaxCryptoCoverageCheckerTest method createService.
private Service createService() {
// Create the Service
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceBean(new EchoImpl());
factory.setAddress("local://Echo");
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
Server server = factory.create();
Service service = server.getEndpoint().getService();
service.getInInterceptors().add(new LoggingInInterceptor());
service.getOutInterceptors().add(new LoggingOutInterceptor());
return service;
}
Aggregations