/** * Sets the mustUnderstand attribute for this <CODE> SOAPHeaderElement</CODE> object to be on or * off. * <p/> * <P>If the mustUnderstand attribute is on, the actor who receives the * <CODE>SOAPHeaderElement</CODE> must process it correctly. This ensures, for example, that if * the <CODE> SOAPHeaderElement</CODE> object modifies the message, that the message is being * modified correctly.</P> * * @param mustUnderstand <CODE>true</CODE> to set the mustUnderstand attribute on; * <CODE>false</CODE> to turn if off * @throws IllegalArgumentException * if there is a problem in setting the actor. * @see #getMustUnderstand() getMustUnderstand() */ public void setMustUnderstand(boolean mustUnderstand) { this.omTarget.setMustUnderstand(mustUnderstand); }
/** * Sets the mustUnderstand attribute for this <CODE> SOAPHeaderElement</CODE> object to be on or * off. * <p/> * <P>If the mustUnderstand attribute is on, the actor who receives the * <CODE>SOAPHeaderElement</CODE> must process it correctly. This ensures, for example, that if * the <CODE> SOAPHeaderElement</CODE> object modifies the message, that the message is being * modified correctly.</P> * * @param mustUnderstand <CODE>true</CODE> to set the mustUnderstand attribute on; * <CODE>false</CODE> to turn if off * @throws IllegalArgumentException * if there is a problem in setting the actor. * @see #getMustUnderstand() getMustUnderstand() */ public void setMustUnderstand(boolean mustUnderstand) { this.omTarget.setMustUnderstand(mustUnderstand); }
public void toHeader(SOAPHeader header) { SOAPHeaderBlock sequenceAcknowledgementHeaderBlock = header.addHeaderBlock( Sandesha2Constants.WSRM_COMMON.USES_SEQUENCE_STR,Sandesha2Constants.SPEC_2007_02.OM_NS_URI); // This header _must_ always be understood sequenceAcknowledgementHeaderBlock.setMustUnderstand(true); } }
@Override public void setMustUnderstand(boolean mustUnderstand) { getAxiomHeaderBlock().setMustUnderstand(mustUnderstand); }
@Override public void setMustUnderstand(boolean mustUnderstand) { getAxiomHeaderBlock().setMustUnderstand(mustUnderstand); }
@Override public void setMustUnderstand(boolean mustUnderstand) { getAxiomHeaderBlock().setMustUnderstand(mustUnderstand); }
public void setMustUnderstand(boolean mustUnderstand) { getAxiomHeaderBlock().setMustUnderstand(mustUnderstand); }
/** * Sets a mustUnderstand attribute on all headers that are found with the appropriate * addressing namespace. */ private void processMustUnderstandProperty() { if (addMustUnderstandAttribute) { List headers = header.getHeaderBlocksWithNSURI(addressingNamespace); for (int i = 0, size = headers.size(); i < size; i++) { SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock)headers.get(i); soapHeaderBlock.setMustUnderstand(true); if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) { log.trace( "processMustUnderstandProperty: Setting mustUnderstand=true on: " + soapHeaderBlock.getLocalName()); } } } }
protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop, boolean mustUnderstand){ SOAPHeaderBlock soapHeaderBlock = envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),omElementToadd.getNamespace()); soapHeaderBlock.setMustUnderstand(mustUnderstand); OMNode omNode = null; // add child elements for (Iterator iter = omElementToadd.getChildren(); iter.hasNext();){ omNode = (OMNode) iter.next(); iter.remove(); soapHeaderBlock.addChild(omNode); } OMAttribute omatribute = null; // add attributes for (Iterator iter = omElementToadd.getAllAttributes(); iter.hasNext();){ omatribute = (OMAttribute) iter.next(); soapHeaderBlock.addAttribute(omatribute); } }
/** * Creates an <code>Messaging</code> element representing the ebMS SOAP header and adds it to given SOAP envelope * when it does not already exist. If there already is an <code>Messaging</code> element in the SOAP envelope that * one will be returned instead. * * @param env The SOAP envelope in which to add the ebMS header * @return The ebMS 3 Messaging element that is now contained in the SOAP envelope */ public static SOAPHeaderBlock createElement(final org.apache.axiom.soap.SOAPEnvelope env) { // First check if the ebMS header block already exists SOAPHeaderBlock messaging = getElement(env); if( messaging == null) { // No existing messaging element, so create a new one messaging = env.getHeader().addHeaderBlock(Q_ELEMENT_NAME.getLocalPart(), SOAPEnv.getEbms3Namespace(env)); // The messaging header must be understood by the MSH (see 5.2.1 core spec) messaging.setMustUnderstand(true); } return messaging; }
/** * Remove the MustUnderstand header blocks. * @param envelope */ public static SOAPEnvelope removeMustUnderstand(SOAPEnvelope envelope) { if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Enter: SandeshaUtil::removeMustUnderstand"); // you have to explicitely set the 'processed' attribute for header // blocks, since it get lost in the above read from the stream. SOAPHeader header = envelope.getHeader(); if (header != null) { Iterator childrenOfOldEnv = header.getChildElements(); while (childrenOfOldEnv.hasNext()) { SOAPHeaderBlock oldEnvHeaderBlock = (SOAPHeaderBlock) childrenOfOldEnv.next(); QName oldEnvHeaderBlockQName = oldEnvHeaderBlock.getQName(); if (oldEnvHeaderBlockQName != null) { // If we've processed the part and it has a must understand, set it as processed if (oldEnvHeaderBlock.isProcessed() && oldEnvHeaderBlock.getMustUnderstand()) { // Remove the MustUnderstand part oldEnvHeaderBlock.setMustUnderstand(false); } } } } if (LoggingControl.isAnyTracingEnabled() && log.isDebugEnabled()) log.debug("Exit: SandeshaUtil::removeMustUnderstand"); return envelope; }
protected void addHeader(OMElement omElementToadd, SOAPEnvelope envelop, boolean mustUnderstand){ SOAPHeaderBlock soapHeaderBlock = envelop.getHeader().addHeaderBlock(omElementToadd.getLocalName(),omElementToadd.getNamespace()); soapHeaderBlock.setMustUnderstand(mustUnderstand); OMNode omNode = null; // add child elements for (Iterator iter = omElementToadd.getChildren(); iter.hasNext();){ omNode = (OMNode) iter.next(); iter.remove(); soapHeaderBlock.addChild(omNode); } OMAttribute omatribute = null; // add attributes for (Iterator iter = omElementToadd.getAllAttributes(); iter.hasNext();){ omatribute = (OMAttribute) iter.next(); soapHeaderBlock.addAttribute(omatribute); } }
public void toHeader(SOAPHeader header) { if (identifier == null) throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.ackRequestNullID)); SOAPHeaderBlock ackReqHdrBlock = header.addHeaderBlock(Sandesha2Constants.WSRM_COMMON.ACK_REQUESTED, omNamespace); ackReqHdrBlock.setMustUnderstand(isMustUnderstand()); identifier.toOMElement(ackReqHdrBlock, omNamespace); } }
public void toHeader(SOAPHeader header){ if (identifier == null) throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.nullMsgId)); if (messageNumber <= 0 ){ throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.setAValidMsgNumber, Long.toString(messageNumber))); } SOAPHeaderBlock sequenceHeaderBlock = header.addHeaderBlock( Sandesha2Constants.WSRM_COMMON.SEQUENCE, omNamespace); // Always set the MustUnderstand to true for Sequence messages sequenceHeaderBlock.setMustUnderstand(true); identifier.toOMElement(sequenceHeaderBlock, omNamespace); OMElement messageNoElement = sequenceHeaderBlock.getOMFactory().createOMElement(Sandesha2Constants.WSRM_COMMON.MSG_NUMBER,omNamespace); messageNoElement.setText(Long.toString(messageNumber)); sequenceHeaderBlock.addChild(messageNoElement); if (lastMessage){ OMElement lastMessageElement = sequenceHeaderBlock.getOMFactory().createOMElement(Sandesha2Constants.WSRM_COMMON.LAST_MSG, omNamespace); sequenceHeaderBlock.addChild(lastMessageElement); } } }
sequenceAcknowledgementHeaderBlock.setMustUnderstand(false); } else { sequenceAcknowledgementHeaderBlock.setMustUnderstand(true);
/** * Add a new SOAP header to the message. * * @param mustUnderstand the value for the <code>soapenv:mustUnderstand</code> attribute * @param content the XML for the new header * @throws ScriptException if an error occurs when converting the XML to OM */ public void addHeader(boolean mustUnderstand, Object content) throws ScriptException { SOAPHeader header = mc.getEnvelope().getOrCreateHeader(); OMElement element = xmlHelper.toOMElement(content); // We can't add the element directly to the SOAPHeader. Instead, we need to copy the // information over to a SOAPHeaderBlock. SOAPHeaderBlock headerBlock = header.addHeaderBlock(element.getLocalName(), element.getNamespace()); for (Iterator it = element.getAllAttributes(); it.hasNext(); ) { headerBlock.addAttribute((OMAttribute)it.next()); } headerBlock.setMustUnderstand(mustUnderstand); OMNode child = element.getFirstOMChild(); while (child != null) { // Get the next child before addChild will detach the node from its original place. OMNode next = child.getNextOMSibling(); headerBlock.addChild(child); child = next; } }
newSOAPHeader.setMustUnderstand(isMustUnderstand);
newSOAPHeader.setMustUnderstand(isMustUnderstand);
/** * Add a new SOAP header to the message. * * @param mustUnderstand the value for the <code>soapenv:mustUnderstand</code> attribute * @param content the XML for the new header * @throws ScriptException if an error occurs when converting the XML to OM */ public void addHeader(boolean mustUnderstand, Object content) throws ScriptException { SOAPEnvelope envelope = mc.getEnvelope(); SOAPFactory factory = (SOAPFactory) envelope.getOMFactory(); SOAPHeader header = envelope.getHeader(); if (header == null) { header = factory.createSOAPHeader(envelope); } OMElement element = xmlHelper.toOMElement(content); // We can't add the element directly to the SOAPHeader. Instead, we need to copy the // information over to a SOAPHeaderBlock. SOAPHeaderBlock headerBlock = header.addHeaderBlock(element.getLocalName(), element.getNamespace()); for (Iterator it = element.getAllAttributes(); it.hasNext(); ) { headerBlock.addAttribute((OMAttribute) it.next()); } headerBlock.setMustUnderstand(mustUnderstand); OMNode child = element.getFirstOMChild(); while (child != null) { // Get the next child before addChild will detach the node from its original place. OMNode next = child.getNextOMSibling(); headerBlock.addChild(child); child = next; } }
headerBlock.addAttribute((OMAttribute) it.next()); headerBlock.setMustUnderstand(mustUnderstand); OMNode child = element.getFirstOMChild(); while (child != null) {