synCtx.setReplyTo(new EndpointReference(value)); } else if (SynapseConstants.HEADER_RELATES_TO.equals(qName.getLocalPart())) { synCtx.setRelatesTo(new RelatesTo[] { new RelatesTo(value) }); } else { addCustomHeader(synCtx, value);
/** * It is possible for us (Synapse) to cause the creation of a duplicate relatesTo as we * try to hold onto the outgoing message ID even for POX messages using the relates to * Now once we get a response, make sure we remove any trace of this before we proceed any * further * @param mc the message context from which a possibly duplicated relatesTo should be removed * @param relates the existing relatedTo array of the message */ private void removeDuplicateRelatesTo(MessageContext mc, RelatesTo[] relates) { int insertPos = 0; RelatesTo[] newRelates = new RelatesTo[relates.length]; for (RelatesTo current : relates) { boolean found = false; for (int j = 0; j < newRelates.length && j < insertPos; j++) { if (newRelates[j].equals(current) || newRelates[j].getValue().equals(current.getValue())) { found = true; break; } } if (!found) { newRelates[insertPos++] = current; } } RelatesTo[] trimmedRelates = new RelatesTo[insertPos]; System.arraycopy(newRelates, 0, trimmedRelates, 0, insertPos); mc.setRelationships(trimmedRelates); }
private void processRelatesTo() { if (!isAddressingHeaderAlreadyAvailable(WSA_RELATES_TO, true)) { RelatesTo[] relatesTo = messageContextOptions.getRelationships(); if (relatesTo != null) { for (int i = 0, length = relatesTo.length; i < length; i++) { OMElement relatesToHeader = createSOAPHeaderBlock(relatesTo[i].getValue(), WSA_RELATES_TO, relatesTo[i].getExtensibilityAttributes()); String relationshipType = relatesTo[i].getRelationshipType(); if (relatesToHeader != null) { if(!includeOptionalHeaders){ if (Final.WSA_DEFAULT_RELATIONSHIP_TYPE.equals(relationshipType) || Submission.WSA_DEFAULT_RELATIONSHIP_TYPE .equals(relationshipType)) { relationshipType = null; //Omit the attribute. } } if(relationshipType != null){ relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE, relationshipType, null); } } } } } }
private void extractRelatesToInformation(SOAPHeaderBlock soapHeaderBlock, Options messageContextOptions) { String address = soapHeaderBlock.getText(); // Extract the RelationshipType attribute if it exists OMAttribute relationshipType = soapHeaderBlock.getAttribute( new QName(AddressingConstants.WSA_RELATES_TO_RELATIONSHIP_TYPE)); String relationshipTypeString = relationshipType == null ? null : relationshipType.getAttributeValue(); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace("extractRelatesToInformation: Extracted Relationship. Value=" + address + " RelationshipType=" + relationshipTypeString); } RelatesTo relatesTo = new RelatesTo(address, relationshipTypeString); ArrayList attributes = extractAttributesFromSOAPHeaderBlock(soapHeaderBlock); relatesTo.setExtensibilityAttributes(attributes); messageContextOptions.addRelatesTo(relatesTo); // Completed processing of this header soapHeaderBlock.setProcessed(); }
/** * Return a single instance of WS-Addressing RelatesTo that has a relationship * type of either "http://www.w3.org/2005/08/addressing/reply" or "wsa:Reply". * If no such instance of RelatesTo can be found then return <code>null</code>. * * @return an instance of {@link RelatesTo} */ public RelatesTo getRelatesTo() { if (relationships == null && parent != null) { return parent.getRelatesTo(); } if (relationships == null) { return null; } for (int i = 0, size = relationships.size(); i < size; i++) { RelatesTo relatesTo = (RelatesTo) relationships.get(i); String relationshipType = relatesTo.getRelationshipType(); if (relationshipType.equals(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE) || relationshipType .equals(AddressingConstants.Submission.WSA_DEFAULT_RELATIONSHIP_TYPE)) { return relatesTo; } } return null; }
/** * Get WS-Addressing RelatesTo item with a specified type. If there are * multiple RelatesTo items defined with the same type, the one returned * by this method is arbitrary - if you need to handle this case, you can * instead use the {@link #getRelationships()} to retrieve all the items * and check for multiple matches. * * @param type relationship type (URI) * @return item of specified type */ public RelatesTo getRelatesTo(String type) { if (relationships == null && parent != null) { return parent.getRelatesTo(type); } if (relationships == null) { return null; } for (int i = 0, size = relationships.size(); i < size; i++) { RelatesTo relatesTo = (RelatesTo) relationships.get(i); String relationshipType = relatesTo.getRelationshipType(); if (relationshipType.equals(type)) { return relatesTo; } } return null; }
/** * It is possible for us (Synapse) to cause the creation of a duplicate relatesTo as we * try to hold onto the outgoing message ID even for POX messages using the relates to * Now once we get a response, make sure we remove any trace of this before we proceed any * further * @param mc the message context from which a possibly duplicated relatesTo should be removed * @param relates the existing relatedTo array of the message */ private void removeDuplicateRelatesTo(MessageContext mc, RelatesTo[] relates) { int insertPos = 0; RelatesTo[] newRelates = new RelatesTo[relates.length]; for (RelatesTo current : relates) { boolean found = false; for (int j = 0; j < newRelates.length && j < insertPos; j++) { if (newRelates[j].equals(current) || newRelates[j].getValue().equals(current.getValue())) { found = true; break; } } if (!found) { newRelates[insertPos++] = current; } } RelatesTo[] trimmedRelates = new RelatesTo[insertPos]; System.arraycopy(newRelates, 0, trimmedRelates, 0, insertPos); mc.setRelationships(trimmedRelates); }
synCtx.setReplyTo(new EndpointReference(value)); } else if (SynapseConstants.HEADER_RELATES_TO.equals(qName.getLocalPart())) { synCtx.setRelatesTo(new RelatesTo[] { new RelatesTo(value) }); } else { addCustomHeader(synCtx, value);
/** * Return a single instance of WS-Addressing RelatesTo that has a relationship * type of either "http://www.w3.org/2005/08/addressing/reply" or "wsa:Reply". * If no such instance of RelatesTo can be found then return <code>null</code>. * * @return an instance of {@link RelatesTo} */ public RelatesTo getRelatesTo() { if (relationships == null && parent != null) { return parent.getRelatesTo(); } if (relationships == null) { return null; } for (int i = 0, size = relationships.size(); i < size; i++) { RelatesTo relatesTo = (RelatesTo) relationships.get(i); String relationshipType = relatesTo.getRelationshipType(); if (relationshipType.equals(AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE) || relationshipType .equals(AddressingConstants.Submission.WSA_DEFAULT_RELATIONSHIP_TYPE)) { return relatesTo; } } return null; }
public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getAxisOperation(); } } return null; }
axis2Ctx.addRelatesTo(new RelatesTo(axis2Msg.getRelatesToMessageId()));
/** * Get WS-Addressing RelatesTo item with a specified type. If there are * multiple RelatesTo items defined with the same type, the one returned * by this method is arbitrary - if you need to handle this case, you can * instead use the {@link #getRelationships()} to retrieve all the items * and check for multiple matches. * * @param type relationship type (URI) * @return item of specified type */ public RelatesTo getRelatesTo(String type) { if (relationships == null && parent != null) { return parent.getRelatesTo(type); } if (relationships == null) { return null; } for (int i = 0, size = relationships.size(); i < size; i++) { RelatesTo relatesTo = (RelatesTo) relationships.get(i); String relationshipType = relatesTo.getRelationshipType(); if (relationshipType.equals(type)) { return relatesTo; } } return null; }
public AxisService findService(MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getServiceContext().getAxisService(); } } return null; }
RelatesTo relatesTo = new RelatesTo(synCtx.getMessageID()); synCtx.setRelatesTo(new RelatesTo[] { relatesTo });
public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getAxisOperation(); } } return null; }
try { context.getOptions().setRelationships(new RelatesTo[]{new RelatesTo(context.getMessageID())}); context.setProperty("SENDING_FAULT", Boolean.TRUE); msgReceiver.receive(context);
public AxisService findService(MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getServiceContext().getAxisService(); } } return null; }
RelatesTo relatesTo = new RelatesTo(messageContext.getMessageID()); messageContext.setRelatesTo(new RelatesTo[] { relatesTo });