当前位置: 首页>>代码示例>>Java>>正文


Java SOAPHeader.examineAllHeaderBlocks方法代码示例

本文整理汇总了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();
                    }
                }
            }
        }
    }
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:22,代码来源:HeaderMediator.java

示例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;
}
 
开发者ID:inbravo,项目名称:scribe,代码行数:35,代码来源:MSSOAPMustUnderstandHandler.java

示例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);
}
 
开发者ID:wso2-attic,项目名称:carbon-gateway-framework,代码行数:37,代码来源:LogMediator.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:15,代码来源:SOAP12OutFaultFlowHandlerDefault.java


注:本文中的org.apache.axiom.soap.SOAPHeader.examineAllHeaderBlocks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。