本文整理汇总了Java中org.apache.axiom.soap.SOAPHeader.examineAllHeaderBlocks方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPHeader.examineAllHeaderBlocks方法的具体用法?Java SOAPHeader.examineAllHeaderBlocks怎么用?Java SOAPHeader.examineAllHeaderBlocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axiom.soap.SOAPHeader
的用法示例。
在下文中一共展示了SOAPHeader.examineAllHeaderBlocks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeSOAPHeader
import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
private void removeSOAPHeader(MessageDataSource messageDataSource) throws SOAPException {
SOAPEnvelope soapEnvelope = (SOAPEnvelope) messageDataSource.getDataObject();
SOAPHeader soapHeader = soapEnvelope.getHeader();
if (soapHeader != null) {
for (Iterator iter = soapHeader.examineAllHeaderBlocks(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof SOAPHeaderBlock) {
SOAPHeaderBlock headerBlk = (SOAPHeaderBlock) o;
if (name.equals(headerBlk.getLocalName())) {
headerBlk.detach();
}
} else if (o instanceof OMElement) {
OMElement headerElem = (OMElement) o;
if (name.equals(headerElem.getLocalName())) {
headerElem.detach();
}
}
}
}
}
示例2: invoke
import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
/**
*
* Process the security block from the message context header.
*/
public final InvocationResponse invoke(final MessageContext msgContext) throws AxisFault {
/* Get header */
final SOAPHeader header = msgContext.getEnvelope().getHeader();
if (header != null) {
final Iterator<?> blocks = header.examineAllHeaderBlocks();
while (blocks.hasNext()) {
/* Get header block */
final SOAPHeaderBlock block = (SOAPHeaderBlock) blocks.next();
if (block != null) {
/* Check for security header block */
if (block.getLocalName().equalsIgnoreCase("Security") || block.getLocalName().equalsIgnoreCase("Action")
|| block.getLocalName().equalsIgnoreCase("To")) {
logger.debug("----Inside invoke; found '" + block.getLocalName() + "' header. Marking it processed");
/* Mark it processed to avoid exception at client side */
block.setProcessed();
}
}
}
}
return InvocationResponse.CONTINUE;
}
示例3: getHeadersLogMessage
import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
private String getHeadersLogMessage(CarbonMessage carbonMessage, Reader reader) throws Exception {
StringBuffer sb = new StringBuffer();
MessageDataSource messageDataSource = carbonMessage.getMessageDataSource();
if (messageDataSource == null) {
messageDataSource = reader.makeMessageReadable(carbonMessage);
}
if (messageDataSource.getDataObject() != null && messageDataSource.getDataObject() instanceof OMElement) {
OMElement omElement = (OMElement) messageDataSource.getDataObject();
if (omElement instanceof SOAPEnvelope) {
try {
SOAPHeader header = (SOAPHeader) ((SOAPEnvelope) omElement).getHeader();
if (header != null) {
for (Iterator iter = header.examineAllHeaderBlocks(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof SOAPHeaderBlock) {
SOAPHeaderBlock headerBlk = (SOAPHeaderBlock) o;
sb.append(separator).append(headerBlk.getLocalName()).
append(" : ").append(headerBlk.getText());
} else if (o instanceof OMElement) {
OMElement headerElem = (OMElement) o;
sb.append(separator).append(headerElem.getLocalName()).
append(" : ").append(headerElem.getText());
}
}
}
} catch (Exception e) {
log.error("Exception occurred while processing SOAPHeader", e);
return null;
}
}
}
setCustomProperties(sb, carbonMessage, reader);
return trimLeadingSeparator(sb);
}
示例4: invoke
import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
public InvocationResponse invoke(MessageContext msgContext) {
Integer headerBlockPresent = (Integer) msgContext.getOperationContext().getProperty("HEADER_BLOCK_PRESENT");
if (headerBlockPresent.equals(new Integer(1))) {
SOAPHeader headerAdd = (SOAPHeader) msgContext.getOperationContext().getProperty("HEADER_BLOCK");
Iterator headerBlocks = headerAdd.examineAllHeaderBlocks();
while(headerBlocks.hasNext()){
SOAPHeaderBlock headerBlock=(SOAPHeaderBlock) headerBlocks.next();
msgContext.getEnvelope().getHeader().addChild(headerBlock);
}
} else {
msgContext.getEnvelope().getHeader().discard();
}
return InvocationResponse.CONTINUE;
}