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


Java SOAPHeader.getHeaderBlocksWithNSURI方法代码示例

本文整理汇总了Java中org.apache.axiom.soap.SOAPHeader.getHeaderBlocksWithNSURI方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPHeader.getHeaderBlocksWithNSURI方法的具体用法?Java SOAPHeader.getHeaderBlocksWithNSURI怎么用?Java SOAPHeader.getHeaderBlocksWithNSURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axiom.soap.SOAPHeader的用法示例。


在下文中一共展示了SOAPHeader.getHeaderBlocksWithNSURI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCreateElement

import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
@Test
public void testCreateElement() throws Exception {
    // Creating SOAP envelope
    SOAPEnvelope env = SOAPEnv.createEnvelope(SOAPEnv.SOAPVersion.SOAP_12);
    // Adding header
    Messaging.createElement(env);

    // Check if header contains Messaging header block with mustUnderstand=true
    SOAPHeader header = env.getHeader();
    ArrayList blocks = header.getHeaderBlocksWithNSURI(EbMSConstants.EBMS3_NS_URI);
    assertTrue(blocks.size()>0);
    assertTrue(((SOAPHeaderBlock) blocks.get(0)).getMustUnderstand());
}
 
开发者ID:holodeck-b2b,项目名称:Holodeck-B2B,代码行数:14,代码来源:MessagingTest.java

示例2: extractHeader

import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
private Map<String, String> extractHeader() {
    Map<String, String> map = new HashMap<String, String>();
    SOAPHeader header = MessageContext.getCurrentMessageContext().getEnvelope().getHeader();
    List<OMElement> elementList =
            header.getHeaderBlocksWithNSURI(DiscoveryConstants.DISCOVERY_HEADER_ELEMENT_NAMESPACE);
    for (OMElement element : elementList) {
        map.put(element.getLocalName(), element.getText());
    }
    return map;
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:11,代码来源:DiscoveryProxy.java

示例3: isHandle

import org.apache.axiom.soap.SOAPHeader; //导入方法依赖的package包/类
@Override
public boolean isHandle(MessageContext msgCxt) {
    boolean canHandle = false;

    if (!isDisabled()) {

        if (!authenticatorInitialized) {
            init();
            if (!authenticatorInitialized) {
                return canHandle;
            }
        }

        HttpServletRequest request = (HttpServletRequest) msgCxt.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
        String authorizationHeader = request.getHeader(HTTPConstants.HEADER_AUTHORIZATION);
        // This authenticator should kickin only if authorization headers are null
        if (authorizationHeader == null) {
            Object certObject = request.getAttribute(JAVAX_SERVLET_REQUEST_CERTIFICATE);
            if (certObject != null) {
                SOAPEnvelope envelope = msgCxt.getEnvelope();
                SOAPHeader header = envelope.getHeader();
                boolean validHeader = false;

                if (header != null) {
                    List<SOAPHeaderBlock> headers = header.getHeaderBlocksWithNSURI(MUTUAL_SSL_URL);
                    if (headers != null) {
                        for (SOAPHeaderBlock soapHeaderBlock : headers) {
                            if (usernameHeaderName.equals(soapHeaderBlock.getLocalName())) {
                                //Username can be in SOAP Header
                                canHandle = true;
                                validHeader = true;
                                break;
                            }
                        }
                    }
                }

                if (!canHandle && StringUtils.isNotEmpty(request.getHeader(usernameHeaderName))) {
                    validHeader = true;
                    // Username is received in HTTP Header
                    canHandle = true;
                }

                if (!validHeader && log.isDebugEnabled()) {
                    log.debug("'" + usernameHeaderName + "'" + " header is not received in HTTP or SOAP header");
                }

            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Server is not picking up the client certificate. Mutual SSL authentication is not" +
                            "done");
                }
            }
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("MutualSSLAuthenticator is Disabled.");
        }
    }
    return canHandle;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:62,代码来源:MutualSSLAuthenticator.java


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