/** * Construct the Action URI. * * @param message the current message * @return the Action URI */ public static AttributedURIType getAction(Message message) { String action = null; LOG.fine("Determining action"); Exception fault = message.getContent(Exception.class); if (fault instanceof Fault && Names.WSA_NAMESPACE_NAME.equals(((Fault)fault).getFaultCode().getNamespaceURI())) { // wsa relevant faults should use the wsa-fault action value action = Names.WSA_DEFAULT_FAULT_ACTION; } else { FaultAction annotation = null; if (fault != null) { annotation = fault.getClass().getAnnotation(FaultAction.class); } if ((annotation != null) && (annotation.value() != null)) { action = annotation.value(); } else { action = getActionFromServiceModel(message, fault); } } if (LOG.isLoggable(Level.FINE)) { LOG.fine("action: " + action); } return action != null ? ContextUtils.getAttributedURI(action) : null; }
/** * Construct the Action URI. * * @param message the current message * @return the Action URI */ public static AttributedURIType getAction(Message message) { String action = null; LOG.fine("Determining action"); Exception fault = message.getContent(Exception.class); if (fault instanceof Fault && Names.WSA_NAMESPACE_NAME.equals(((Fault)fault).getFaultCode().getNamespaceURI())) { // wsa relevant faults should use the wsa-fault action value action = Names.WSA_DEFAULT_FAULT_ACTION; } else { FaultAction annotation = null; if (fault != null) { annotation = fault.getClass().getAnnotation(FaultAction.class); } if ((annotation != null) && (annotation.value() != null)) { action = annotation.value(); } else { action = getActionFromServiceModel(message, fault); } } if (LOG.isLoggable(Level.FINE)) { LOG.fine("action: " + action); } return action != null ? ContextUtils.getAttributedURI(action) : null; }
private void marshallFrom(String from, Element header, Marshaller marshaller) throws JAXBException { if (Names.WSA_NAMESPACE_NAME.equals(currentNamespaceURI)) { String u = "urn:piggyback_responder"; AttributedURIType value = org.apache.cxf.ws.addressing.ContextUtils.getAttributedURI(u); marshaller.marshal( new JAXBElement<AttributedURIType>(Names.WSA_FROM_QNAME, AttributedURIType.class, value), header); } else if (Names200408.WSA_NAMESPACE_NAME.equals( currentNamespaceURI)) { AttributedURI value = Names200408.WSA_OBJECT_FACTORY.createAttributedURI(); value.setValue(from); QName qname = new QName(Names200408.WSA_NAMESPACE_NAME, Names.WSA_FROM_NAME); marshaller.marshal( new JAXBElement<AttributedURI>(qname, AttributedURI.class, value), header); } }
/** * 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); }
/** * Assemble the generic MAPs (for both requests and responses). * * @param message the current message * @return AddressingProperties containing the generic MAPs */ private AddressingProperties assembleGeneric(Message message) { AddressingProperties maps = getMAPs(message, true, true); // MessageID if (maps.getMessageID() == null) { String messageID = ContextUtils.generateUUID(); maps.setMessageID(ContextUtils.getAttributedURI(messageID)); } // Action if (ContextUtils.hasEmptyAction(maps)) { maps.setAction(InternalContextUtils.getAction(message)); if (ContextUtils.hasEmptyAction(maps) && ContextUtils.isOutbound(message)) { maps.setAction(ContextUtils.getAttributedURI(getActionUri(message, true))); } } return maps; }
/** * Assemble the generic MAPs (for both requests and responses). * * @param message the current message * @return AddressingProperties containing the generic MAPs */ private AddressingProperties assembleGeneric(Message message) { AddressingProperties maps = getMAPs(message, true, true); // MessageID if (maps.getMessageID() == null) { String messageID = ContextUtils.generateUUID(); maps.setMessageID(ContextUtils.getAttributedURI(messageID)); } // Action if (ContextUtils.hasEmptyAction(maps)) { maps.setAction(InternalContextUtils.getAction(message)); if (ContextUtils.hasEmptyAction(maps) && ContextUtils.isOutbound(message)) { maps.setAction(ContextUtils.getAttributedURI(getActionUri(message, true))); } } return maps; }
ContextUtils.getAttributedURI(Names.WSA_ANONYMOUS_ADDRESS); EndpointReferenceType replyTo = ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType();
ContextUtils.getAttributedURI(Names.WSA_ANONYMOUS_ADDRESS); EndpointReferenceType replyTo = ContextUtils.WSA_OBJECT_FACTORY.createEndpointReferenceType();
/** * check if MessageID exists in the message, if not, only generate new MessageID for outbound message. * @param message */ private void checkMessageID(Message message) { if (!MessageUtils.isOutbound(message)) return; AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, MessageUtils.isOutbound(message)); if (maps == null) { maps = new AddressingProperties(); } if (maps.getMessageID() == null) { String messageID = ContextUtils.generateUUID(); boolean isRequestor = ContextUtils.isRequestor(message); maps.setMessageID(ContextUtils.getAttributedURI(messageID)); ContextUtils.storeMAPs(maps, message, ContextUtils.isOutbound(message), isRequestor); } }
/** * check if MessageID exists in the message, if not, only generate new MessageID for outbound message. * @param message */ private void checkMessageID(Message message) { if (!MessageUtils.isOutbound(message)) return; AddressingProperties maps = ContextUtils.retrieveMAPs(message, false, MessageUtils.isOutbound(message)); if (maps == null) { maps = new AddressingProperties(); } if (maps.getMessageID() == null) { String messageID = ContextUtils.generateUUID(); boolean isRequestor = ContextUtils.isRequestor(message); maps.setMessageID(ContextUtils.getAttributedURI(messageID)); ContextUtils.storeMAPs(maps, message, ContextUtils.isOutbound(message), isRequestor); } }
AddressingProperties maps = new AddressingProperties(); AttributedURIType id = ContextUtils.getAttributedURI(msgId); maps.setMessageID(id); requestContext.put(CLIENT_ADDRESSING_PROPERTIES, maps);
replyTo.getAddress().getValue())))) { AttributedURIType address = ContextUtils.getAttributedURI(isOneway ? Names.WSA_NONE_ADDRESS : Names.WSA_ANONYMOUS_ADDRESS); maps.setAction(ContextUtils.getAttributedURI( Names.WSA_DEFAULT_FAULT_ACTION));
replyTo.getAddress().getValue())))) { AttributedURIType address = ContextUtils.getAttributedURI(isOneway ? Names.WSA_NONE_ADDRESS : Names.WSA_ANONYMOUS_ADDRESS); maps.setAction(ContextUtils.getAttributedURI( Names.WSA_DEFAULT_FAULT_ACTION));