Search in sources :

Example 31 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class XMLBindingFactoryTest method testContainsInAttachmentInterceptor.

@Test
public void testContainsInAttachmentInterceptor() {
    XMLBindingFactory xbf = new XMLBindingFactory();
    Binding b = xbf.createBinding(new BindingInfo(null, null));
    boolean found = false;
    for (Interceptor<? extends Message> interseptor : b.getInInterceptors()) {
        if (interseptor instanceof AttachmentInInterceptor) {
            found = true;
        }
    }
    assertTrue("No in attachment interceptor found", found);
}
Also used : Binding(org.apache.cxf.binding.Binding) AttachmentInInterceptor(org.apache.cxf.interceptor.AttachmentInInterceptor) BindingInfo(org.apache.cxf.service.model.BindingInfo) Test(org.junit.Test)

Example 32 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class ServiceModelVisitor method walk.

public void walk() {
    begin(serviceInfo);
    begin(serviceInfo.getInterface());
    for (OperationInfo o : serviceInfo.getInterface().getOperations()) {
        begin(o);
        visitOperation(o);
        end(o);
    }
    end(serviceInfo.getInterface());
    for (EndpointInfo endpointInfo : serviceInfo.getEndpoints()) {
        begin(endpointInfo);
        end(endpointInfo);
    }
    for (BindingInfo bindingInfo : serviceInfo.getBindings()) {
        begin(bindingInfo);
        end(bindingInfo);
    }
    end(serviceInfo);
}
Also used : UnwrappedOperationInfo(org.apache.cxf.service.model.UnwrappedOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo)

Example 33 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class SimpleMethodDispatcher method getBindingOperation.

public BindingOperationInfo getBindingOperation(Method method, Endpoint endpoint) {
    Map<BindingInfo, BindingOperationInfo> bops = infoMap.get(method);
    if (bops == null) {
        return null;
    }
    BindingOperationInfo bop = bops.get(endpoint.getEndpointInfo().getBinding());
    if (bop == null) {
        OperationInfo o = methodToOp.get(method);
        if (o == null) {
            return null;
        }
        BindingInfo b = endpoint.getEndpointInfo().getBinding();
        for (BindingOperationInfo bop2 : b.getOperations()) {
            if (bop2.getOperationInfo().equals(o)) {
                BindingOperationInfo realBop = getRealOperation(o, bop2);
                bops.put(b, realBop);
                return realBop;
            }
        }
    }
    return bop;
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo)

Example 34 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class AbstractWSDLBasedEndpointFactory method createBindingInfo.

protected BindingInfo createBindingInfo() {
    BindingFactoryManager mgr = bus.getExtension(BindingFactoryManager.class);
    String binding = bindingId;
    if (binding == null && bindingConfig != null) {
        binding = bindingConfig.getBindingId();
    }
    if (binding == null) {
        // default to soap binding
        binding = "http://schemas.xmlsoap.org/soap/";
    }
    try {
        if (binding.contains("/soap")) {
            if (bindingConfig == null) {
                bindingConfig = createSoapBindingConfig();
            }
            if (bindingConfig instanceof SoapBindingConfiguration && !((SoapBindingConfiguration) bindingConfig).isSetStyle()) {
                ((SoapBindingConfiguration) bindingConfig).setStyle(serviceFactory.getStyle());
            }
        }
        bindingFactory = mgr.getBindingFactory(binding);
        BindingInfo inf = bindingFactory.createBindingInfo(serviceFactory.getService(), binding, bindingConfig);
        for (BindingOperationInfo boi : inf.getOperations()) {
            serviceFactory.updateBindingOperation(boi);
            Method m = serviceFactory.getMethodDispatcher().getMethod(boi);
            serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, inf, boi, m);
        }
        serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, inf);
        return inf;
    } catch (BusException ex) {
        throw new ServiceConstructionException(new Message("COULD.NOT.RESOLVE.BINDING", LOG, bindingId), ex);
    }
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Message(org.apache.cxf.common.i18n.Message) SoapBindingConfiguration(org.apache.cxf.binding.soap.SoapBindingConfiguration) BindingInfo(org.apache.cxf.service.model.BindingInfo) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) BindingFactoryManager(org.apache.cxf.binding.BindingFactoryManager) Method(java.lang.reflect.Method) ServiceConstructionException(org.apache.cxf.service.factory.ServiceConstructionException) BusException(org.apache.cxf.BusException)

Example 35 with BindingInfo

use of org.apache.cxf.service.model.BindingInfo in project cxf by apache.

the class CodeFirstTest method createService.

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();
}
Also used : Bus(org.apache.cxf.Bus) JaxWsServiceFactoryBean(org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean) BindingInfo(org.apache.cxf.service.model.BindingInfo) Service(org.apache.cxf.service.Service) WebService(javax.jws.WebService) GenericsService(org.apache.cxf.jaxws.service.GenericsService) ArrayService(org.apache.cxf.jaxws.service.ArrayService) ServerFactoryBean(org.apache.cxf.frontend.ServerFactoryBean) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo) ReflectionServiceFactoryBean(org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean) ServiceWSDLBuilder(org.apache.cxf.wsdl11.ServiceWSDLBuilder)

Aggregations

BindingInfo (org.apache.cxf.service.model.BindingInfo)103 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)65 QName (javax.xml.namespace.QName)45 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)44 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)35 Test (org.junit.Test)29 Endpoint (org.apache.cxf.endpoint.Endpoint)28 OperationInfo (org.apache.cxf.service.model.OperationInfo)21 MessagePartInfo (org.apache.cxf.service.model.MessagePartInfo)20 Service (org.apache.cxf.service.Service)18 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)17 InterfaceInfo (org.apache.cxf.service.model.InterfaceInfo)17 Exchange (org.apache.cxf.message.Exchange)15 Message (org.apache.cxf.message.Message)13 ArrayList (java.util.ArrayList)11 SoapOperationInfo (org.apache.cxf.binding.soap.model.SoapOperationInfo)11 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)11 MessageImpl (org.apache.cxf.message.MessageImpl)11 BindingMessageInfo (org.apache.cxf.service.model.BindingMessageInfo)9 Bus (org.apache.cxf.Bus)8