Package org.apache.cxf.frontend

Examples of org.apache.cxf.frontend.ServerFactoryBean


    @Override
    protected void setUp() throws Exception {
        super.setUp();
        // start a simple front service
        ServerFactoryBean svrBean = new ServerFactoryBean();
        svrBean.setAddress(SIMPLE_SERVER_ADDRESS);
        svrBean.setServiceClass(HelloService.class);
        svrBean.setServiceBean(new HelloServiceImpl());
        svrBean.setBus(CXFBusFactory.getDefaultBus());

        simpleServer = (ServerImpl)svrBean.create();
        simpleServer.start();


    }
View Full Code Here


    @Override
    protected void setUp() throws Exception {

        // start a simple front service
        ServerFactoryBean svrBean = new ServerFactoryBean();
        svrBean.setAddress(SIMPLE_SERVER_ADDRESS);
        svrBean.setServiceClass(HelloService.class);
        svrBean.setServiceBean(new HelloServiceImpl());
        svrBean.setBus(CXFBusFactory.getDefaultBus());

        simpleServer = (ServerImpl)svrBean.create();
        simpleServer.start();

        GreeterImpl greeterImpl = new GreeterImpl();
        jaxwsEndpoint = Endpoint.publish(JAXWS_SERVER_ADDRESS, greeterImpl);
View Full Code Here

    }

    protected Server createService(Class serviceClass,
                                   String address, QName name,
                                    XmlBeansDataBinding binding) {
        ServerFactoryBean sf = createServiceFactory(serviceClass, null, address, name, binding);
        return sf.create();
    }
View Full Code Here

   
    public Server createService(Class serviceClass,
                                Object serviceBean,
                                String address,
                                QName name) {
        ServerFactoryBean sf = createServiceFactory(serviceClass, serviceBean, address, name, null);
        return sf.create();
    }
View Full Code Here

        this.endpoint = endpoint;
        boolean isWebServiceProvider = false;

        // now we just use the default bus here
        Bus bus = BusFactory.getDefaultBus();
        ServerFactoryBean svrBean = null;

        if (endpoint.isSpringContextEndpoint()) {
            CxfEndpointBean endpointBean = endpoint.getCxfEndpointBean();
            svrBean = CxfEndpointUtils.getServerFactoryBean(endpointBean.getServiceClass());
            isWebServiceProvider = CxfEndpointUtils.hasAnnotation(endpointBean.getServiceClass(),
                                                                  WebServiceProvider.class);
            endpoint.configure(svrBean);
            CxfEndpointBean cxfEndpointBean = endpoint.getCxfEndpointBean();
            if (cxfEndpointBean.getServiceName() != null) {
                svrBean.setServiceName(cxfEndpointBean.getServiceName());
            }
            if (cxfEndpointBean.getEndpointName() != null) {
                svrBean.setEndpointName(cxfEndpointBean.getEndpointName());
            }

        } else { // setup the serverFactoryBean with the URI paraments
            Class serviceClass = ClassLoaderUtils.loadClass(endpoint.getServiceClass(), this.getClass());
            svrBean = CxfEndpointUtils.getServerFactoryBean(serviceClass);
            isWebServiceProvider = CxfEndpointUtils.hasAnnotation(serviceClass, WebServiceProvider.class);
            svrBean.setAddress(endpoint.getAddress());
            svrBean.setServiceClass(serviceClass);
            if (endpoint.getServiceName() != null) {
                svrBean.setServiceName(CxfEndpointUtils.getServiceName(endpoint));
            }
            if (endpoint.getPortName() != null) {
                svrBean.setEndpointName(CxfEndpointUtils.getPortName(endpoint));
            }
            if (endpoint.getWsdlURL() != null) {
                svrBean.setWsdlURL(endpoint.getWsdlURL());
            }
        }
        DataFormat dataFormat = CxfEndpointUtils.getDataFormat(endpoint);

        svrBean.setInvoker(new CamelInvoker(this));

        // apply the feature here
        if (!dataFormat.equals(DataFormat.POJO) && !isWebServiceProvider) {
            List<AbstractFeature> features = new ArrayList<AbstractFeature>();

            if (dataFormat.equals(DataFormat.PAYLOAD)) {
                features.add(new PayLoadDataFormatFeature());
                // adding the logging feature here for debug
                //features.add(new LoggingFeature());
            }
            if (dataFormat.equals(DataFormat.MESSAGE)) {
                features.add(new MessageDataFormatFeature());
                //features.add(new LoggingFeature());
            }
            svrBean.setFeatures(features);

        }
        svrBean.setBus(bus);
        svrBean.setStart(false);
        server = svrBean.create();

    }
View Full Code Here

                        processSoapConsumerOut(exchange);
                    }
                });
        this.consumer = endpoint.getInnerEndpoint().createConsumer(soapProcessor);
        Class sei = CxfEndpointUtils.getSEIClass(endpoint.getServiceClass());
        ServerFactoryBean sfb = CxfEndpointUtils.getServerFactoryBean(sei);
        sfb.setWsdlURL(endpoint.getWsdl().getURL().toString());
        if (endpoint.getServiceName() != null) {
            sfb.setServiceName(endpoint.getServiceName());
        }
        if (endpoint.getEndpointName() != null) {
            sfb.setEndpointName(endpoint.getEndpointName());
        }
        // we do not need use the destination here
        sfb.setDestinationFactory(new NullDestinationFactory());
        sfb.setStart(false);

        server = sfb.create();
    }
View Full Code Here

        return hasAnnotation(cls.getSuperclass(), annotation);
    }


    public static ServerFactoryBean getServerFactoryBean(Class<?> cls) throws CamelException {
        ServerFactoryBean serverFactory  = null;
        try {
            if (cls == null) {
                serverFactory = new ServerFactoryBean();
                serverFactory.setServiceFactory(new WSDLSoapServiceFactoryBean());

            } else {
                boolean isJSR181SEnabled = CxfEndpointUtils.hasWebServiceAnnotation(cls);
                serverFactory = isJSR181SEnabled ? new JaxWsServerFactoryBean()
                            : new ServerFactoryBean();
            }
            return serverFactory;
        } catch (Exception e) {
            throw new CamelException(e);
        }
View Full Code Here

        Service service = bean.create();

        InterfaceInfo i = service.getServiceInfos().get(0).getInterface();
        assertEquals(4, 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 =
View Full Code Here

    @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());
        Server s = sf.create();
        s.getEndpoint().getInInterceptors().add(new LoggingInInterceptor());

        arrayWsdlDoc = getWSDLDocument("FlatArrayServiceInterface");
    }
View Full Code Here

        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());
        EndpointImpl impl = (EndpointImpl) endpoint;
        impl.setDataBinding(new AegisDatabinding());
        endpoint.publish("local://JaxWsEcho");
View Full Code Here

TOP

Related Classes of org.apache.cxf.frontend.ServerFactoryBean

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.