本文整理汇总了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());
}
示例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;
}
示例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;
}