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

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

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

SOAPElement.removeNamespaceDeclaration介绍

[英]Removes the namespace declaration corresponding to the given prefix.
[中]删除与给定前缀对应的命名空间声明。

代码示例

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

public boolean removeNamespaceDeclaration(String arg0) {
  return delegateElement.removeNamespaceDeclaration(arg0);
}

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

public boolean removeNamespaceDeclaration(String arg0) {
  return delegateElement.removeNamespaceDeclaration(arg0);
}

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

public boolean removeNamespaceDeclaration(String string) {
  return delegateElement.removeNamespaceDeclaration(string);
}

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

public boolean removeNamespaceDeclaration(String arg0) {
  return delegateHeader.removeNamespaceDeclaration(arg0);
}

代码示例来源:origin: org.apache.cxf/cxf-rt-bindings-soap

public static Element adjustPrefix(Element e, String prefix) {
    if (prefix == null) {
      prefix = "";
    }
    try {
      String s = e.getPrefix();
      if (!prefix.equals(s)) {
        e.setPrefix(prefix);
        if (e instanceof SOAPElement) {
          ((SOAPElement)e).removeNamespaceDeclaration(s);
        } else if (e.getClass().getName().equals(
            "com.sun.org.apache.xerces.internal.dom.ElementNSImpl")) {
          //since java9 159 SOAPPart1_1Impl.getDocumentElement not return SOAPElement
          try {
            Method method = e.getClass().getMethod("removeAttribute", String.class);
            method.invoke(e, "xmlns:" + s);
          } catch (Exception ex) {
            ex.printStackTrace();
          }

        }
      }
    } catch (Throwable t) {
      //likely old old version of SAAJ, we'll just try our best
    }
    return e;
  }
}

代码示例来源:origin: apache/cxf

public static Element adjustPrefix(Element e, String prefix) {
    if (prefix == null) {
      prefix = "";
    }
    try {
      String s = e.getPrefix();
      if (!prefix.equals(s)) {
        e.setPrefix(prefix);
        if (e instanceof SOAPElement) {
          ((SOAPElement)e).removeNamespaceDeclaration(s);
        } else if (e.getClass().getName().equals(
            "com.sun.org.apache.xerces.internal.dom.ElementNSImpl")) {
          //since java9 159 SOAPPart1_1Impl.getDocumentElement not return SOAPElement
          try {
            Method method = e.getClass().getMethod("removeAttribute", String.class);
            method.invoke(e, "xmlns:" + s);
          } catch (Exception ex) {
            ex.printStackTrace();
          }

        }
      }
    } catch (Throwable t) {
      //likely old old version of SAAJ, we'll just try our best
    }
    return e;
  }
}

代码示例来源:origin: stackoverflow.com

body.removeNamespaceDeclaration(UNWANTED_NS_PREFIX);
  body.addNamespaceDeclaration(DESIRED_NS_PREFIX, DESIRED_NS_URI); 
} catch (SOAPException ex) {

代码示例来源:origin: stackoverflow.com

tUserTokenElement.removeNamespaceDeclaration("wsse");
tUserTokenElement.addNamespaceDeclaration("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
tUsernameElement.removeNamespaceDeclaration("wsse");
tUsernameElement.addTextNode(iUsername);
tPasswordElement.removeNamespaceDeclaration("wsse");
tPasswordElement.addTextNode(iPassword);
tPasswordElement.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");

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

public void setCipherValue(String cipherValue)
  throws XWSSecurityException {
  try {
    cipherData =
      getSoapFactory().createElement(
        "CipherData",
        MessageConstants.XENC_PREFIX,
        MessageConstants.XENC_NS);
    cipherData.addNamespaceDeclaration(
      MessageConstants.XENC_PREFIX,
      MessageConstants.XENC_NS);
    cipherData.addTextNode("\n    ");
    SOAPElement cipherValueElement =
      cipherData.addChildElement(
        "CipherValue", MessageConstants.XENC_PREFIX);
    cipherData.addTextNode("\n    ");
    cipherValueElement.addTextNode(cipherValue);
    cipherData.removeNamespaceDeclaration(
      MessageConstants.XENC_PREFIX);
  } catch (SOAPException e) {
    log.log(Level.SEVERE, "WSS0350.error.setting.ciphervalue", e.getMessage());
    throw new XWSSecurityException(e);
  }
  updateRequired = true;
}

相关文章

微信公众号

最新文章

更多