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());
}
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;
}
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)
}
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);
}
}
}
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:
}
}
}
Aggregations