Search in sources :

Example 36 with BindingInfo

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

the class SOAPLoggingTest method testSoap.

@Test
public void testSoap() {
    DefaultLogEventMapper mapper = new DefaultLogEventMapper();
    Message message = new MessageImpl();
    ExchangeImpl exchange = new ExchangeImpl();
    ServiceInfo service = new ServiceInfo();
    BindingInfo info = new BindingInfo(service, "bindingId");
    SoapBinding value = new SoapBinding(info);
    exchange.put(Binding.class, value);
    OperationInfo opInfo = new OperationInfo();
    opInfo.setName(new QName("http://my", "Operation"));
    BindingOperationInfo boi = new BindingOperationInfo(info, opInfo);
    exchange.put(BindingOperationInfo.class, boi);
    message.setExchange(exchange);
    LogEvent event = mapper.map(message, Collections.emptySet());
    Assert.assertEquals("{http://my}Operation", event.getOperationName());
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Message(org.apache.cxf.message.Message) LogEvent(org.apache.cxf.ext.logging.event.LogEvent) QName(javax.xml.namespace.QName) BindingInfo(org.apache.cxf.service.model.BindingInfo) DefaultLogEventMapper(org.apache.cxf.ext.logging.event.DefaultLogEventMapper) MessageImpl(org.apache.cxf.message.MessageImpl) ExchangeImpl(org.apache.cxf.message.ExchangeImpl) SoapBinding(org.apache.cxf.binding.soap.SoapBinding) Test(org.junit.Test) AbstractJaxWsTest(org.apache.cxf.jaxws.AbstractJaxWsTest)

Example 37 with BindingInfo

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

the class JMSEndpointWSDLUtil method getWSDLExtensor.

public static <T> T getWSDLExtensor(EndpointInfo ei, Class<T> cls) {
    ServiceInfo si = ei.getService();
    BindingInfo bi = ei.getBinding();
    Object o = ei.getExtensor(cls);
    if (o == null && si != null) {
        o = si.getExtensor(cls);
    }
    if (o == null && bi != null) {
        o = bi.getExtensor(cls);
    }
    if (o == null) {
        return null;
    }
    if (cls.isInstance(o)) {
        return cls.cast(o);
    }
    return null;
}
Also used : ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo)

Example 38 with BindingInfo

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

the class RMEndpoint method setPolicies.

void setPolicies(Message message) {
    // use same WS-policies as for application endpoint
    PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
    if (null == engine || !engine.isEnabled()) {
        return;
    }
    for (Endpoint endpoint : endpoints.values()) {
        EndpointInfo ei = endpoint.getEndpointInfo();
        EndpointPolicy epi = null == conduit ? engine.getServerEndpointPolicy(applicationEndpoint.getEndpointInfo(), null, message) : engine.getClientEndpointPolicy(applicationEndpoint.getEndpointInfo(), conduit, message);
        if (conduit != null) {
            engine.setClientEndpointPolicy(ei, epi);
        } else {
            engine.setServerEndpointPolicy(ei, epi);
        }
        EffectivePolicyImpl effectiveOutbound = new EffectivePolicyImpl();
        effectiveOutbound.initialise(epi, engine, false, false, message);
        EffectivePolicyImpl effectiveInbound = new EffectivePolicyImpl();
        effectiveInbound.initialise(epi, engine, true, false, message);
        BindingInfo bi = ei.getBinding();
        Collection<BindingOperationInfo> bois = bi.getOperations();
        for (BindingOperationInfo boi : bois) {
            engine.setEffectiveServerRequestPolicy(ei, boi, effectiveInbound);
            engine.setEffectiveServerResponsePolicy(ei, boi, effectiveOutbound);
            engine.setEffectiveClientRequestPolicy(ei, boi, effectiveOutbound);
            engine.setEffectiveClientResponsePolicy(ei, boi, effectiveInbound);
        }
    }
// TODO: FaultPolicy (SequenceFault)
}
Also used : EndpointPolicy(org.apache.cxf.ws.policy.EndpointPolicy) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Endpoint(org.apache.cxf.endpoint.Endpoint) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo) PolicyEngine(org.apache.cxf.ws.policy.PolicyEngine) EffectivePolicyImpl(org.apache.cxf.ws.policy.EffectivePolicyImpl)

Example 39 with BindingInfo

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

the class ServiceProcessor method processBindings.

private void processBindings(JavaModel model) {
    for (BindingInfo binding : service.getBindings()) {
        bindingType = getBindingType(binding);
        if (bindingType == null) {
            org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL", LOG, binding.getName());
            throw new ToolException(msg);
        }
        Collection<BindingOperationInfo> operations = binding.getOperations();
        for (BindingOperationInfo bop : operations) {
            processOperation(model, bop, binding);
        }
    }
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Message(org.apache.cxf.common.i18n.Message) BindingInfo(org.apache.cxf.service.model.BindingInfo) ToolException(org.apache.cxf.tools.common.ToolException) Message(org.apache.cxf.common.i18n.Message)

Example 40 with BindingInfo

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

the class PolicyAnnotationListener method addPolicies.

private void addPolicies(AbstractServiceFactoryBean factory, Endpoint endpoint, Class<?> cls, List<Policy> list, Policy.Placement defaultPlace) {
    ListIterator<Policy> it = list.listIterator();
    InterfaceInfo inf = endpoint.getEndpointInfo().getInterface();
    BindingInfo binf = endpoint.getBinding().getBindingInfo();
    ServiceInfo si = endpoint.getService().getServiceInfos().get(0);
    while (it.hasNext()) {
        Policy p = it.next();
        Policy.Placement place = p.placement();
        if (place == Policy.Placement.DEFAULT) {
            place = defaultPlace;
        }
        switch(place) {
            case PORT_TYPE:
                {
                    addPolicy(inf, si, p, cls, inf.getName().getLocalPart() + "PortTypePolicy");
                    it.remove();
                    break;
                }
            case BINDING:
                {
                    addPolicy(binf, si, p, cls, binf.getName().getLocalPart() + "BindingPolicy");
                    it.remove();
                    break;
                }
            case SERVICE:
                {
                    addPolicy(si, si, p, cls, si.getName().getLocalPart() + "ServicePolicy");
                    it.remove();
                    break;
                }
            case SERVICE_PORT:
                {
                    addPolicy(endpoint.getEndpointInfo(), si, p, cls, endpoint.getEndpointInfo().getName().getLocalPart() + "PortPolicy");
                    it.remove();
                    break;
                }
            default:
        }
    }
}
Also used : Policy(org.apache.cxf.annotations.Policy) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) BindingInfo(org.apache.cxf.service.model.BindingInfo) InterfaceInfo(org.apache.cxf.service.model.InterfaceInfo)

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