Search in sources :

Example 1 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project camel by apache.

the class CxfConsumer method createServer.

protected Server createServer() throws Exception {
    ServerFactoryBean svrBean = cxfEndpoint.createServerFactoryBean();
    svrBean.setInvoker(new CxfConsumerInvoker(cxfEndpoint));
    Server server = svrBean.create();
    // Apply the server configurer if it is possible
    if (cxfEndpoint.getCxfEndpointConfigurer() != null) {
        cxfEndpoint.getCxfEndpointConfigurer().configureServer(server);
    }
    if (ObjectHelper.isNotEmpty(cxfEndpoint.getPublishedEndpointUrl())) {
        server.getEndpoint().getEndpointInfo().setProperty("publishedEndpointUrl", cxfEndpoint.getPublishedEndpointUrl());
    }
    return server;
}
Also used : Server(org.apache.cxf.endpoint.Server) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean)

Example 2 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project camel by apache.

the class CxfSpringEndpoint method createServerFactoryBean.

/**
     * Create a service factory bean
     */
@Override
ServerFactoryBean createServerFactoryBean() throws Exception {
    // get service class
    Class<?> cls = getSEIClass();
    if (getWsdlURL() == null && cls == null) {
        // no WSDL and serviceClass specified, set our default serviceClass
        if (getDataFormat().equals(DataFormat.PAYLOAD)) {
            setServiceClass(org.apache.camel.component.cxf.DefaultPayloadProviderSEI.class.getName());
        }
        cls = getServiceClass();
    }
    // create server factory bean
    // Shouldn't use CxfEndpointUtils.getServerFactoryBean(cls) as it is for
    // CxfSoapComponent
    ServerFactoryBean answer = null;
    if (cls == null) {
        if (!getDataFormat().equals(DataFormat.POJO)) {
            answer = new JaxWsServerFactoryBean(new WSDLServiceFactoryBean()) {

                {
                    doInit = false;
                }
            };
            cls = Provider.class;
        } else {
            ObjectHelper.notNull(cls, CxfConstants.SERVICE_CLASS);
        }
    } else if (CxfEndpointUtils.hasWebServiceAnnotation(cls)) {
        answer = new JaxWsServerFactoryBean();
    } else {
        answer = new ServerFactoryBean();
    }
    // setup server factory bean
    setupServerFactoryBean(answer, cls);
    // fill in values that have not been filled.
    if (answer.getServiceName() == null && getServiceLocalName() != null) {
        answer.setServiceName(new QName(getServiceNamespace(), getServiceLocalName()));
    }
    if (answer.getEndpointName() == null && getEndpointLocalName() != null) {
        answer.setEndpointName(new QName(getEndpointNamespace(), getEndpointLocalName()));
    }
    if (cls == null) {
        checkName(answer.getEndpointName(), "endpoint/port name");
        checkName(answer.getServiceName(), "service name");
    }
    return answer;
}
Also used : QName(javax.xml.namespace.QName) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean)

Example 3 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project camel by apache.

the class CxfSimpleRouterTest method startService.

@Before
public void startService() {
    //start a service
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress(getServiceAddress());
    svrBean.setServiceClass(HelloService.class);
    svrBean.setServiceBean(new HelloServiceImpl());
    configureFactory(svrBean);
    server = svrBean.create();
    server.start();
}
Also used : ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) Before(org.junit.Before)

Example 4 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project camel by apache.

the class CxfMixedModeRouterTest method startService.

@BeforeClass
public static void startService() {
    //start a service
    ServerFactoryBean svrBean = new ServerFactoryBean();
    svrBean.setAddress(SERVICE_ADDRESS);
    svrBean.setServiceClass(HelloService.class);
    svrBean.setServiceBean(new HelloServiceImpl());
    server = svrBean.create();
    server.start();
}
Also used : ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) BeforeClass(org.junit.BeforeClass)

Example 5 with ServerFactoryBean

use of org.apache.cxf.frontend.ServerFactoryBean in project camel by apache.

the class FailOverFeatureTest method init.

@BeforeClass
public static void init() {
    // publish a web-service
    ServerFactoryBean factory = new ServerFactoryBean();
    factory.setAddress(SERVICE_ADDRESS);
    factory.setServiceBean(new HelloServiceImpl());
    factory.create();
}
Also used : ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) BeforeClass(org.junit.BeforeClass)

Aggregations

ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)15 BeforeClass (org.junit.BeforeClass)8 Server (org.apache.cxf.endpoint.Server)2 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)2 Before (org.junit.Before)2 HttpServer (com.alibaba.dubbo.remoting.http.HttpServer)1 QName (javax.xml.namespace.QName)1 HelloServiceImpl (org.apache.camel.component.cxf.HelloServiceImpl)1 GreeterImpl (org.apache.hello_world_soap_http.GreeterImpl)1