Java Code Examples for org.apache.cxf.service.model.BindingOperationInfo#getOperationInfo()
The following examples show how to use
org.apache.cxf.service.model.BindingOperationInfo#getOperationInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoapApiModelParser.java From syndesis with Apache License 2.0 | 6 votes |
private static ConnectorAction parseConnectorAction(final BindingOperationInfo bindingOperationInfo, final Map<String, Integer> idMap, final String connectorId) throws ParserException { final OperationInfo operationInfo = bindingOperationInfo.getOperationInfo(); final String description = getDescription(operationInfo, o -> "Invokes the operation " + getOperationName(bindingOperationInfo)); final QName name = bindingOperationInfo.getName(); final ConnectorAction.Builder builder = new ConnectorAction.Builder() .name(name.getLocalPart()) .description(description) .id(getActionId(connectorId, name.getLocalPart(), idMap)) .descriptor(new ConnectorDescriptor.Builder() .connectorId(connectorId) .putConfiguredProperty(DEFAULT_OPERATION_NAME_PROPERTY, name.getLocalPart()) .putConfiguredProperty(DEFAULT_OPERATION_NAMESPACE_PROPERTY, name.getNamespaceURI()) .putConfiguredProperty(DATA_FORMAT_PROPERTY, PAYLOAD_FORMAT) .inputDataShape(getDataShape(bindingOperationInfo.getInput())) .outputDataShape(getDataShape(bindingOperationInfo.getOutput())) // TODO handle SOAP faults .build()) .pattern(Action.Pattern.To); return builder.build(); }
Example 2
Source File: URIDomainExpression.java From cxf with Apache License 2.0 | 6 votes |
@Override public boolean appliesTo(BindingOperationInfo boi) { if (boi == null) { return false; } if ((boi.getBinding() != null) && (boi.getBinding().getName() != null) && wsdl11XPointer.matchesBinding( boi.getBinding().getName().getNamespaceURI(), boi.getBinding().getName().getLocalPart())) { return true; } if ((boi.getName() != null) && (boi.getBinding() != null) && (boi.getBinding().getName() != null) && wsdl11XPointer.matchesBindingOperation( boi.getBinding().getName().getNamespaceURI(), boi.getBinding().getName().getLocalPart(), boi.getName().getLocalPart())) { return true; } return (boi.getOperationInfo() != null) && (boi.getOperationInfo().getInterface() != null) && (boi.getOperationInfo().getInterface().getName() != null) && (boi.getOperationInfo().getName() != null) && wsdl11XPointer.matchesPortTypeOperation( boi.getOperationInfo().getInterface().getName().getNamespaceURI(), boi.getOperationInfo().getInterface().getName().getLocalPart(), boi.getOperationInfo().getName().getLocalPart()); }
Example 3
Source File: PhaseInterceptorChain.java From cxf with Apache License 2.0 | 6 votes |
private String getServiceInfo(Message message) { StringBuilder description = new StringBuilder(); if (message.getExchange() != null) { Exchange exchange = message.getExchange(); Service service = exchange.getService(); if (service != null) { description.append('\''); description.append(service.getName()); BindingOperationInfo boi = exchange.getBindingOperationInfo(); OperationInfo opInfo = boi != null ? boi.getOperationInfo() : null; if (opInfo != null) { description.append('#').append(opInfo.getName()); } description.append("\' "); } } return description.toString(); }
Example 4
Source File: CorbaStreamInInterceptor.java From cxf with Apache License 2.0 | 5 votes |
protected NVList prepareArguments(CorbaMessage corbaMsg, InterfaceInfo info, OperationType opType, QName opQName, CorbaTypeMap typeMap, CorbaDestination destination, ServiceInfo service) { BindingInfo bInfo = destination.getBindingInfo(); EndpointInfo eptInfo = destination.getEndPointInfo(); BindingOperationInfo bOpInfo = bInfo.getOperation(opQName); OperationInfo opInfo = bOpInfo.getOperationInfo(); Exchange exg = corbaMsg.getExchange(); exg.put(BindingInfo.class, bInfo); exg.put(InterfaceInfo.class, info); exg.put(EndpointInfo.class, eptInfo); exg.put(EndpointReferenceType.class, destination.getAddress()); exg.put(ServiceInfo.class, service); exg.put(BindingOperationInfo.class, bOpInfo); exg.put(OperationInfo.class, opInfo); exg.put(MessageInfo.class, opInfo.getInput()); exg.put(String.class, opQName.getLocalPart()); exg.setInMessage(corbaMsg); corbaMsg.put(MessageInfo.class, opInfo.getInput()); List<ParamType> paramTypes = opType.getParam(); CorbaStreamable[] arguments = new CorbaStreamable[paramTypes.size()]; return prepareDIIArgsList(corbaMsg, bOpInfo, arguments, paramTypes, typeMap, exg.get(ORB.class), service); }
Example 5
Source File: SoapBindingInfo.java From cxf with Apache License 2.0 | 5 votes |
public OperationInfo getOperationByAction(String action) { for (BindingOperationInfo b : getOperations()) { SoapOperationInfo opInfo = b.getExtensor(SoapOperationInfo.class); if (opInfo.getAction().equals(action)) { return b.getOperationInfo(); } } return null; }
Example 6
Source File: ServiceUtils.java From cxf with Apache License 2.0 | 5 votes |
private static SchemaValidationType getSchemaValidationTypeFromModel(Message message) { Exchange exchange = message.getExchange(); SchemaValidationType validationType = null; if (exchange != null) { BindingOperationInfo boi = exchange.getBindingOperationInfo(); if (boi != null) { OperationInfo opInfo = boi.getOperationInfo(); if (opInfo != null) { validationType = getSchemaValidationTypeFromModel(opInfo); } } if (validationType == null) { Endpoint endpoint = exchange.getEndpoint(); if (endpoint != null) { EndpointInfo ep = endpoint.getEndpointInfo(); if (ep != null) { validationType = getSchemaValidationTypeFromModel(ep); } } } } return validationType; }
Example 7
Source File: OperationInfoAuthorizingInterceptor.java From cxf with Apache License 2.0 | 5 votes |
protected OperationInfo getTargetOperationInfo(Message message) { BindingOperationInfo bop = message.getExchange().getBindingOperationInfo(); if (bop != null) { return bop.getOperationInfo(); } throw new AccessDeniedException("OperationInfo is not available : Unauthorized"); }
Example 8
Source File: OutgoingChainInterceptor.java From cxf with Apache License 2.0 | 5 votes |
public void handleMessage(Message message) { Exchange ex = message.getExchange(); BindingOperationInfo binding = ex.getBindingOperationInfo(); //if we get this far, we're going to be outputting some valid content, but we COULD //also be "echoing" some of the content from the input. Thus, we need to //mark it as requiring the input to be cached. if (message.getExchange().get(CACHE_INPUT_PROPERTY) == null) { message.put(CACHE_INPUT_PROPERTY, Boolean.TRUE); } if (null != binding && null != binding.getOperationInfo() && binding.getOperationInfo().isOneWay()) { closeInput(message); return; } Message out = ex.getOutMessage(); if (out != null) { try { getBackChannelConduit(message); } catch (IOException ioe) { throw new Fault(ioe); } if (binding != null) { out.put(MessageInfo.class, binding.getOperationInfo().getOutput()); out.put(BindingMessageInfo.class, binding.getOutput()); } InterceptorChain outChain = out.getInterceptorChain(); if (outChain == null) { outChain = OutgoingChainInterceptor.getChain(ex, chainCache); out.setInterceptorChain(outChain); } else if (outChain.getState() == InterceptorChain.State.PAUSED) { outChain.resume(); return; } outChain.doIntercept(out); } }
Example 9
Source File: AbstractInDatabindingInterceptor.java From cxf with Apache License 2.0 | 5 votes |
protected MessageInfo getMessageInfo(Message message, BindingOperationInfo operation, boolean requestor) { MessageInfo msgInfo; OperationInfo intfOp = operation.getOperationInfo(); if (requestor) { msgInfo = intfOp.getOutput(); message.put(MessageInfo.class, intfOp.getOutput()); } else { msgInfo = intfOp.getInput(); message.put(MessageInfo.class, intfOp.getInput()); } return msgInfo; }
Example 10
Source File: CorbaStreamFaultInInterceptor.java From cxf with Apache License 2.0 | 4 votes |
public void handleMessage(Message msg) { CorbaMessage message = (CorbaMessage)msg; try { SystemException sysEx = message.getSystemException(); if (sysEx != null) { message.setContent(Exception.class, sysEx); return; } CorbaStreamable exStreamable = message.getStreamableException(); if (exStreamable != null) { DataReader<XMLStreamReader> reader = getDataReader(message); BindingOperationInfo bopInfo = message.getExchange().getBindingOperationInfo(); OperationInfo opInfo = bopInfo.getOperationInfo(); ServiceInfo service = message.getExchange().getEndpoint().getEndpointInfo().getService(); org.omg.CORBA.ORB orb = (org.omg.CORBA.ORB) message.get(CorbaConstants.ORB); if (orb == null) { orb = message.getExchange().get(org.omg.CORBA.ORB.class); } QName elName = new QName("", exStreamable.getName()); FaultInfo fault = getFaultInfo(opInfo, elName); CorbaTypeEventProducer faultEventProducer = CorbaHandlerUtils.getTypeEventProducer(exStreamable.getObject(), service, orb); CorbaStreamReader streamReader = new CorbaStreamReader(faultEventProducer); Object e = reader.read(fault.getMessageParts().get(0), streamReader); if (!(e instanceof Exception)) { Class<?> exClass = fault.getProperty(Class.class.getName(), Class.class); if (exClass != null) { Class<?> beanClass = e.getClass(); Constructor<?> constructor = exClass.getConstructor(new Class[]{String.class, beanClass}); String repId = (message.getStreamableException()._type().id() != null) ? message.getStreamableException()._type().id() : ""; e = constructor.newInstance(new Object[]{repId, e}); } else { // Get the Fault Fault faultEx = (Fault) message.getContent(Exception.class); if (e instanceof Document) { createFaultDetail((Document)e, fault, faultEx); } e = faultEx; } } message.setContent(Exception.class, e); } } catch (java.lang.Exception ex) { LOG.log(Level.SEVERE, "CORBA unmarshalFault exception", ex); throw new CorbaBindingException("CORBA unmarshalFault exception", ex); } }
Example 11
Source File: ColocMessageObserver.java From cxf with Apache License 2.0 | 4 votes |
public void onMessage(Message m) { Bus origBus = BusFactory.getAndSetThreadDefaultBus(bus); ClassLoaderHolder origLoader = null; try { if (loader != null) { origLoader = ClassLoaderUtils.setThreadContextClassloader(loader); } if (LOG.isLoggable(Level.FINER)) { LOG.finer("Processing Message at collocated endpoint. Request message: " + m); } Exchange ex = new ExchangeImpl(); setExchangeProperties(ex, m); Message inMsg = endpoint.getBinding().createMessage(); MessageImpl.copyContent(m, inMsg); //Copy Request Context to Server inBound Message //TODO a Context Filter Strategy required. inMsg.putAll(m); inMsg.put(COLOCATED, Boolean.TRUE); inMsg.put(Message.REQUESTOR_ROLE, Boolean.FALSE); inMsg.put(Message.INBOUND_MESSAGE, Boolean.TRUE); BindingOperationInfo boi = ex.getBindingOperationInfo(); OperationInfo oi = boi != null ? boi.getOperationInfo() : null; if (oi != null) { inMsg.put(MessageInfo.class, oi.getInput()); } ex.setInMessage(inMsg); inMsg.setExchange(ex); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Build inbound interceptor chain."); } //Add all interceptors between USER_LOGICAL and INVOKE. SortedSet<Phase> phases = new TreeSet<>(bus.getExtension(PhaseManager.class).getInPhases()); ColocUtil.setPhases(phases, Phase.USER_LOGICAL, Phase.INVOKE); InterceptorChain chain = ColocUtil.getInInterceptorChain(ex, phases); chain.add(addColocInterceptors()); inMsg.setInterceptorChain(chain); //Convert the coloc object type if necessary BindingOperationInfo bop = m.getExchange().getBindingOperationInfo(); OperationInfo soi = bop != null ? bop.getOperationInfo() : null; if (soi != null && oi != null) { if (ColocUtil.isAssignableOperationInfo(soi, Source.class) && !ColocUtil.isAssignableOperationInfo(oi, Source.class)) { // converting source -> pojo ColocUtil.convertSourceToObject(inMsg); } else if (ColocUtil.isAssignableOperationInfo(oi, Source.class) && !ColocUtil.isAssignableOperationInfo(soi, Source.class)) { // converting pojo -> source ColocUtil.convertObjectToSource(inMsg); } } chain.doIntercept(inMsg); if (soi != null && oi != null) { if (ColocUtil.isAssignableOperationInfo(soi, Source.class) && !ColocUtil.isAssignableOperationInfo(oi, Source.class) && ex.getOutMessage() != null) { // converting pojo -> source ColocUtil.convertObjectToSource(ex.getOutMessage()); } else if (ColocUtil.isAssignableOperationInfo(oi, Source.class) && !ColocUtil.isAssignableOperationInfo(soi, Source.class) && ex.getOutMessage() != null) { // converting pojo -> source ColocUtil.convertSourceToObject(ex.getOutMessage()); } } //Set Server OutBound Message onto InBound Exchange. setOutBoundMessage(ex, m.getExchange()); } finally { if (origBus != bus) { BusFactory.setThreadDefaultBus(origBus); } if (origLoader != null) { origLoader.reset(); } } }