Java Code Examples for org.apache.cxf.ws.addressing.AddressingProperties#getAction()

The following examples show how to use org.apache.cxf.ws.addressing.AddressingProperties#getAction() . 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: SlowProcessingSimulator.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String getAction(Message message) {
    final AddressingProperties ap = ContextUtils.retrieveMAPs(message, false, false);
    if (ap != null && ap.getAction() != null) {
        return ap.getAction().getValue();
    }
    return (String)message.get(SoapBindingConstants.SOAP_ACTION);
}
 
Example 2
Source File: MEXInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void handleMessage(Message message) throws Fault {
    String action = (String)message.get(SoapBindingConstants.SOAP_ACTION);
    if (action == null) {
        AddressingProperties inProps = (AddressingProperties)message
            .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
        if (inProps != null && inProps.getAction() != null) {
            action = inProps.getAction().getValue();
        }
    }
    if ("http://schemas.xmlsoap.org/ws/2004/09/transfer/Get".equals(action)
        || "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request".equals(action)) {
        message.remove(AssertionInfoMap.class.getName());
        Exchange ex = message.getExchange();
        Endpoint endpoint = createEndpoint(message);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.put(BindingOperationInfo.class,
               endpoint.getBinding().getBindingInfo()
                   .getOperation(new QName("http://mex.ws.cxf.apache.org/", "Get2004")));
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
        message.getInterceptorChain().add(endpoint.getInInterceptors());
        message.getInterceptorChain().add(endpoint.getBinding().getInInterceptors());
    }

}
 
Example 3
Source File: MAPCodec.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Mediate message flow, performing MAP {en|de}coding.
 *
 * @param message the message message
 */
private void mediate(SoapMessage message) {
    if (!MessageUtils.getContextualBoolean(message, MAPAggregator.ADDRESSING_DISABLED, false)) {
        if (ContextUtils.isOutbound(message)) {
            encode(message, ContextUtils.retrieveMAPs(message, false, true));
        } else if (null == ContextUtils.retrieveMAPs(message, false, false, false)) {
            AddressingProperties maps = decode(message);
            ContextUtils.storeMAPs(maps, message, false);
            markPartialResponse(message, maps);
            restoreExchange(message, maps);

            if (maps != null
                && !MessageUtils.isRequestor(message)
                && message.getExchange().getBindingOperationInfo() == null
                && !MessageUtils.isOutbound(message)
                && maps.getAction() != null) {
                //try and use the Action from the maps to find the operation
                String action = maps.getAction().getValue();
                if (action != null) {
                    boolean strict = MessageUtils.getContextualBoolean(message,
                                                                       "ws-addressing.strict.action.checking",
                                                                       false);
                    SoapActionInInterceptor.getAndSetOperation(message, action, strict);
                }
            }
        }
    }
}
 
Example 4
Source File: RMCaptureInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isApplicationMessage(Message message) {
    final AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
    if (null != maps && null != maps.getAction()) {
        return !RMContextUtils.isRMProtocolMessage(maps.getAction().getValue());
    }
    return false;
}
 
Example 5
Source File: RMCaptureOutInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private boolean isResponseToAction(Message msg, String action) {
    AddressingProperties inMaps = RMContextUtils.retrieveMAPs(msg, false, false);
    String inAction = null;
    if (null != inMaps.getAction()) {
        inAction = inMaps.getAction().getValue();
    }
    return action.equals(inAction);
}
 
Example 6
Source File: RMInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static boolean isApplicationMessage(Message message) {
    final AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
    if (null != maps && null != maps.getAction()) {
        return !RMContextUtils.isRMProtocolMessage(maps.getAction().getValue());
    }
    return false;
}
 
Example 7
Source File: MessageLossSimulator.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void handleMessage(Message message) throws Fault {
    AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, true);
    String action = null;
    if (maps != null && null != maps.getAction()) {
        action = maps.getAction().getValue();
    }
    if (RMContextUtils.isRMProtocolMessage(action)) {
        return;
    }
    if (MessageUtils.isPartialResponse(message)) {
        return;
    }
    if (Boolean.TRUE.equals(message.get(RMMessageConstants.RM_RETRANSMISSION))) {
        return;
    }

    if (mode == 1) {
        // never lose
        return;
    } else if (mode == -1) {
        // always lose
    } else {
        // alternatively lose
        synchronized (this) {
            appMessageCount++;
            if (0 != (appMessageCount % 2)) {
                return;
            }
        }
    }

    InterceptorChain chain = message.getInterceptorChain();
    ListIterator<Interceptor<? extends Message>> it = chain.getIterator();
    while (it.hasNext()) {
        PhaseInterceptor<?> pi = (PhaseInterceptor<? extends Message>)it.next();
        if (MessageSenderInterceptor.class.getName().equals(pi.getId())) {
            chain.remove(pi);
            LOG.fine("Removed MessageSenderInterceptor from interceptor chain.");
            break;
        }
    }

    message.setContent(OutputStream.class, new WrappedOutputStream(message));

    message.getInterceptorChain().add(new MessageLossEndingInterceptor(throwsException));
}