private boolean isWSAddressingReplyToSpecified(Exchange ex) { AddressingProperties map = ContextUtils.retrieveMAPs(ex.getInMessage(), false, false, false); return map != null && !ContextUtils.isGenericAddress(map.getReplyTo()); } };
public MAPEndpoint getReplyTo() { EndpointReferenceType replyTo = implementation.getReplyTo(); return (replyTo != null ? new CXFMAPEndpoint(replyTo) : null); }
@SuppressWarnings("unchecked") public void overrideCXFAddress(Exchange exchange) { Map<String, Object> requestContext = (Map<String, Object>) exchange.getIn().getHeader(Client.REQUEST_CONTEXT); log.debug("CXF Request Context: " + requestContext); if (requestContext != null) { AddressingProperties addressingProperties = (AddressingProperties)requestContext.get("javax.xml.ws.addressing.context"); if (addressingProperties.getReplyTo().getAddress().getValue() != null) { String replyTo = addressingProperties.getReplyTo().getAddress().getValue(); log.debug("Reply to address in CXF Request Context: " + replyTo); if (replyToMap.containsKey(replyTo)) { log.debug("Map contains key: " + replyTo + ", setting destination override to: " + replyToMap.get(replyTo)); exchange.getIn().setHeader(Exchange.DESTINATION_OVERRIDE_URL, replyToMap.get(replyTo)); } } } }
private boolean isNativeAsyn(Message message) { boolean ret = false; AddressingProperties addressingProperties = (AddressingProperties) message.get(WSAUtils.WSA_HEADERS_INBOUND); if (addressingProperties != null && !ContextUtils.isGenericAddress(addressingProperties.getReplyTo())) { //it's decoupled endpoint, so already switch thread and //use executors, which means underlying transport won't //be block, so we shouldn't rely on continuation in //this case, as the SuspendedInvocationException can't be //caught by underlying transport. We just need pause/resume InterceptorChain //before/after send/receive MessageExchange for async return true; } return ret; }
/** * 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)); } }
private boolean isWSAddressingReplyToSpecified(Exchange ex) { AddressingProperties map = ContextUtils.retrieveMAPs(ex.getInMessage(), false, false, false); return map != null && !ContextUtils.isGenericAddress(map.getReplyTo()); } };
private boolean isWSAddressingReplyToSpecified(Exchange ex) { AddressingProperties map = ContextUtils.retrieveMAPs(ex.getInMessage(), false, false, false); return map != null && !ContextUtils.isGenericAddress(map.getReplyTo()); } };
/** * 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)); } }
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())); }
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())); }
) throws WSSecurityException { if (!signAddressingHeaders || addressingProperties == null || (addressingProperties.getReplyTo() == null && addressingProperties.getFaultTo() == null)) { return; if (!isReplyToSigned && (addressingProperties.getReplyTo() != null)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, new Exception("The Addressing headers are not signed"));
) throws WSSecurityException { if (!signAddressingHeaders || addressingProperties == null || (addressingProperties.getReplyTo() == null && addressingProperties.getFaultTo() == null)) { return; if (!isReplyToSigned && (addressingProperties.getReplyTo() != null)) { throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, new Exception("The Addressing headers are not signed"));
void ackImmediately(DestinationSequence seq, Message message) throws RMException { seq.scheduleImmediateAcknowledgement(); // if we cannot expect an outgoing message to which the // acknowledgement // can be added we need to send an out-of-band // SequenceAcknowledgement message AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false); String replyToAddress = null; if (null != maps.getReplyTo()) { replyToAddress = maps.getReplyTo().getAddress().getValue(); } if (!(seq.getAcksTo().getAddress().getValue().equals(replyToAddress) || seq .canPiggybackAckOnPartialResponse())) { getReliableEndpoint().getProxy().acknowledge(seq); } }
private boolean needsFaultTo(AddressingProperties maps) { return maps.getFaultTo() != null && maps.getFaultTo().getAddress() != null && maps.getFaultTo().getAddress().getValue() != null && !maps.getFaultTo().getAddress().getValue() .equals(maps.getReplyTo().getAddress().getValue()); }
private boolean needsFaultTo(AddressingProperties maps) { return maps.getFaultTo() != null && maps.getFaultTo().getAddress() != null && maps.getFaultTo().getAddress().getValue() != null && !maps.getFaultTo().getAddress().getValue() .equals(maps.getReplyTo().getAddress().getValue()); }
private void aggregateAddressing( SoapMessage message, String callbackEndpoint, String relatesTo) { final AddressingProperties maps = initAddressingProperties(message); if (callbackEndpoint != null) { EndpointReferenceType replyTo= maps.getReplyTo(); if (replyTo == null || ContextUtils.isGenericAddress(replyTo)) { EndpointReferenceType replyToRef = new EndpointReferenceType(); AttributedURIType address = new AttributedURIType(); address.setValue(callbackEndpoint); replyToRef.setAddress(address); maps.setReplyTo(replyToRef); } } /* Have to comment out "RelatesTo" setting after Upgrade CXF to 3.2.6 if (maps.getRelatesTo() == null) { RelatesToType relatesToAttr = new RelatesToType(); relatesToAttr.setRelationshipType("message"); relatesToAttr.setValue(relatesTo); maps.setRelatesTo(relatesToAttr); }*/ }
/** * Construct and store MAPs for partial response. * * @param partialResponse the partial response message * @param namespaceURI the current namespace URI */ private static void ensurePartialResponseMAPs(Message partialResponse, String namespaceURI) { // ensure there is a MAPs instance available for the outbound // partial response that contains appropriate To and ReplyTo // properties (i.e. anonymous & none respectively) AddressingProperties maps = new AddressingProperties(); maps.setTo(EndpointReferenceUtils.getAnonymousEndpointReference()); maps.setReplyTo(ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType()); maps.getReplyTo().setAddress(ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS)); maps.setAction(ContextUtils.getAttributedURI("")); maps.exposeAs(namespaceURI); ContextUtils.storeMAPs(maps, partialResponse, true, true, false); }
/** * Construct and store MAPs for partial response. * * @param partialResponse the partial response message * @param namespaceURI the current namespace URI */ private static void ensurePartialResponseMAPs(Message partialResponse, String namespaceURI) { // ensure there is a MAPs instance available for the outbound // partial response that contains appropriate To and ReplyTo // properties (i.e. anonymous & none respectively) AddressingProperties maps = new AddressingProperties(); maps.setTo(EndpointReferenceUtils.getAnonymousEndpointReference()); maps.setReplyTo(ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType()); maps.getReplyTo().setAddress(ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS)); maps.setAction(ContextUtils.getAttributedURI("")); maps.exposeAs(namespaceURI); ContextUtils.storeMAPs(maps, partialResponse, true, true, false); }
/** * Construct and store MAPs for partial response. * * @param partialResponse the partial response message * @param namespaceURI the current namespace URI */ private static void ensurePartialResponseMAPs(Message partialResponse, String namespaceURI) { // ensure there is a MAPs instance available for the outbound // partial response that contains appropriate To and ReplyTo // properties (i.e. anonymous & none respectively) AddressingProperties maps = new AddressingProperties(); maps.setTo(EndpointReferenceUtils.getAnonymousEndpointReference()); maps.setReplyTo(ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType()); maps.getReplyTo().setAddress(ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS)); maps.setAction(ContextUtils.getAttributedURI("")); maps.exposeAs(namespaceURI); ContextUtils.storeMAPs(maps, partialResponse, true, true, false); }
private CallContext setupCallContext( SoapMessage message, Header callHeader, Header callbackHeader) throws Fault { final AddressingProperties maps = getAddressingProperties(message); if (maps == null) { throw new IllegalStateException( "Request-Callback enabled but no WS-Addressing headers set. "); } CallContext ctx = new CallContext(); message.put(RequestCallbackFeature.CALLCONTEXT_PROPERTY_NAME, ctx); final QName operationName = QName.valueOf(maps.getAction().getValue()); if (!isGenericOperation(operationName)) { ctx.setOperationName(operationName); } ctx.setCallId(valueOf(callHeader)); if (callbackHeader != null) { ctx.setCallbackId(valueOf(callbackHeader)); } ctx.setRequestId(maps.getMessageID().getValue()); ctx.setReplyToAddress(maps.getReplyTo().getAddress().getValue()); ctx.setCorrelationId(getCorrelationId(message)); // Try to get SAM flowId in request message // to store it in CallContext for subsequent use // in callback message if (callbackHeader == null) { setupFlowId(message); } fillCallContext(ctx, message); return ctx; }