use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class DOMToStaxSignatureIdentifierTest 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 IntegrationBaseTest method createLocalResource.
protected Server createLocalResource(ResourceManager manager) {
ResourceLocal implementor = new ResourceLocal();
implementor.setManager(manager);
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
Map<String, Object> props = factory.getProperties(true);
props.put("jaxb.additionalContextClasses", org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
factory.setProperties(props);
factory.setBus(bus);
factory.setServiceClass(Resource.class);
factory.setAddress(RESOURCE_LOCAL_ADDRESS);
factory.setServiceBean(implementor);
return factory.create();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class IntegrationBaseTest method createRemoteResourceFactory.
protected Server createRemoteResourceFactory() {
ResourceFactoryImpl implementor = new ResourceFactoryImpl();
implementor.setResourceResolver(new SimpleResourceResolver(RESOURCE_REMOTE_ADDRESS, null));
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setBus(bus);
factory.setServiceClass(ResourceFactory.class);
factory.setAddress(RESOURCE_FACTORY_ADDRESS);
factory.setServiceBean(implementor);
return factory.create();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class IntegrationBaseTest method createRemoteResource.
protected Server createRemoteResource(ResourceManager manager) {
ResourceRemote implementor = new ResourceRemote();
implementor.setManager(manager);
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
Map<String, Object> props = factory.getProperties(true);
props.put("jaxb.additionalContextClasses", org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType.class);
factory.setProperties(props);
factory.setBus(bus);
factory.setServiceClass(ResourceFactory.class);
factory.setAddress(RESOURCE_REMOTE_MANAGER_ADDRESS);
factory.setServiceBean(implementor);
return factory.create();
}
use of org.apache.cxf.jaxws.JaxWsServerFactoryBean in project cxf by apache.
the class PublishedEndpointUrlTest method testPublishedEndpointUrl.
@Test
public void testPublishedEndpointUrl() throws Exception {
Greeter implementor = new org.apache.hello_world_soap_http.GreeterImpl();
String publishedEndpointUrl = "http://cxf.apache.org/publishedEndpointUrl";
Bus bus = BusFactory.getDefaultBus();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setBus(bus);
svrFactory.setServiceClass(Greeter.class);
svrFactory.setAddress("http://localhost:" + PORT + "/publishedEndpointUrl");
svrFactory.setPublishedEndpointUrl(publishedEndpointUrl);
svrFactory.setServiceBean(implementor);
Server server = svrFactory.create();
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
URL url = new URL(svrFactory.getAddress() + "?wsdl=1");
HttpURLConnection connect = (HttpURLConnection) url.openConnection();
assertEquals(500, connect.getResponseCode());
Definition wsdl = wsdlReader.readWSDL(svrFactory.getAddress() + "?wsdl");
assertNotNull(wsdl);
Collection<Service> services = CastUtils.cast(wsdl.getAllServices().values());
final String failMesg = "WSDL provided incorrect soap:address location";
for (Service service : services) {
Collection<Port> ports = CastUtils.cast(service.getPorts().values());
for (Port port : ports) {
List<?> extensions = port.getExtensibilityElements();
for (Object extension : extensions) {
String actualUrl = null;
if (extension instanceof SOAP12Address) {
actualUrl = ((SOAP12Address) extension).getLocationURI();
} else if (extension instanceof SOAPAddress) {
actualUrl = ((SOAPAddress) extension).getLocationURI();
}
// System.out.println("Checking url: " + actualUrl + " against " + publishedEndpointUrl);
assertEquals(failMesg, publishedEndpointUrl, actualUrl);
}
}
}
server.stop();
server.destroy();
bus.shutdown(true);
}
Aggregations