Search in sources :

Example 26 with Service

use of org.apache.cxf.service.Service in project cxf by apache.

the class ColocOutInterceptor method isColocated.

protected Server isColocated(List<Server> servers, Endpoint endpoint, BindingOperationInfo boi) {
    if (servers != null) {
        Service senderService = endpoint.getService();
        EndpointInfo senderEI = endpoint.getEndpointInfo();
        for (Server s : servers) {
            Endpoint receiverEndpoint = s.getEndpoint();
            Service receiverService = receiverEndpoint.getService();
            EndpointInfo receiverEI = receiverEndpoint.getEndpointInfo();
            if (receiverService.getName().equals(senderService.getName()) && receiverEI.getName().equals(senderEI.getName())) {
                // Check For Operation Match.
                BindingOperationInfo receiverOI = receiverEI.getBinding().getOperation(boi.getName());
                if (receiverOI != null && isCompatibleOperationInfo(boi, receiverOI)) {
                    return s;
                }
            }
        }
    }
    return null;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Server(org.apache.cxf.endpoint.Server) Endpoint(org.apache.cxf.endpoint.Endpoint) Service(org.apache.cxf.service.Service)

Example 27 with Service

use of org.apache.cxf.service.Service in project cxf by apache.

the class JAXRSServiceFactoryBean method create.

@Override
public Service create() {
    sendEvent(Event.START_CREATE);
    initializeServiceModel();
    initializeDefaultInterceptors();
    if (invoker != null) {
        getService().setInvoker(getInvoker());
    } else {
        getService().setInvoker(createInvoker());
    }
    if (getExecutor() != null) {
        getService().setExecutor(getExecutor());
    }
    if (getDataBinding() != null) {
        getService().setDataBinding(getDataBinding());
    }
    Service serv = getService();
    sendEvent(Event.END_CREATE, serv);
    return serv;
}
Also used : Service(org.apache.cxf.service.Service)

Example 28 with Service

use of org.apache.cxf.service.Service in project cxf by apache.

the class AbstractJAXRSFactoryBean method createEndpoint.

protected Endpoint createEndpoint() throws BusException, EndpointException {
    Service service = serviceFactory.getService();
    if (service == null) {
        service = serviceFactory.create();
    }
    EndpointInfo ei = createEndpointInfo(service);
    Endpoint ep = new EndpointImpl(getBus(), service, ei);
    if (properties != null) {
        ep.putAll(properties);
    }
    if (getInInterceptors() != null) {
        ep.getInInterceptors().addAll(getInInterceptors());
    }
    if (getOutInterceptors() != null) {
        ep.getOutInterceptors().addAll(getOutInterceptors());
    }
    if (getInFaultInterceptors() != null) {
        ep.getInFaultInterceptors().addAll(getInFaultInterceptors());
    }
    if (getOutFaultInterceptors() != null) {
        ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
    }
    List<ClassResourceInfo> list = serviceFactory.getRealClassResourceInfo();
    for (ClassResourceInfo cri : list) {
        initializeAnnotationInterceptors(ep, cri.getServiceClass());
        serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep, cri.getServiceClass(), null);
    }
    ep.put(JAXRSServiceFactoryBean.class.getName(), serviceFactory);
    return ep;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) EndpointImpl(org.apache.cxf.endpoint.EndpointImpl) ClassResourceInfo(org.apache.cxf.jaxrs.model.ClassResourceInfo) Service(org.apache.cxf.service.Service)

Example 29 with Service

use of org.apache.cxf.service.Service in project cxf by apache.

the class SimpleAuthorizingInterceptorTest method setUp.

@Before
public void setUp() throws Exception {
    method = TestService.class.getMethod("echo", new Class[] {});
    Exchange ex = setUpExchange();
    Service service = EasyMock.createMock(Service.class);
    ex.put(Service.class, service);
    MethodDispatcher md = EasyMock.createMock(MethodDispatcher.class);
    EasyMock.expect(service.get(MethodDispatcher.class.getName())).andReturn(md);
    BindingOperationInfo boi = EasyMock.createMock(BindingOperationInfo.class);
    ex.put(BindingOperationInfo.class, boi);
    EasyMock.expect(md.getMethod(boi)).andReturn(method);
    EasyMock.replay(service, md);
}
Also used : Exchange(org.apache.cxf.message.Exchange) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Service(org.apache.cxf.service.Service) MethodDispatcher(org.apache.cxf.service.invoker.MethodDispatcher) Before(org.junit.Before)

Example 30 with Service

use of org.apache.cxf.service.Service in project cxf by apache.

the class CorbaBindingFactoryTest method setupServiceInfo.

protected void setupServiceInfo(String ns, String wsdl, String serviceName, String portName) {
    URL wsdlUrl = getClass().getResource(wsdl);
    assertNotNull(wsdlUrl);
    WSDLServiceFactory f = new WSDLServiceFactory(bus, wsdlUrl.toString(), new QName(ns, serviceName));
    Service service = f.create();
    endpointInfo = service.getEndpointInfo(new QName(ns, portName));
}
Also used : WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) QName(javax.xml.namespace.QName) Service(org.apache.cxf.service.Service) URL(java.net.URL)

Aggregations

Service (org.apache.cxf.service.Service)270 Test (org.junit.Test)167 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)138 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)138 Client (org.apache.cxf.endpoint.Client)128 HashMap (java.util.HashMap)100 WSSSecurityProperties (org.apache.wss4j.stax.ext.WSSSecurityProperties)89 ArrayList (java.util.ArrayList)81 QName (javax.xml.namespace.QName)69 Properties (java.util.Properties)65 Endpoint (org.apache.cxf.endpoint.Endpoint)45 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)44 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)37 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)33 Server (org.apache.cxf.endpoint.Server)27 OperationInfo (org.apache.cxf.service.model.OperationInfo)26 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)23 Exchange (org.apache.cxf.message.Exchange)22 Bus (org.apache.cxf.Bus)21 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)21