public void handleMessage(SoapMessage message) throws Fault { AddressingProperties inProps = (AddressingProperties)message .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND); AddressingProperties outProps = (AddressingProperties)message .getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND); if (inProps != null) { if (outProps == null) { outProps = new AddressingProperties(inProps.getNamespaceURI()); } AttributedURIType action = new AttributedURIType(); action.setValue(inProps.getAction().getValue().replace("/RST/", "/RSTR/")); outProps.setAction(action); message.put(JAXWSAConstants.ADDRESSING_PROPERTIES_OUTBOUND, outProps); } }
private boolean needsReplyTo(AddressingProperties maps, SoapMessage m) { if (!MessageUtils.getContextualBoolean(m, "ws-addressing.write.optional.replyto", true)) { if (ContextUtils.isNoneAddress(maps.getReplyTo()) && m.getExchange().isOneWay()) { //one-way + none, not needed return false; } if (ContextUtils.isAnonymousAddress(maps.getReplyTo())) { //anonymous is the default if not specified, not needed return false; } } return maps.getReplyTo() != null && maps.getReplyTo().getAddress() != null && maps.getReplyTo().getAddress().getValue() != null && !(Names200408.WSA_NAMESPACE_NAME.equals(maps.getNamespaceURI()) && maps.getReplyTo().getAddress().getValue() .equals(ContextUtils.getNoneEndpointReference().getAddress().getValue())); }
/** * Get MessageId from WS Addressing properties * * @param message * @return message id */ private String getMessageId(Message message) { AddressingProperties addrProp = ContextUtils.retrieveMAPs(message, false, MessageUtils.isOutbound(message), false); return addrProp != null && addrProp.getMessageID() != null ? addrProp.getMessageID().getValue() : UUID.randomUUID().toString(); }
public AddressingProperties createCompatibleResponseProperties() { return new AddressingProperties(getNamespaceURI()); } }
/** * Helper method to determine if an MAPs Action is empty (a null action * is considered empty, whereas a zero length action suppresses * the propagation of the Action property). * * @param maps the MAPs Action under test * @return true if the Action is empty */ public static boolean hasEmptyAction(AddressingProperties maps) { boolean empty = maps.getAction() == null; if (maps.getAction() != null && maps.getAction().getValue().isEmpty()) { maps.setAction(null); empty = false; } return empty; }
private void updateOutputAction(String append) { AddressingProperties p = ContextUtils.retrieveMAPs(PhaseInterceptorChain.getCurrentMessage(), false, false); AddressingProperties pout = new AddressingProperties(); AttributedURIType action = new AttributedURIType(); action.setValue(p.getAction().getValue() + append); pout.exposeAs(p.getNamespaceURI()); pout.setAction(action); ContextUtils.storeMAPs(pout, PhaseInterceptorChain.getCurrentMessage(), true); }
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()); } }
if (maps.getTo() == null) { Conduit conduit = null; if (isOutbound) { conduit = ContextUtils.getConduit(null, message); maps.setTo(reference); EndpointReferenceType replyTo = maps.getReplyTo(); maps.setReplyTo(replyTo); if (maps.getFaultTo() == null) { maps.setFaultTo(maps.getReplyTo()); } else if (maps.getFaultTo().getAddress() == null) { maps.setFaultTo(null); maps.exposeAs(inMAPs.getNamespaceURI()); if (isFault && inMAPs.getFaultTo() != null) { maps.setTo(inMAPs.getFaultTo()); } else if (maps.getTo() == null && inMAPs.getReplyTo() != null) { maps.setTo(inMAPs.getReplyTo()); if (inMAPs.getMessageID() != null && !Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE))) { String inMessageID = inMAPs.getMessageID().getValue(); maps.setRelatesTo(ContextUtils.getRelatesTo(inMessageID)); } else { maps.setRelatesTo(ContextUtils
if (isServer) { AddressingProperties inMaps = RMContextUtils.retrieveMAPs(message, false, false); inMaps.exposeAs(config.getAddressingNamespace()); acksTo = RMUtils.createReference(inMaps.getTo().getValue()); to = inMaps.getReplyTo(); source.getReliableEndpoint().getServant().setUnattachedIdentifier(inSeqId); relatesTo = (new org.apache.cxf.ws.addressing.ObjectFactory()).createRelatesToType(); to = RMUtils.createReference(maps.getTo().getValue()); acksTo = maps.getReplyTo(); if (RMUtils.getAddressingConstants().getNoneURI().equals(acksTo.getAddress().getValue())) { Endpoint ei = message.getExchange().getEndpoint(); org.apache.cxf.transport.Destination dest = ei == null ? null : ei.getEndpointInfo() if (ContextUtils.isGenericAddress(to)) { org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message( "CREATE_SEQ_ANON_TARGET", LOG, Exchange exchange = new ExchangeImpl(); Map<String, Object> context = new HashMap<>(16); for (String key : message.getContextualPropertyKeys()) { context.put(key, message.getContextualProperty(key));
private void doCancel(SoapMessage message, AssertionInfoMap aim, SecureConversationToken itok) { Message m2 = message.getExchange().getOutMessage(); SecurityToken tok = (SecurityToken)m2.getContextualProperty(SecurityConstants.TOKEN); if (tok == null) { String tokId = (String)m2.getContextualProperty(SecurityConstants.TOKEN_ID); if (tokId != null) { tok = TokenStoreUtils.getTokenStore(m2).getToken(tokId); AddressingProperties maps = (AddressingProperties)message .get("javax.xml.ws.addressing.context.inbound"); if (maps == null) { maps = (AddressingProperties)m2 .get("javax.xml.ws.addressing.context"); client.setAddressingNamespace(maps.getNamespaceURI());
@Override public void handleMessage(Message message) throws Fault { XMLStreamWriter w = (XMLStreamWriter)message.get("RM_ORIGINAL_WRITER"); message.setContent(XMLStreamWriter.class, w); CapturingXMLWriter cw = (CapturingXMLWriter)message.get("RM_CAPTURING_WRITER"); RMMessage msg = new RMMessage(); msg.setMessageNumber(number); if (!MessageUtils.isRequestor(message)) { AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, true); if (null != maps && null != maps.getTo()) { msg.setTo(maps.getTo().getValue());
&& maps.getRelatesTo() != null && !Names.WSA_UNSPECIFIED_RELATIONSHIP.equals(maps.getRelatesTo().getValue()) && isRelationshipReply(maps.getRelatesTo())) { Exchange correlatedExchange = uncorrelatedExchanges.remove(maps.getRelatesTo().getValue()); if (correlatedExchange != null) { synchronized (correlatedExchange) { message.setExchange(correlatedExchange); Message outmsg = message.getExchange().getOutMessage(); || !outp.getMessageID().getValue().equals(maps.getRelatesTo().getValue())) { Message m = message.getExchange().getOutMessage(); Exchange ex = uncorrelatedExchanges.get(maps.getMessageID().getValue()); if (ex == message.getExchange()) { uncorrelatedExchanges.remove(maps.getMessageID().getValue()); LOG.log(Level.WARNING, "RESPONSE_NOT_USING_WSADDRESSING"); } else if (maps.getRelatesTo() == null && maps.getAction() != null && (Names.WSA_DEFAULT_FAULT_ACTION.equals(maps.getAction().getValue()) || Names.WSA_DEFAULT_SOAP_FAULT_ACTION.equals(maps.getAction().getValue()) || "http://docs.oasis-open.org/wsrf/fault".equals(maps.getAction().getValue()))) { if (maps != null) { uncorrelatedExchanges.remove(maps.getMessageID().getValue());
/** * Check for NONE ReplyTo value in request-response MEP * @param message the current message * @param maps the incoming MAPs */ private void checkReplyTo(Message message, AddressingProperties maps) { // if ReplyTo address is none then 202 response status is expected // However returning a fault is more appropriate for request-response MEP if (!message.getExchange().isOneWay() && !MessageUtils.isPartialResponse(message) && ContextUtils.isNoneAddress(maps.getReplyTo())) { String reason = MessageFormat.format(BUNDLE.getString("REPLYTO_NOT_SUPPORTED_MSG"), maps.getReplyTo().getAddress().getValue()); throw new SoapFault(reason, new QName(Names.WSA_NAMESPACE_NAME, Names.WSA_NONE_ADDRESS)); } }
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); && !MessageUtils.isRequestor(message) && message.getExchange().getBindingOperationInfo() == null && !MessageUtils.isOutbound(message) && maps.getAction() != null) { String action = maps.getAction().getValue(); if (action != null) { boolean strict = MessageUtils.getContextualBoolean(message,
private static String getAddressingNamespaceURI(Message message) { AddressingProperties maps = (AddressingProperties)message .get("javax.xml.ws.addressing.context.outbound"); if (maps == null) { maps = (AddressingProperties)message .get("javax.xml.ws.addressing.context"); } if (maps != null) { return maps.getNamespaceURI(); } return null; }
message.setExchange(exchange); exchange.setOutMessage(message); if (null != conduit) { exchange.setConduit(conduit); message.put(Message.REQUESTOR_ROLE, Boolean.TRUE); exchange.put(Endpoint.class, endpoint); exchange.put(Service.class, endpoint.getService()); exchange.put(Binding.class, endpoint.getBinding()); if (null == conduit) { String to = m.getTo(); AddressingProperties maps = new AddressingProperties(); maps.setTo(RMUtils.createReference(to)); RMContextUtils.storeMAPs(maps, message, true, false);
protected void handle(Message msg) throws SequenceFault, RMException { AddressingProperties maps = ContextUtils.retrieveMAPs(msg, false, true, false); if (null == maps) { LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG"); return; if (Boolean.TRUE.equals(msg.get(RMMessageConstants.RM_RETRANSMISSION))) { return; if (null != maps.getAction()) { action = maps.getAction().getValue(); maps.exposeAs(wsaNamespace); boolean isPartialResponse = MessageUtils.isPartialResponse(msg); RMConstants constants = protocol.getConstants(); RMProperties rmpsOut = RMContextUtils.retrieveRMProperties(msg, true); boolean isTerminate = constants.getTerminateSequenceAction().equals(action); if (isApplicationMessage || isAck || isClose || isTerminate) { AttributedURIType to = maps.getTo(); assert null != to; addAcknowledgements(destination, rmpsOut, inSeqId, to); if (isPartialResponse && rmpsOut.getAcks() != null && rmpsOut.getAcks().size() > 0) { setAction(maps, constants.getSequenceAckAction()); msg.remove(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE); isAck = true; maps.setReplyTo(RMUtils.createNoneReference());
@Override public void handleMessage(Message pMessage) throws Fault { AttributedURIType uri = new AttributedURIType(); uri.setValue(getWSAddressingToUri()); AddressingProperties maps = new AddressingProperties(); maps.setTo(uri); pMessage.put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, maps); }
if (!message.getExchange().isOneWay()) { AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, true, false); if (ContextUtils.isRequestor(message) && maps != null) { uncorrelatedExchanges.remove(maps.getMessageID().getValue()); } else if (!ContextUtils.isRequestor(message) && maps == null && !message.containsKey(MAPAggregator.class.getName())) { for (Interceptor<? extends Message> i : message.getInterceptorChain()) { if (i instanceof MAPAggregator) { try { if (MessageUtils.getContextualBoolean(message, DECOUPLED_FAULT_SUPPORT, false)) { new DecoupledFaultHandler().handleFault(message);
maps = new AddressingProperties(); maps.exposeAs(headerURI); invalidCardinalityQName = maps.getMessageID() != null ? Names.WSA_MESSAGEID_QNAME : null; maps.setMessageID(decodeAsNative( headerURI, AttributedURIType.class, unmarshaller)); } else if (Names.WSA_TO_NAME.equals(localName)) { invalidCardinalityQName = maps.getTo() != null ? Names.WSA_TO_QNAME : null; AttributedURIType addr = decodeAsNative( headerURI, headerElement, unmarshaller); maps.setTo(EndpointReferenceUtils.getEndpointReference(addr)); } else if (Names.WSA_FROM_NAME.equals(localName)) { invalidCardinalityQName = maps.getFrom() != null ? Names.WSA_FROM_QNAME : null; maps.setFrom(decodeAsNative( headerURI, EndpointReferenceType.class, unmarshaller)); } else if (Names.WSA_REPLYTO_NAME.equals(localName)) { invalidCardinalityQName = maps.getReplyTo() != null ? Names.WSA_REPLYTO_QNAME : null;