javax.xml.soap.SOAPElement.getElementsByTagNameNS()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中javax.xml.soap.SOAPElement.getElementsByTagNameNS()方法的一些代码示例,展示了SOAPElement.getElementsByTagNameNS()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SOAPElement.getElementsByTagNameNS()方法的具体详情如下:
包路径:javax.xml.soap.SOAPElement
类名称:SOAPElement
方法名:getElementsByTagNameNS

SOAPElement.getElementsByTagNameNS介绍

暂无

代码示例

代码示例来源:origin: com.hynnet/xws-security

public NodeList getElementsByTagNameNS(String arg0, String arg1) {
  return delegateElement.getElementsByTagNameNS(arg0, arg1);
}

代码示例来源:origin: com.hynnet/xws-security

public NodeList getElementsByTagNameNS(String namespaceURI, String localName) throws DOMException {
  return delegateElement.getElementsByTagNameNS(namespaceURI, localName);
}

代码示例来源:origin: com.hynnet/xws-security

public NodeList getElementsByTagNameNS(String arg0, String arg1) {
  return delegateElement.getElementsByTagNameNS(arg0, arg1);
}

代码示例来源:origin: com.hynnet/xws-security

public NodeList getElementsByTagNameNS(String arg0, String arg1) {
  return delegateHeader.getElementsByTagNameNS(arg0, arg1);
}

代码示例来源:origin: fcrepo3/fcrepo

private SOAPElement getSOAPNode(SOAPMessageContext context, QName operation) {
  SOAPMessage message = context.getMessage();
  SOAPBody body;
  try {
    body = message.getSOAPBody();
  } catch (SOAPException e) {
    throw CXFUtility.getFault(e);
  }
  SOAPElement bodyElement = body;
  if (bodyElement.getNamespaceURI().equals("http://schemas.xmlsoap.org/soap/envelope/")
      && bodyElement.getLocalName().equals("Body")){
    bodyElement = (SOAPElement)bodyElement.getElementsByTagNameNS(operation.getNamespaceURI(), operation.getLocalPart()).item(0);
  }
  if (logger.isDebugEnabled() && bodyElement != null) {
    logger.debug("Operation: {} {}", operation.getNamespaceURI(), operation.getLocalPart());
  }
  return bodyElement;
}

代码示例来源:origin: com.hynnet/xws-security

static boolean isSecondaryHeaderElement(SOAPElement element) {
  if ( element.getLocalName().equals(MessageConstants.ENCRYPTEDKEY_LNAME)) {
    NodeList nl = element.getElementsByTagNameNS(MessageConstants.XENC_NS, MessageConstants.XENC_REFERENCE_LIST_LNAME);
    if ( nl.getLength() == 0 ) {
      return true;
    }
  }
  return (element.getLocalName().equals(MessageConstants.WSSE_BINARY_SECURITY_TOKEN_LNAME) ||
      element.getLocalName().equals(MessageConstants.USERNAME_TOKEN_LNAME) ||
      element.getLocalName().equals(MessageConstants.SAML_ASSERTION_LNAME) ||
      element.getLocalName().equals(MessageConstants.TIMESTAMP_LNAME) ||
      element.getLocalName().equals(MessageConstants.SIGNATURE_CONFIRMATION_LNAME) ||
      element.getLocalName().equals(MessageConstants.WSSE_SECURITY_TOKEN_REFERENCE_LNAME) ||
      element.getLocalName().equals(MessageConstants.DERIVEDKEY_TOKEN_LNAME) ||
      element.getLocalName().equals(MessageConstants.SECURITY_CONTEXT_TOKEN_LNAME));
}

代码示例来源:origin: com.hynnet/xws-security

NodeList nodeList = encDataElement.getElementsByTagNameNS(MessageConstants.XENC_NS,"EncryptionMethod");
if(nodeList.getLength() <= 0){
  return MessageConstants.TRIPLE_DES_BLOCK_ENCRYPTION;

代码示例来源:origin: com.hynnet/xws-security

/**
 * @throws XWSSecurityException
 *     If the given element does not have an appropriate name.
 */
public ReferenceListHeaderBlock(SOAPElement element)
  throws XWSSecurityException {
  super(element);
  if (!(element.getLocalName().equals("ReferenceList") &&
     XMLUtil.inEncryptionNS(element))) {
    log.log(Level.SEVERE, "WSS0362.error.creating.rlhb", element.getTagName());
    throw new XWSSecurityException("Invalid ReferenceList passed");
  }
  ownerDoc = element.getOwnerDocument();
  size =
    element.getElementsByTagNameNS(MessageConstants.XENC_NS, "DataReference").getLength();
}

代码示例来源:origin: com.hynnet/xws-security

public Key getSecretKey(Key privKey, String dataEncAlgo) throws XWSSecurityException {
  try {
    XMLCipher xmlc = null;
    String algorithm = null;
    if(elem != null){
      NodeList nl = elem.getElementsByTagNameNS(MessageConstants.XENC_NS, "EncryptionMethod");
      if (nl != null)
        algorithm = ((Element)nl.item(0)).getAttribute("Algorithm");
      xmlc = XMLCipher.getInstance(algorithm); 
      if ( encryptedKey == null)
        encryptedKey = xmlc.loadEncryptedKey(elem);
    }
    if (xmlc == null){
      throw new XWSSecurityException("XMLCipher is null while getting SecretKey from EncryptedKey");
    }
    xmlc.init(XMLCipher.UNWRAP_MODE, privKey);
    SecretKey symmetricKey = (SecretKey) xmlc.decryptKey(encryptedKey, dataEncAlgo);
    return symmetricKey;
  } catch (Exception ex) {
    ex.printStackTrace();
    throw new XWSSecurityException("Error while getting SecretKey from EncryptedKey");
  }
}

代码示例来源:origin: com.hynnet/xws-security

public SOAPElement getCipherReference(boolean create, String uri) throws XWSSecurityException {
  SOAPElement cipherReference = null;
  if (create) { 
    try {
      cipherReference =
        getSoapFactory().createElement(
          "CipherReference",
          MessageConstants.XENC_PREFIX,
          MessageConstants.XENC_NS);
      cipherReference.setAttribute("URI", uri);
      getCipherData(create).addChildElement(cipherReference);
    } catch (SOAPException e) {
      // log
      throw new XWSSecurityException(e);
    }
  } else {
    if (cipherData == null) {
      // log
      throw new XWSSecurityException("CipherData is not present");
    } 
    // need to check
    //Iterator i = cipherData.getChildElements();  
    //cipherReference = (SOAPElement)i.next();
    NodeList nl =  cipherData.getElementsByTagNameNS(MessageConstants.XENC_NS, "CipherReference");
    if(nl.getLength() > 0)return (SOAPElement)nl.item(0);
  }
  return cipherReference; 
}

代码示例来源:origin: com.hynnet/xws-security

SOAPElement securityHeader = secureMsg.findSecurityHeader();
NodeList uList = securityHeader.getElementsByTagNameNS(MessageConstants.WSSE_NS, MessageConstants.USERNAME_TOKEN_LNAME);
if(uList.getLength() >1){
  log.log(Level.SEVERE, "WSS0259.invalid.SEC.username");
NodeList tList = securityHeader.getElementsByTagNameNS(MessageConstants.WSU_NS, MessageConstants.TIMESTAMP_LNAME);
if(tList.getLength() >1){
  log.log(Level.SEVERE, "WSS0274.invalid.SEC.Timestamp");

相关文章

微信公众号

最新文章

更多