Java Code Examples for org.apache.cxf.service.model.OperationInfo#getName()
The following examples show how to use
org.apache.cxf.service.model.OperationInfo#getName() .
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: OperationInfoAuthorizingInterceptor.java From cxf with Apache License 2.0 | 6 votes |
@Override public void handleMessage(Message message) { OperationInfo opinfo = getTargetOperationInfo(message); SecurityContext sc = message.get(SecurityContext.class); if (sc != null && sc.getUserPrincipal() != null) { if (opinfo.getName() != null && authorize(sc, opinfo.getName().getLocalPart())) { return; } } else if (!isMethodProtected(opinfo.getName().getLocalPart()) && isAllowAnonymousUsers()) { return; } throw new AccessDeniedException("Unauthorized"); }
Example 2
Source File: BindingHelper.java From syndesis with Apache License 2.0 | 5 votes |
public String getSpecification() throws ParserException { // add a SOAP schema to hold wrapper elements, to be removed by soap connector final SchemaCollection targetSchemas = new SchemaCollection(); final XmlSchema soapSchema = targetSchemas.newXmlSchemaInCollection(soapVersion.getEnvelope().getNamespaceURI()); soapSchema.setElementFormDefault(XmlSchemaForm.QUALIFIED); soapSchema.setAttributeFormDefault(XmlSchemaForm.QUALIFIED); // extract elements/types from source schema using an XmlSchemaExtractor final XmlSchemaExtractor schemaExtractor = new XmlSchemaExtractor(targetSchemas, schemaCollection); // TODO also handle faults for output message, which requires an enhancement in Syndesis if (style == Style.RPC) { final OperationInfo operationInfo = bindingOperation.getOperationInfo(); final QName operationName = operationInfo.getName(); final QName wrapperElement = bindingMessageInfo.getMessageInfo().getType() == MessageInfo.Type.INPUT ? operationName : new QName(operationName.getNamespaceURI(), operationName.getLocalPart() + "Response"); createRpcEnvelope(schemaExtractor, wrapperElement); } else { final List<XmlSchemaElement> bodyElements = getPartElements(schemaExtractor, soapSchema, bodyParts); // if topLevel is true, root element was already added to generated schema as top level element final List<XmlSchemaElement> headerElements = hasHeaders ? getPartElements(schemaExtractor, soapSchema, headerParts) : null; createDocumentEnvelope(schemaExtractor, headerElements, bodyElements); } return getSpecificationString(schemaExtractor); }
Example 3
Source File: OperationProcessor.java From cxf with Apache License 2.0 | 4 votes |
void processMethod(JavaMethod method, OperationInfo operation) throws ToolException { if (isAsyncMethod(method)) { return; } MessageInfo inputMessage = operation.getInput(); MessageInfo outputMessage = operation.getOutput(); if (inputMessage == null) { LOG.log(Level.WARNING, "NO_INPUT_MESSAGE", new Object[] {operation.getName()}); org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("INVALID_MEP", LOG, new Object[] {operation.getName()}); throw new ToolException(msg); } ParameterProcessor paramProcessor = new ParameterProcessor(context); method.clear(); JAXWSBinding opBinding = operation.getExtensor(JAXWSBinding.class); JAXWSBinding ptBinding = operation.getInterface().getExtensor(JAXWSBinding.class); JAXWSBinding defBinding = operation.getInterface().getService() .getDescription().getExtensor(JAXWSBinding.class); boolean enableAsync = false; boolean enableMime = false; boolean enableWrapper = method.isWrapperStyle(); if (defBinding != null) { if (defBinding.isSetEnableMime()) { enableMime = defBinding.isEnableMime(); } if (defBinding.isSetEnableAsyncMapping()) { enableAsync = defBinding.isEnableAsyncMapping(); } if (defBinding.isSetEnableWrapperStyle()) { enableWrapper = defBinding.isEnableWrapperStyle(); } } if (ptBinding != null) { if (ptBinding.isSetEnableMime()) { enableMime = ptBinding.isEnableMime(); } if (ptBinding.isSetEnableAsyncMapping()) { enableAsync = ptBinding.isEnableAsyncMapping(); } if (ptBinding.isSetEnableWrapperStyle()) { enableWrapper = ptBinding.isEnableWrapperStyle(); } } if (opBinding != null) { if (opBinding.isSetEnableMime()) { enableMime = opBinding.isEnableMime(); } if (opBinding.isSetEnableAsyncMapping()) { enableAsync = opBinding.isEnableAsyncMapping(); } if (opBinding.isSetEnableWrapperStyle()) { enableWrapper = opBinding.isEnableWrapperStyle(); } } enableWrapper = checkEnableWrapper(enableWrapper, method); enableAsync = checkEnableAsync(enableAsync, method); enableMime = checkEnableMime(enableMime, method); method.setWrapperStyle(enableWrapper && method.isWrapperStyle()); paramProcessor.process(method, inputMessage, outputMessage, operation.getParameterOrdering()); if (method.isWrapperStyle()) { setWrapper(operation); method.annotate(new WrapperAnnotator(wrapperRequest, wrapperResponse)); } method.annotate(new WebMethodAnnotator()); method.annotate(new WebResultAnnotator()); if (!method.isOneWay() && enableAsync && !isAddedAsycMethod(method)) { addAsyncMethod(method); } if (enableMime) { method.setMimeEnable(true); } }
Example 4
Source File: Proxy.java From cxf with Apache License 2.0 | 4 votes |
Object invoke(OperationInfo oi, ProtocolVariation protocol, Object[] params, Map<String, Object> context, Exchange exchange, Level exceptionLevel) throws RMException { if (LOG.isLoggable(Level.INFO)) { LOG.log(Level.INFO, "Sending out-of-band RM protocol message {0}.", oi == null ? null : oi.getName()); } RMManager manager = reliableEndpoint.getManager(); Bus bus = manager.getBus(); Endpoint endpoint = reliableEndpoint.getEndpoint(protocol); BindingInfo bi = reliableEndpoint.getBindingInfo(protocol); Conduit c = reliableEndpoint.getConduit(); Client client = null; if (params.length > 0 && params[0] instanceof DestinationSequence) { EndpointReferenceType acksTo = ((DestinationSequence)params[0]).getAcksTo(); String acksAddress = acksTo.getAddress().getValue(); AttributedURIType attrURIType = new AttributedURIType(); attrURIType.setValue(acksAddress); EndpointReferenceType acks = new EndpointReferenceType(); acks.setAddress(attrURIType); client = createClient(bus, endpoint, protocol, c, acks); params = new Object[] {}; } else { EndpointReferenceType replyTo = reliableEndpoint.getReplyTo(); client = createClient(bus, endpoint, protocol, c, replyTo); } BindingOperationInfo boi = bi.getOperation(oi); try { if (context != null) { client.getRequestContext().putAll(context); } Object[] result = client.invoke(boi, params, context, exchange); if (result != null && result.length > 0) { return result[0]; } } catch (Exception ex) { org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("SEND_PROTOCOL_MSG_FAILED_EXC", LOG, oi == null ? null : oi.getName()); LOG.log(exceptionLevel, msg.toString(), ex); throw new RMException(msg, ex); } return null; }