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

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

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

SOAPElement.getOwnerDocument介绍

暂无

代码示例

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

public Document getOwnerDocument() {
  return delegateHeader.getOwnerDocument();
}

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

public Document getOwnerDocument() {
  return delegateElement.getOwnerDocument();
}

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

public Document getOwnerDocument() {
  return delegateElement.getOwnerDocument();
}

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

public Document getOwnerDocument() {
  return delegateElement.getOwnerDocument();
}

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

public SecurityHeader(SOAPElement delegateHeader) {
  this.delegateHeader = delegateHeader;
  this.ownerDoc = delegateHeader.getOwnerDocument();
  topMostSoapElement = getFirstChildElement();
  currentSoapElement = null;
}

代码示例来源:origin: org.jboss.ws.native/jbossws-native-core

public void setValue(QName qName, ElementBinding element, Object owner, Object value)
 {
   SOAPElement e = (SOAPElement)owner;
   Text textNode = e.getOwnerDocument().createTextNode((String)value);
   e.appendChild(textNode);
 }
}

代码示例来源:origin: org.jboss.ws.native/jbossws-native-core

private void appendCommentNode(SOAPElement soapElement, Node child)
{
 String nodeValue = child.getNodeValue();
 Document ownerDoc = soapElement.getOwnerDocument();
 Comment comment = ownerDoc.createComment(nodeValue);
 soapElement.appendChild(comment);
}

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

/**
 * Constructs a SAML <code>Assertion</code> header block from an existing
 * <code>SOAPElement</code>.
 *
 * @param element an existing SAML assertion element.
 * @throws XWSSecurityException when the element is not a valid template
 *         for a SAML <code>Assertion</code>.
 */
public SamlAssertionHeaderBlock(SOAPElement element)
throws XWSSecurityException {
  contextDocument_ = element.getOwnerDocument();
  
  delegateAssertion_ = element;
  
  
  setSOAPElement(element);
}

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

public SOAPElement makeUsable(SOAPElement elem)throws XWSSecurityException {          
  SOAPElement elementToInsert = elem;
  try {
    if (elem.getOwnerDocument() != ownerDoc) {
      elementToInsert =
      (SOAPElement) ownerDoc.importNode(
      elem, true);
    }            
    return elementToInsert;
  } catch (DOMException e) {
    log.log(Level.SEVERE, "WSS0376.error.inserting.header", e.getMessage());
    throw new XWSSecurityException(e);
  }
}
public Node cloneNode(boolean arg0) {

代码示例来源:origin: apache/servicemix-bundles

private  SOAPElement convertToSoapElement(Element element) throws SOAPException {
  if (element instanceof SOAPElement) {
    return (SOAPElement) element;
  } 
  SOAPElement copy = createElement(
              element.getLocalName(), 
              element.getPrefix(),
              element.getNamespaceURI());
  Document ownerDoc = copy.getOwnerDocument();
  NamedNodeMap attrMap = element.getAttributes();
  for (int i=0; i < attrMap.getLength(); i++) {
    Attr nextAttr = (Attr)attrMap.item(i);
    Attr importedAttr = (Attr)ownerDoc.importNode(nextAttr, true);
    copy.setAttributeNodeNS(importedAttr);
  }
  NodeList nl = element.getChildNodes();
  for (int i=0; i < nl.getLength(); i++) {
    org.w3c.dom.Node next = nl.item(i);
    org.w3c.dom.Node imported = ownerDoc.importNode(next, true);
    copy.appendChild(imported);
  }
  
  return copy;
}

代码示例来源:origin: org.apache.ws.commons.axiom/saaj-testsuite

@Override
  protected void runTest() throws Throwable {
    Document doc = newSOAPFactory().createElement(new QName("test")).getOwnerDocument();
    assertThat(doc).isNotInstanceOf(SOAPPart.class);
    assertThat(doc).isNotInstanceOf(javax.xml.soap.Node.class);
    assertThat(doc.createElementNS(null, "test")).isInstanceOf(SOAPElement.class);
  }
}

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

/**
 * parse and create the KeyInfo element
 * @param element the KeyInfo element
 * NOTE : this constructor assumes a fully initialized XML KeyInfo
 * No additions are allowed on the keyinfo, only we can get existing
 * values. For example addkeyName() will have no impact on the KeyInfo
 * will not append a KeyName child to the KeyInfo.
 */
public KeyInfoHeaderBlock(SOAPElement element) throws XWSSecurityException {
  super(element);
  try {
    // The BaseURI in Apache KeyInfo is seems optional
    // However the purpose of it is not clear
    this.document = element.getOwnerDocument();
    delegateKeyInfo = 
      new KeyInfo(element,baseURI);
  } catch (XMLSecurityException e) {
    log.log(
      Level.SEVERE,
      "WSS0318.exception.while.creating.keyinfoblock",
      e);
   throw new XWSSecurityException(e); 
  }
}

代码示例来源:origin: org.apache.ws.commons.axiom/saaj-testsuite

@Override
  protected void runTest() throws Throwable {
    SOAPElement parent = newSOAPFactory().createElement(new QName("parent"));
    SOAPElement child1 = parent.addChildElement(new QName("child1"));
    SOAPElement child2 = (SOAPElement)parent.getOwnerDocument().createElementNS(null, "child2");
    child2.setParentElement(parent);
    NodeList children = parent.getChildNodes();
    assertEquals(2, children.getLength());
    assertSame(child1, children.item(0));
    assertSame(child2, children.item(1));
  }
}

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

/** 
 * parse and create the Signature element
 * @param elem the element representing an XML Signature
 * NOTE : this constructor assumes a fully initialized XML Signature
 * No modifications are allowed on the signature, We can only get existing
 * values. For example appendObject() would throw an Exception. If
 * a KeyInfo was not present in the signature, then calling getKeyInfo()
 * will not append a KeyInfo child to the signature.
 */
public SignatureHeaderBlock(SOAPElement elem) throws XWSSecurityException {
  super(elem);
  try {
    this.document = elem.getOwnerDocument();
    delegateSignature = new XMLSignature(elem, null);
  } catch (Exception e) {
    // add log here
    log.log(
      Level.SEVERE, 
      "WSS0322.exception.creating.signatureblock",
      e);    
    throw new XWSSecurityException(e);
  }       
}

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

public void insertBefore(SecurityHeaderBlock block,Node elem) throws XWSSecurityException {
  SOAPElement elementToInsert = block.getAsSoapElement();
  try {
    if (elementToInsert.getOwnerDocument() != ownerDoc) {
      elementToInsert =
      (SOAPElement) ownerDoc.importNode(
      elementToInsert, true);
    }
  } catch (DOMException e) {
    log.log(Level.SEVERE, "WSS0376.error.inserting.header", e.getMessage());
    throw new XWSSecurityException(e);
  }
  insertBefore(elementToInsert,elem);
}

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

public void insertHeaderBlockElement(SOAPElement blockElement)
throws XWSSecurityException {
  try {
    if (blockElement.getOwnerDocument() != ownerDoc) {
      blockElement =
      (SOAPElement) ownerDoc.importNode(blockElement, true);
    }
    updateTopMostSoapElement();
    
    insertBefore(blockElement, topMostSoapElement);
    
  } catch (DOMException e) {
    log.log(Level.SEVERE, "WSS0376.error.inserting.header", e.getMessage());
    throw new XWSSecurityException(e);
  }
  topMostSoapElement = blockElement;
}

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

public void appendChild(SecurityHeaderBlock block) throws XWSSecurityException {
  SOAPElement elementToInsert = block.getAsSoapElement();
  try {
    if (elementToInsert.getOwnerDocument() != ownerDoc) {
      elementToInsert =
      (SOAPElement) ownerDoc.importNode(
      elementToInsert, true);
    }
    appendChild(elementToInsert);
    
  } catch (DOMException e) {
    log.log(Level.SEVERE, "WSS0376.error.inserting.header", e.getMessage());
    throw new XWSSecurityException(e);
  }
}

代码示例来源: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

/**
 * Inserts the header block at the top of the security header, i.e,
 * the block becomes the first child element of the security header.
 * This method will be used on the sender side.
 */
public void insertHeaderBlock(SecurityHeaderBlock block)
throws XWSSecurityException {
  SOAPElement elementToInsert = block.getAsSoapElement();
  try {
    if (elementToInsert.getOwnerDocument() != ownerDoc) {
      elementToInsert =
      (SOAPElement) ownerDoc.importNode(
      elementToInsert, true);
    }
    
    updateTopMostSoapElement();
    
    insertBefore(elementToInsert, topMostSoapElement);
  } catch (DOMException e) {
    log.log(Level.SEVERE, "WSS0376.error.inserting.header", e.getMessage());
    throw new XWSSecurityException(e);
  }
  topMostSoapElement = elementToInsert;
}

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

/**
 * Creates an empty ReferenceList element.
 *
 * @throws XWSSecurityException
 *     If there is problem creating a ReferenceList element.
 */
public ReferenceListHeaderBlock() throws XWSSecurityException {
  try {
    setSOAPElement(
      getSoapFactory().createElement(
        "ReferenceList",
        MessageConstants.XENC_PREFIX,
        MessageConstants.XENC_NS));
    addNamespaceDeclaration(
      MessageConstants.XENC_PREFIX,
      MessageConstants.XENC_NS);
  } catch (SOAPException e) {
    log.log(Level.SEVERE, "WSS0360.error.creating.rlhb", e.getMessage());
    throw new XWSSecurityException(e);
  }
  ownerDoc = getAsSoapElement().getOwnerDocument();
}

相关文章

微信公众号

最新文章

更多