org.apache.cxf.jaxws.JaxWsServerFactoryBean Java Examples

The following examples show how to use org.apache.cxf.jaxws.JaxWsServerFactoryBean. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CxfTest.java    From java-specialagent with Apache License 2.0 6 votes vote down vote up
@Test
public void testWs(final MockTracer tracer) {
  final String msg = "hello";

  // prepare server
  final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
  serverFactory.setServiceClass(Echo.class);
  serverFactory.setAddress(BASE_URI);
  serverFactory.setServiceBean(new EchoImpl());
  final Server server = serverFactory.create();

  // prepare client
  final JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
  clientFactory.setServiceClass(Echo.class);
  clientFactory.setAddress(BASE_URI);
  final Echo echo = (Echo)clientFactory.create();

  final String response = echo.echo(msg);

  assertEquals(msg, response);
  assertEquals(2, tracer.finishedSpans().size());

  server.destroy();
  serverFactory.getBus().shutdown(true);
}
 
Example #2
Source File: ProviderImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
public Endpoint createEndpoint(String bindingId, Class<?> implementorClass,
                               Invoker invoker, WebServiceFeature ... features) {
    if (EndpointUtils.isValidImplementor(implementorClass)) {
        Bus bus = BusFactory.getThreadDefaultBus();
        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        if (features != null) {
            factory.getJaxWsServiceFactory().setWsFeatures(Arrays.asList(features));
        }
        if (invoker != null) {
            factory.setInvoker(new JAXWSMethodInvoker(invoker));
            try {
                invoker.inject(new WebServiceContextImpl());
            } catch (Exception e) {
                throw new WebServiceException(new Message("ENDPOINT_CREATION_FAILED_MSG",
                                                          LOG).toString(), e);
            }
        }
        EndpointImpl ep = new EndpointImpl(bus, null, factory);
        ep.setImplementorClass(implementorClass);
        return ep;
    }
    throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
}
 
Example #3
Source File: DualOutServiceTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testWSDL() throws Exception {
    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(DualOutService.class);
    sf.setAddress("local://DualOutService");
    sf.setBus(getBus());
    setupAegis(sf);
    sf.create();

    Document wsdl = getWSDLDocument("DualOutService");
    assertNotNull(wsdl);

    addNamespace("xsd", Constants.URI_2001_SCHEMA_XSD);

    assertValid(
                "//xsd:complexType[@name='getValuesResponse']//xsd:element"
                + "[@name='return'][@type='xsd:string']",
                wsdl);
    assertValid(
                "//xsd:complexType[@name='getValuesResponse']//xsd:element"
                + "[@name='return1'][@type='xsd:string']",
                wsdl);
}
 
Example #4
Source File: ProviderServiceFactoryTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testSourceMessageProviderCodeFirst() throws Exception {
    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setServiceClass(SourceMessageProvider.class);
    svrFactory.setBus(getBus());
    svrFactory.setServiceBean(new SourceMessageProvider());
    String address = "local://localhost:9000/test";
    svrFactory.setAddress(address);

    svrFactory.create();

    Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml");

    addNamespace("j", "http://service.jaxws.cxf.apache.org/");
    assertValid("/s:Envelope/s:Body/j:sayHi", res);
}
 
Example #5
Source File: StudentTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testReturnMap() throws Exception {

    JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(StudentService.class);
    sf.setServiceBean(new StudentServiceImpl());
    sf.setAddress("local://StudentService");
    setupAegis(sf);
    Server server = sf.create();
    server.start();

    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://StudentService");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());

    StudentService clientInterface = proxyFac.create(StudentService.class);
    Map<Long, Student> fullMap = clientInterface.getStudentsMap();
    assertNotNull(fullMap);
    Student one = fullMap.get(Long.valueOf(1));
    assertNotNull(one);
    assertEquals("Student1", one.getName());

    Map<String, ?> wildMap = clientInterface.getWildcardMap();
    assertEquals("valuestring", wildMap.get("keystring"));
}
 
Example #6
Source File: CXFITest.java    From java-specialagent with Apache License 2.0 6 votes vote down vote up
public static void main(final String[] args) {
  final String msg = "hello";

  final JaxWsServerFactoryBean serverFactory = new JaxWsServerFactoryBean();
  serverFactory.setAddress(BASE_URI);
  serverFactory.setServiceBean(new EchoImpl());
  final Server server = serverFactory.create();

  final JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
  clientFactory.setServiceClass(Echo.class);
  clientFactory.setAddress(BASE_URI);
  final Echo echo = (Echo)clientFactory.create();

  echo.echo(msg);

  // CXF Tracing span has no "component" tag, cannot use TestUtil.checkSpan()
  checkSpans(2);

  server.destroy();
  serverFactory.getBus().shutdown(true);
}
 
Example #7
Source File: ExceptionTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test(expected = HelloException.class)
public void testJaxwsNoXfireCompat() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    sfbean.setDataBinding(new AegisDatabinding());
    sfbean.getServiceFactory().setDataBinding(sfbean.getDataBinding());
    sfbean.setAddress("local://ExceptionServiceJaxWs");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));

    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionServiceJaxWs");
    proxyFac.setServiceClass(ExceptionService.class);
    proxyFac.setBus(getBus());
    proxyFac.getClientFactoryBean().getServiceFactory().setDataBinding(new AegisDatabinding());
    ExceptionService clientInterface = (ExceptionService)proxyFac.create();

    clientInterface.sayHiWithException();
}
 
Example #8
Source File: HelloWorldImplTest.java    From cxf-jaxws with MIT License 6 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  // start the HelloWorld service using jaxWsServerFactoryBean
  JaxWsServerFactoryBean jaxWsServerFactoryBean =
      new JaxWsServerFactoryBean();

  // adding loggingFeature to print the received/sent messages
  LoggingFeature loggingFeature = new LoggingFeature();
  loggingFeature.setPrettyLogging(true);

  jaxWsServerFactoryBean.getFeatures().add(loggingFeature);

  // setting the implementation
  HelloWorldImpl implementor = new HelloWorldImpl();
  jaxWsServerFactoryBean.setServiceBean(implementor);
  // setting the endpoint
  jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
  jaxWsServerFactoryBean.create();
}
 
Example #9
Source File: ExceptionTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test(expected = HelloException.class)
public void testJaxwsServerSimpleClient() throws Exception {
    JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
    sfbean.setServiceClass(ExceptionService.class);
    sfbean.setDataBinding(new AegisDatabinding());
    sfbean.setAddress("local://ExceptionServiceJaxWs1");
    Server server = sfbean.create();
    Service service = server.getEndpoint().getService();
    service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));

    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://ExceptionServiceJaxWs1");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());

    ExceptionService clientInterface = proxyFac.create(ExceptionService.class);

    clientInterface.sayHiWithException();
}
 
Example #10
Source File: JaxwsClientToJaxwsServerIT.java    From tracee with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Before
public void setup() {

	JaxWsServerFactoryBean jaxWsServer = createJaxWsServer();
	jaxWsServer.getHandlers().add(new TraceeServerHandler(serverBackend, new SoapHeaderTransport()));
	server = jaxWsServer.create();

	JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean();

	factoryBean.setServiceClass(HelloWorldTestService.class);
	factoryBean.setAddress(endpointAddress);
	factoryBean.getHandlers().add(new TraceeClientHandler(clientBackend));
	factoryBean.setBus(CXFBusFactory.getDefaultBus());

	helloWorldPort = factoryBean.create(HelloWorldTestService.class);
}
 
Example #11
Source File: HelloWorldImplTest.java    From cxf-jaxws with MIT License 6 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  // start the HelloWorld service using jaxWsServerFactoryBean
  JaxWsServerFactoryBean jaxWsServerFactoryBean =
      new JaxWsServerFactoryBean();

  // adding loggingFeature to print the received/sent messages
  LoggingFeature loggingFeature = new LoggingFeature();
  loggingFeature.setPrettyLogging(true);

  jaxWsServerFactoryBean.getFeatures().add(loggingFeature);

  // setting the implementation
  HelloWorldImpl implementor = new HelloWorldImpl();
  jaxWsServerFactoryBean.setServiceBean(implementor);
  // setting the endpoint
  jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);
  jaxWsServerFactoryBean.create();
}
 
Example #12
Source File: HelloWorldImplTest.java    From cxf-jaxws with MIT License 6 votes vote down vote up
private static void createServerEndpoint() {
  JaxWsServerFactoryBean jaxWsServerFactoryBean =
      new JaxWsServerFactoryBean();

  // create the loggingFeature
  LoggingFeature loggingFeature = new LoggingFeature();
  loggingFeature.setPrettyLogging(true);

  // add the loggingFeature to print the received/sent messages
  jaxWsServerFactoryBean.getFeatures().add(loggingFeature);

  HelloWorldImpl implementor = new HelloWorldImpl();
  jaxWsServerFactoryBean.setServiceBean(implementor);
  jaxWsServerFactoryBean.setAddress(ENDPOINT_ADDRESS);

  jaxWsServerFactoryBean.create();
}
 
Example #13
Source File: AbstractAegisTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server createJaxwsService(Class<?> serviceClass,
                                    Object serviceBean, String address, QName name) {
    if (address == null) {
        address = serviceClass.getSimpleName();
    }
    JaxWsServiceFactoryBean sf = new JaxWsServiceFactoryBean();
    sf.setDataBinding(new AegisDatabinding());
    JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean();
    serverFactoryBean.setServiceClass(serviceClass);

    if (serviceBean != null) {
        serverFactoryBean.setServiceBean(serviceBean);
    }

    serverFactoryBean.setAddress("local://" + address);

    serverFactoryBean.setServiceFactory(sf);
    if (name != null) {
        serverFactoryBean.setEndpointName(name);
    }
    return serverFactoryBean.create();
}
 
Example #14
Source File: ClientServerSwaTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {
    try {
        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        factory.setBus(getBus());
        factory.setWsdlLocation("classpath:/swa-mime_jms.wsdl");
        factory.setTransportId(SoapJMSConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
        factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService"));
        factory.setEndpointName(new QName("http://cxf.apache.org/swa", "SwAServiceJMSPort"));
        factory.setAddress(ADDRESS + broker.getEncodedBrokerURL());
        factory.setServiceBean(new SwAServiceImpl());
        factory.create().start();
    } catch (Exception e) {
        e.printStackTrace();
        Thread.currentThread().interrupt();
    }
}
 
Example #15
Source File: AbstractTestCXFClientServerInterceptors.java    From kieker with Apache License 2.0 6 votes vote down vote up
private Server startServer() {
	LOGGER.info("XX: {}", this.serviceAddress);

	final JaxWsServerFactoryBean srvFactory = new JaxWsServerFactoryBean();
	srvFactory.setServiceClass(IBookstore.class);
	srvFactory.setAddress(this.serviceAddress);
	srvFactory.setServiceBean(new BookstoreImpl());

	// On the server-side, we only intercept incoming requests and outgoing
	// responses.
	srvFactory.getInInterceptors()
			.add(new OperationExecutionSOAPRequestInInterceptor(this.serverMonitoringController));
	srvFactory.getOutInterceptors()
			.add(new OperationExecutionSOAPResponseOutInterceptor(this.serverMonitoringController));
	return srvFactory.create(); // create() also starts the server
}
 
Example #16
Source File: WSAFeatureXmlTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #17
Source File: JavaFirstSchemaValidationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static Server createServer(String port, Class<?> serviceInterface, Object serviceImpl,
        SchemaValidationType type, Feature ... features)
    throws IOException {
    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setServiceClass(serviceImpl.getClass());

    if (features != null) {
        Collections.addAll(svrFactory.getFeatures(), features);
    }

    if (type != null) {
        Map<String, Object> properties = new HashMap<>();
        properties.put(Message.SCHEMA_VALIDATION_ENABLED, type);
        svrFactory.setProperties(properties);
    }

    svrFactory.setAddress(getAddress(port, serviceInterface));
    svrFactory.setServiceBean(serviceImpl);
    Server server = svrFactory.create();
    serverList.add(server);
    return server;
}
 
Example #18
Source File: BraveTracingTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
protected void run() {
    final Tracing brave = Tracing.newBuilder()
        .localServiceName("book-store")
        .spanReporter(new TestSpanReporter())
        .build();

    final JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(BookStore.class);
    sf.setAddress("http://localhost:" + PORT);
    sf.getFeatures().add(new BraveFeature(brave));
    server = sf.create();
}
 
Example #19
Source File: OpenTracingTracingTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
protected void run() {
    final Tracer tracer = new JaegerTracer.Builder("tracer-jaxws")
        .withSampler(new ConstSampler(true))
        .withReporter(REPORTER)
        .build();
    GlobalTracer.registerIfAbsent(tracer);

    final JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
    sf.setServiceClass(BookStore.class);
    sf.setAddress("http://localhost:" + PORT);
    sf.getFeatures().add(new OpenTracingFeature(tracer));
    server = sf.create();
}
 
Example #20
Source File: SimpleEventingIntegrationTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected Server createEventSinkWithReferenceParametersAssertion(String address, ReferenceParametersType params) {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setBus(bus);
    factory.setServiceBean(new TestingEventSinkImpl());
    factory.setAddress(address);
    factory.getHandlers().add(new ReferenceParametersAssertingHandler(params));
    return factory.create();
}
 
Example #21
Source File: StaxToDOMSamlTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #22
Source File: WSAFeatureTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@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());

}
 
Example #23
Source File: WsdlGetUtilsTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testNewDocumentIsCreatedForEachWsdlRequest() {
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceBean(new StuffImpl());
    factory.setAddress("http://localhost:" + PORT + "/Stuff");
    Server server = factory.create();

    try {
        Message message = new MessageImpl();
        Exchange exchange = new ExchangeImpl();
        exchange.put(Bus.class, getBus());
        exchange.put(Service.class, server.getEndpoint().getService());
        exchange.put(Endpoint.class, server.getEndpoint());
        message.setExchange(exchange);

        Map<String, String> map = UrlUtils.parseQueryString("wsdl");
        String baseUri = "http://localhost:" + PORT + "/Stuff";
        String ctx = "/Stuff";

        WSDLGetUtils utils = new WSDLGetUtils();
        Document doc = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());

        Document doc2 = utils.getDocument(message, baseUri, map, ctx, server.getEndpoint().getEndpointInfo());

        assertFalse(doc == doc2);
    } finally {
        server.stop();
    }
}
 
Example #24
Source File: DOMToStaxSignatureIdentifierTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: MultipleServiceShareClassTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void registerService(final Class<?> service, final Object serviceImpl) {
    final JaxWsServerFactoryBean builder = new JaxWsServerFactoryBean();
    builder.setBus(getBus());
    builder.setAddress("http://localhost:" + PORT + "/" + service.getSimpleName());
    builder.setServiceBean(serviceImpl);
    builder.setServiceClass(service);
    builder.create();
}
 
Example #26
Source File: DOMToStaxRoundTripTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #27
Source File: StaxRoundTripActionTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #28
Source File: ProviderServiceFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSOAPBindingFromCode() throws Exception {
    JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    bean.setServiceClass(SOAPSourcePayloadProvider.class);
    bean.setBus(getBus());
    bean.setInvoker(new JAXWSMethodInvoker(new SOAPSourcePayloadProvider()));

    Service service = bean.create();

    assertEquals("SOAPSourcePayloadProviderService", service.getName().getLocalPart());

    InterfaceInfo intf = service.getServiceInfos().get(0).getInterface();
    assertNotNull(intf);
    assertEquals(1, intf.getOperations().size());

    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setBus(getBus());
    svrFactory.setServiceFactory(bean);
    String address = "local://localhost:9000/test";
    svrFactory.setAddress(address);

    ServerImpl server = (ServerImpl)svrFactory.create();

    // See if our endpoint was created correctly
    assertEquals(1, service.getServiceInfos().get(0).getEndpoints().size());

    Endpoint endpoint = server.getEndpoint();
    Binding binding = endpoint.getBinding();
    assertTrue(binding instanceof SoapBinding);

    SoapBindingInfo sb = (SoapBindingInfo)endpoint.getEndpointInfo().getBinding();
    assertEquals("document", sb.getStyle());
    assertFalse(bean.isWrapped());

    assertEquals(1, sb.getOperations().size());
    Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "/org/apache/cxf/jaxws/sayHi.xml");

    addNamespace("j", "http://service.jaxws.cxf.apache.org/");
    assertValid("/s:Envelope/s:Body/j:sayHi", res);
}
 
Example #29
Source File: AbstractConnectionITHelper.java    From tracee with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected JaxWsServerFactoryBean createJaxWsServer() {
	JaxWsServerFactoryBean serverFactoryBean = new JaxWsServerFactoryBean();
	serverFactoryBean.setServiceClass(HelloWorldTestServiceImpl.class);
	serverFactoryBean.setAddress(endpointAddress);
	serverFactoryBean.setServiceBean(new HelloWorldTestServiceImpl(serverBackend));
	serverFactoryBean.setBus(CXFBusFactory.getDefaultBus());
	return serverFactoryBean;
}
 
Example #30
Source File: TestUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static Server createStudentsResource(ResourceManager resourceManager, String port) {
    ResourceLocal resourceLocal = new ResourceLocal();
    resourceLocal.setManager(resourceManager);
    resourceLocal.getResourceTypeIdentifiers().add(
            new XSDResourceTypeIdentifier(
                    new StreamSource(TestUtils.class.getResourceAsStream("/schema/studentPut.xsd")),
                    new XSLTResourceTransformer(
                            new StreamSource(TestUtils.class.getResourceAsStream("/xslt/studentPut.xsl")),
                            new StudentPutResourceValidator())));
    JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
    factory.setServiceClass(Resource.class);
    factory.setServiceBean(resourceLocal);
    factory.setAddress("http://localhost:" + port + "/ResourceStudents");
    return factory.create();
}