org.apache.cxf.frontend.ServerFactoryBean Java Examples

The following examples show how to use org.apache.cxf.frontend.ServerFactoryBean. 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: WebServiceProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
	String addr = url.getIp() + ":" + url.getPort();
    HttpServer httpServer = serverMap.get(addr);
    if (httpServer == null) {
        httpServer = httpBinder.bind(url, new WebServiceHandler());
        serverMap.put(addr, httpServer);
    }
    final ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
    serverFactoryBean.setAddress(url.getAbsolutePath());
	serverFactoryBean.setServiceClass(type);
	serverFactoryBean.setServiceBean(impl);
	serverFactoryBean.setBus(bus);
    serverFactoryBean.setDestinationFactory(transportFactory);
	serverFactoryBean.create();
    return new Runnable() {
        public void run() {
        	serverFactoryBean.destroy();
        }
    };
}
 
Example #2
Source File: JavascriptRhinoTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
public void setupRhino(String serviceEndpointBean,
                       String testsJavascript,
                       Object validationType) throws Exception {
    testUtilities.setBus(getBean(Bus.class, "cxf"));
    testUtilities.initializeRhino();
    serverFactoryBean = getBean(ServerFactoryBean.class, serviceEndpointBean);
    endpoint = serverFactoryBean.create().getEndpoint();
    // we need to find the implementor.
    rawImplementor = serverFactoryBean.getServiceBean();

    testUtilities.readResourceIntoRhino("/org/apache/cxf/javascript/cxf-utils.js");
    List<ServiceInfo> serviceInfos = endpoint.getService().getServiceInfos();
    // there can only be one.
    assertEquals(1, serviceInfos.size());
    serviceInfo = serviceInfos.get(0);
    testUtilities.loadJavascriptForService(serviceInfo);
    testUtilities.readResourceIntoRhino(testsJavascript);

    endpoint.getService().put(Message.SCHEMA_VALIDATION_ENABLED, validationType);
}
 
Example #3
Source File: ServerFactoryTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testJaxbExtraClass() throws Exception {
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress("http://localhost/Hello");
    svrBean.setServiceClass(HelloServiceImpl.class);
    svrBean.setBus(getBus());

    Map<String, Object> props = svrBean.getProperties();
    if (props == null) {
        props = new HashMap<>();
    }
    props.put("jaxb.additionalContextClasses",
              new Class[] {GreetMe.class, GreetMeOneWay.class});
    svrBean.setProperties(props);
    Server serv = svrBean.create();
    Class<?>[] extraClass = ((JAXBDataBinding)serv.getEndpoint().getService()
            .getDataBinding()).getExtraClass();
    assertEquals(extraClass.length, 2);
    assertEquals(extraClass[0], GreetMe.class);
    assertEquals(extraClass[1], GreetMeOneWay.class);
}
 
Example #4
Source File: RountripTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testOneWay() throws Exception {
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress("http://localhost/Hello2");
    svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
    svrBean.setServiceBean(new GreeterImplDoc());
    svrBean.setServiceClass(Greeter.class);
    svrBean.setEndpointName(new QName("http://apache.org/hello_world_doc_lit",
                                    "SoapPort"));
    svrBean.setServiceName(new QName("http://apache.org/hello_world_doc_lit",
                                     "SOAPService"));
    svrBean.setWsdlLocation("testutils/hello_world_doc_lit.wsdl");
    svrBean.setBus(getBus());

    svrBean.create();
}
 
Example #5
Source File: RountripTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testServerFactoryBean() throws Exception {
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress("http://localhost/Hello");
    svrBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
    svrBean.setServiceBean(new HelloServiceImpl());
    svrBean.setServiceClass(HelloService.class);
    svrBean.setBus(getBus());

    svrBean.create();

    ClientProxyFactoryBean proxyFactory = new ClientProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress("http://localhost/Hello");
    clientBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
    clientBean.setServiceClass(HelloService.class);
    clientBean.setBus(getBus());

    HelloService client = (HelloService) proxyFactory.create();

    assertEquals("hello", client.sayHello());
    assertEquals("hello", client.echo("hello"));
}
 
Example #6
Source File: StaxDatabindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testCopy() throws Exception {
    String address = "local://foo";

    ServerFactoryBean sf = new ServerFactoryBean();
    sf.setServiceBean(new CopyService());
    sf.setBus(getBus());
    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    sf.setAddress(address);
    sf.setDataBinding(new StaxDataBinding());
    sf.getFeatures().add(new StaxDataBindingFeature());
    sf.create().start();

    Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "req.xml");

    //DOMUtils.writeXml(res, System.out);
    addNamespace("a", "http://stax.service.cxf.apache.org/");
    assertValid("//a:bleh", res);
}
 
Example #7
Source File: StaxDatabindingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testCallback() throws Exception {
    String address = "local://foo";

    ServerFactoryBean sf = new ServerFactoryBean();
    sf.setServiceBean(new CallbackService());
    sf.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    sf.setAddress(address);
    sf.setDataBinding(new StaxDataBinding());
    sf.getFeatures().add(new StaxDataBindingFeature());
    sf.setBus(getBus());
    sf.create();

    Node res = invoke(address, LocalTransportFactory.TRANSPORT_ID, "req.xml");

    assertValid("//bleh", res);
}
 
Example #8
Source File: CodeFirstTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private Definition createService(boolean wrapped) throws Exception {
    ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();

    Bus bus = getBus();
    bean.setBus(bus);
    bean.setServiceClass(Hello.class);
    bean.setWrapped(wrapped);

    Service service = bean.create();

    InterfaceInfo i = service.getServiceInfos().get(0).getInterface();
    assertEquals(5, i.getOperations().size());

    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setBus(bus);
    svrFactory.setServiceFactory(bean);
    svrFactory.setAddress(address);
    svrFactory.create();

    Collection<BindingInfo> bindings = service.getServiceInfos().get(0).getBindings();
    assertEquals(1, bindings.size());

    ServiceWSDLBuilder wsdlBuilder =
        new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0));
    return wsdlBuilder.build();
}
 
Example #9
Source File: SoapFaultTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    super.setUpBus();

    ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(resource);
    bean.setWsdlURL(resource.toString());
    bean.setBus(bus);
    bean.setServiceClass(GreeterImpl.class);

    GreeterImpl greeter = new GreeterImpl();
    BeanInvoker invoker = new BeanInvoker(greeter);
    bean.setInvoker(invoker);

    service = bean.create();

    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setBus(bus);
    svrFactory.setServiceFactory(bean);

    svrFactory.create();
}
 
Example #10
Source File: DocLitBareTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testNamespaceCrash() {
    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setServiceClass(University.class);
    svrFactory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    svrFactory.setAddress("local://dlbTest");
    svrFactory.setServiceBean(new UniversityImpl());
    svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
    svrFactory.create();

    ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
    factory.getServiceFactory().setDataBinding(new AegisDatabinding());

    factory.setServiceClass(University.class);
    factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
    factory.setAddress("local://dlbTest");
    University client = (University) factory.create();

    Teacher tr = client.getTeacher(new Course(40, "Intro to CS", "Introductory Comp Sci"));
    assertNotNull(tr);
    assertEquals(52, tr.getAge());
    assertEquals("Mr. Tom", tr.getName());
}
 
Example #11
Source File: StudentTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testMapMap() throws Exception {

    ServerFactoryBean sf = new ServerFactoryBean();
    sf.setServiceClass(StudentServiceDocLiteral.class);
    sf.setServiceBean(new StudentServiceDocLiteralImpl());
    sf.setAddress("local://StudentServiceDocLiteral");
    setupAegis(sf);
    Server server = sf.create();
    server.start();

    ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
    proxyFac.setAddress("local://StudentServiceDocLiteral");
    proxyFac.setBus(getBus());
    setupAegis(proxyFac.getClientFactoryBean());
    //CHECKSTYLE:OFF
    HashMap<String, Student> mss = new HashMap<>();
    mss.put("Alice", new Student());
    HashMap<String, HashMap<String, Student>> mmss = new HashMap<>();
    mmss.put("Bob", mss);

    StudentServiceDocLiteral clientInterface = proxyFac.create(StudentServiceDocLiteral.class);
    clientInterface.takeMapMap(mmss);
    //CHECKSTYLE:ON
}
 
Example #12
Source File: ClientServiceConfigTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Before
public void before() throws Exception {
    super.setUp();

    ReflectionServiceFactoryBean factory = new ReflectionServiceFactoryBean();
    factory.setInvoker(new BeanInvoker(new EchoImpl()));
    factory.setDataBinding(new AegisDatabinding());

    ServerFactoryBean svrFac = new ServerFactoryBean();
    svrFac.setAddress("local://Echo");
    svrFac.setServiceFactory(factory);
    svrFac.setServiceClass(Echo.class);
    svrFac.setBus(getBus());
    svrFac.create();

    Endpoint endpoint = Endpoint.create(new EchoImpl());
    impl = (EndpointImpl) endpoint;
    impl.setDataBinding(new AegisDatabinding());
    endpoint.publish("local://JaxWsEcho");
}
 
Example #13
Source File: InheritancePOJOTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    super.setUp();

    ServerFactoryBean sf = createServiceFactory(InheritanceService.class,
                                                null, "InheritanceService",
                                                new QName("urn:xfire:inheritance",
                                                          "InheritanceService"),
                                                null);
    AegisContext globalContext = new AegisContext();
    globalContext.setWriteXsiTypes(true);

    Set<String> l = new HashSet<>();
    l.add(Employee.class.getName());
    globalContext.setRootClassNames(l);
    AegisDatabinding binding = new AegisDatabinding();
    binding.setAegisContext(globalContext);

    sf.getServiceFactory().setDataBinding(binding);
    sf.create();
}
 
Example #14
Source File: WebServiceProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
	String addr = url.getIp() + ":" + url.getPort();
    HttpServer httpServer = serverMap.get(addr);
    if (httpServer == null) {
        httpServer = httpBinder.bind(url, new WebServiceHandler());
        serverMap.put(addr, httpServer);
    }
    final ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
    serverFactoryBean.setAddress(url.getAbsolutePath());
	serverFactoryBean.setServiceClass(type);
	serverFactoryBean.setServiceBean(impl);
	serverFactoryBean.setBus(bus);
    serverFactoryBean.setDestinationFactory(transportFactory);
	serverFactoryBean.create();
    return new Runnable() {
        public void run() {
            //serverFactoryBean.destroy(); //升级到cxf 3后编译失败,暂时注掉 - 杨俊明
            if (serverFactoryBean.getServer() != null) {
                serverFactoryBean.getServer().destroy();
            }
        }
    };
}
 
Example #15
Source File: WebServiceProtocol.java    From dubbox with Apache License 2.0 6 votes vote down vote up
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
	String addr = url.getIp() + ":" + url.getPort();
    HttpServer httpServer = serverMap.get(addr);
    if (httpServer == null) {
        httpServer = httpBinder.bind(url, new WebServiceHandler());
        serverMap.put(addr, httpServer);
    }
    final ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
    serverFactoryBean.setAddress(url.getAbsolutePath());
	serverFactoryBean.setServiceClass(type);
	serverFactoryBean.setServiceBean(impl);
	serverFactoryBean.setBus(bus);
    serverFactoryBean.setDestinationFactory(transportFactory);
	serverFactoryBean.create();
    return new Runnable() {
        public void run() {
        	serverFactoryBean.destroy();
        }
    };
}
 
Example #16
Source File: WebServiceProtocol.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException {
	String addr = url.getIp() + ":" + url.getPort();
    HttpServer httpServer = serverMap.get(addr);
    if (httpServer == null) {
        httpServer = httpBinder.bind(url, new WebServiceHandler());
        serverMap.put(addr, httpServer);
    }
    final ServerFactoryBean serverFactoryBean = new ServerFactoryBean();
    serverFactoryBean.setAddress(url.getAbsolutePath());
	serverFactoryBean.setServiceClass(type);
	serverFactoryBean.setServiceBean(impl);
	serverFactoryBean.setBus(bus);
    serverFactoryBean.setDestinationFactory(transportFactory);
	serverFactoryBean.create();
    return new Runnable() {
        public void run() {
        	serverFactoryBean.destroy();
        }
    };
}
 
Example #17
Source File: CodeFirstWSDLTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Definition createService(Class<?> clazz) throws Exception {

        JaxWsImplementorInfo info = new JaxWsImplementorInfo(clazz);
        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean(info);

        Bus bus = getBus();
        bean.setBus(bus);

        Service service = bean.create();

        InterfaceInfo i = service.getServiceInfos().get(0).getInterface();
        assertEquals(5, i.getOperations().size());

        ServerFactoryBean svrFactory = new ServerFactoryBean();
        svrFactory.setBus(bus);
        svrFactory.setServiceFactory(bean);
        svrFactory.setServiceBean(clazz.newInstance());
        svrFactory.setAddress(address);
        svrFactory.create();

        Collection<BindingInfo> bindings = service.getServiceInfos().get(0).getBindings();
        assertEquals(1, bindings.size());

        ServiceWSDLBuilder wsdlBuilder =
            new ServiceWSDLBuilder(bus, service.getServiceInfos().get(0));
        return wsdlBuilder.build();
    }
 
Example #18
Source File: ServerFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSetDF() throws Exception {
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress("http://localhost/Hello");
    svrBean.setServiceClass(HelloService.class);
    svrBean.setServiceBean(new HelloServiceImpl());
    svrBean.setBus(getBus());
    svrBean.setDestinationFactory(new CustomDestinationFactory());

    ServerImpl server = (ServerImpl)svrBean.create();
    assertTrue(server.getDestination() instanceof CustomDestination);
}
 
Example #19
Source File: EJBEndpoint.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Server publish() throws Exception {
    jndiContext = new InitialContext();
    Object obj = jndiContext.lookup(config.getJNDIName());
    ejbHome = (EJBHome) PortableRemoteObject.narrow(obj, EJBHome.class);

    Class<?> interfaceClass = Class.forName(getServiceClassName());
    boolean isJaxws = isJaxWsServiceInterface(interfaceClass);
    ServerFactoryBean factory = isJaxws ? new JaxWsServerFactoryBean() : new ServerFactoryBean();
    factory.setServiceClass(interfaceClass);

    if (config.getWsdlURL() != null) {
        factory.getServiceFactory().setWsdlURL(config.getWsdlURL());
    }

    factory.setInvoker(new EJBInvoker(ejbHome));

    String baseAddress = isNotNull(getEjbServantBaseURL()) ? getEjbServantBaseURL()
                                                           : getDefaultEJBServantBaseURL();
    String address = baseAddress + "/" + config.getJNDIName();
    factory.setAddress(address);

    if (address.length() >= 5 && HTTPS_PREFIX.equalsIgnoreCase(address.substring(0, 5))) {
        throw new UnsupportedOperationException("EJBEndpoint creation by https protocol is unsupported");
    }

    if (getWorkManager() != null) {
        setWorkManagerThreadPoolToJetty(factory.getBus(), baseAddress);
    }

    Server server = factory.create();
    LOG.info("Published EJB Endpoint of [" + config.getJNDIName() + "] at [" + address + "]");

    return server;
}
 
Example #20
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected Server() throws Exception {
    HelloWorldImpl helloworldImpl = new HelloWorldImpl();
    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setServiceClass(HelloWorld.class);
    svrFactory.setAddress("http://localhost:9000/Hello");
    svrFactory.setServiceBean(helloworldImpl);
    svrFactory.setFeatures(Collections.singletonList(new LoggingFeature()));
    //svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
    svrFactory.create();
}
 
Example #21
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static void startServer() throws Exception {
    HelloWorldImpl helloworldImpl = new HelloWorldImpl();
    ServerFactoryBean svrFactory = new ServerFactoryBean();
    svrFactory.setServiceClass(HelloWorld.class);
    svrFactory.setAddress("http://localhost:9000/Hello");
    svrFactory.setServiceBean(helloworldImpl);
    svrFactory.getServiceFactory().setDataBinding(new AegisDatabinding());
    svrFactory.create();
}
 
Example #22
Source File: GreeterTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testEndpoint() throws Exception {
    ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    URL resource = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(resource);
    bean.setWsdlURL(resource.toString());
    bean.setBus(bus);
    bean.setServiceClass(GreeterImpl.class);
    GreeterImpl greeter = new GreeterImpl();
    BeanInvoker invoker = new BeanInvoker(greeter);


    Service service = bean.create();

    assertEquals("SOAPService", service.getName().getLocalPart());
    assertEquals("http://apache.org/hello_world_soap_http", service.getName().getNamespaceURI());

    ServerFactoryBean svr = new ServerFactoryBean();
    svr.setBus(bus);
    svr.setServiceFactory(bean);
    svr.setInvoker(invoker);

    svr.create();

    Node response = invoke("http://localhost:9000/SoapContext/SoapPort",
                       LocalTransportFactory.TRANSPORT_ID,
                       "GreeterMessage.xml");

    assertEquals(1, greeter.getInvocationCount());

    assertNotNull(response);

    addNamespace("h", "http://apache.org/hello_world_soap_http/types");

    assertValid("/s:Envelope/s:Body", response);
    assertValid("//h:sayHiResponse", response);
}
 
Example #23
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected Server() throws Exception {
    HelloWorldImpl helloworldImpl = new HelloWorldImpl();
    ServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setServiceClass(HelloWorld.class);
    svrFactory.setAddress("http://localhost:9000/Hello");
    svrFactory.setServiceBean(helloworldImpl);
    svrFactory.create();
}
 
Example #24
Source File: AnnotationInterceptorTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() {
    fb = new ServerFactoryBean();
    fb.setAddress("local://localhost");
    fb.setBus(getBus());

    jfb = new JaxWsServerFactoryBean();
    jfb.setAddress("local://localhost");
    jfb.setBus(getBus());
}
 
Example #25
Source File: ServerFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testCXF1758() throws Exception {
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress("http://localhost/Generics");
    svrBean.setServiceBean(new TestServiceImpl<String>() { });
    svrBean.setBus(getBus());
    ServerImpl server = (ServerImpl)svrBean.create();
    //XMLUtils.printDOM(getWSDLDocument(server));
    assertValid("//xsd:schema/xsd:complexType[@name='open']/xsd:sequence/"
                + "xsd:element[@type='xsd:string']",
                getWSDLDocument(server));
}
 
Example #26
Source File: JaxWsServerFactoryBeanTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSimpleServiceClass() throws Exception {
    ServerFactoryBean factory = new ServerFactoryBean();
    factory.setServiceClass(Hello.class);
    String address = "http://localhost:9001/jaxwstest";
    factory.setAddress(address);
    Server server = factory.create();
    Endpoint endpoint = server.getEndpoint();
    ServiceInfo service = endpoint.getEndpointInfo().getService();
    assertNotNull(service);

    Bus bus = factory.getBus();
    Definition def = new ServiceWSDLBuilder(bus, service).build();

    WSDLWriter wsdlWriter = bus.getExtension(WSDLManager.class).getWSDLFactory().newWSDLWriter();
    def.setExtensionRegistry(bus.getExtension(WSDLManager.class).getExtensionRegistry());
    Document doc = wsdlWriter.getDocument(def);

    Map<String, String> ns = new HashMap<>();
    ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
    ns.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
    XPathUtils xpather = new XPathUtils(ns);
    xpather.isExist("/wsdl:definitions/wsdl:binding/soap:binding",
                    doc,
                    XPathConstants.NODE);
    xpather.isExist("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='add']/soap:operation",
                    doc,
                    XPathConstants.NODE);
    xpather.isExist("/wsdl:definitions/wsdl:service/wsdl:port[@name='add']/soap:address[@location='"
                    + address + "']",
                    doc,
                    XPathConstants.NODE);
}
 
Example #27
Source File: EndpointImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void publish(javax.xml.ws.spi.http.HttpContext context) {
    ServerFactoryBean sf = getServerFactory();
    if (sf.getDestinationFactory() == null) {
        sf.setDestinationFactory(new JAXWSHttpSpiTransportFactory(context));
    }
    publish(context.getPath());
}
 
Example #28
Source File: SimpleFrontendTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void createServers() throws Exception {
    bus = BusFactory.getDefaultBus();
    ServerFactoryBean sf = new ServerFactoryBean();
    sf.setServiceBean(new WSSimpleImpl());
    sf.setAddress(add11);
    sf.setBus(bus);
    sf.create();


}
 
Example #29
Source File: ClassTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void startServer() throws Exception {
    AegisContext context = new AegisContext();
    context.initialize();
    context.getTypeMapping().register(new ClassAsStringType());

    ServerFactoryBean b = new ServerFactoryBean();
    b.setDataBinding(new AegisDatabinding(context));
    b.setServiceClass(GenericsService.class);
    b.setAddress("local://GenericsService");
    server = b.create();
}
 
Example #30
Source File: FlatArrayTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    super.setUp();
    service = new FlatArrayService();

    ServerFactoryBean sf = new ServerFactoryBean();
    // use full parameter names.
    sf.setServiceClass(FlatArrayServiceInterface.class);
    sf.setServiceBean(service);
    sf.setAddress("local://FlatArray");
    sf.setDataBinding(new AegisDatabinding());
    sf.create();

    arrayWsdlDoc = getWSDLDocument("FlatArrayServiceInterface");
}