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

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

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

SOAPElement.setAttribute介绍

暂无

代码示例

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

public void setAttribute(String arg0, String arg1) throws DOMException {
  delegateElement.setAttribute(arg0, arg1);
}

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

public void setAttribute(String arg0, String arg1) throws DOMException {
  delegateElement.setAttribute(arg0, arg1);
}

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

public void setAttribute(String name, String value) throws DOMException {
  delegateElement.setAttribute(name, value);                
}

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

public void setAttribute(String arg0, String arg1) throws DOMException {
  delegateHeader.setAttribute(arg0, arg1);
}

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

/** Set the qname value to the specified attribute of the given element.
* @param value a namespace qualified name; its namespace name MUST NOT be empty
*/
public static void setQualifiedAttributeValue(SOAPElement element, String attributeName, QName value) throws SOAPException
{
 String prefix = ensureNamespaceDeclared(element, value.getPrefix(), value.getNamespaceURI());
 element.setAttribute(attributeName, prefix + ':' + value.getLocalPart());
}

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

public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx)
{
  SOAPFactory factory = getFactory();
  SOAPElement element = null;
  try
  {
   String prefix = elementName.getPrefix();
   String ns = elementName.getNamespaceURI();
   if (ns != null && ns.length() > 0)
   {
     prefix = nsCtx.getPrefix(ns);
   }
   element = factory.createElement(elementName.getLocalPart(), prefix, ns);
  }
  catch (SOAPException e)
  {
   throw new IllegalStateException(e);
  }
  if (attrs != null)
  {
   for (int i = 0; i < attrs.getLength(); ++i)
   {
     element.setAttribute(attrs.getLocalName(i), attrs.getValue(i));
   }
  }
  return element;
}

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

SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new PrefixedQName("http://schemas.xmlsoap.org/ws/2002/07/secext","Security", "wsse"));
     wsseSecurity.setMustUnderstand(false);
     wsseSecurity.setActor(null);
     SOAPElement sub = wsseSecurity.addChildElement("UsernameToken");
     sub.setAttribute("xmlns:wsu", "http://schemas.xmlsoap.org/ws/2002/07/utility");
     SOAPElement userElement = sub.addChildElement("Username");
     userElement.addTextNode("XYZ");         
     SOAPElement pwdElement = sub.addChildElement("Password");
     pwdElement.setAttribute("Type", "wsse:PasswordText");
     pwdElement.addTextNode("security");
     _stub.setHeader(wsseSecurity);

代码示例来源:origin: com.sun.xml.ws/rt

private static void addHeader(Message m, Set<QName> notUnderstoodHeaders) throws SOAPException {
    for (QName qname : notUnderstoodHeaders) {
      SOAPElement soapEl = SOAP_12.getSOAPFactory().createElement(MU_HEADER_DETAIL);
      soapEl.addNamespaceDeclaration("abc", qname.getNamespaceURI());
      soapEl.setAttribute("qname", "abc:" + qname.getLocalPart());
      Header header = new DOMHeader<Element>(soapEl);
      m.getHeaders().add(header);
    }
  }
}

代码示例来源:origin: com.sun.xml.ws/jaxws-rt

private static void addHeader(Message m, Set<QName> notUnderstoodHeaders) throws SOAPException {
    for (QName qname : notUnderstoodHeaders) {
      SOAPElement soapEl = SOAP_12.getSOAPFactory().createElement(MU_HEADER_DETAIL);
      soapEl.addNamespaceDeclaration("abc", qname.getNamespaceURI());
      soapEl.setAttribute("qname", "abc:" + qname.getLocalPart());
      Header header = new DOMHeader<Element>(soapEl);
      m.getHeaders().add(header);
    }
  }
}

代码示例来源:origin: javaee/metro-jax-ws

private static void addHeader(Message m, Set<QName> notUnderstoodHeaders) throws SOAPException {
    for (QName qname : notUnderstoodHeaders) {
      SOAPElement soapEl = SOAP_12.getSOAPFactory().createElement(MU_HEADER_DETAIL);
      soapEl.addNamespaceDeclaration("abc", qname.getNamespaceURI());
      soapEl.setAttribute("qname", "abc:" + qname.getLocalPart());
      Header header = new DOMHeader<Element>(soapEl);
      m.getHeaders().add(header);
    }
  }
}

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

public void setEncryptionMethod(String algorithmURI)
  throws XWSSecurityException {
  try {
    encryptionMethod =
      getSoapFactory().createElement(
        "EncryptionMethod",
        MessageConstants.XENC_PREFIX,
        MessageConstants.XENC_NS);
  } catch (SOAPException e) {
    log.log(Level.SEVERE, "WSS0351.error.setting.encryption.method", e.getMessage());
    throw new XWSSecurityException(e);
  }
  encryptionMethod.setAttribute("Algorithm", algorithmURI);
  updateRequired = true;
}

代码示例来源:origin: com.betfair.cougar/cougar-test-utils

for (int x = 0; x < map.getLength(); x++) {
  String name = map.item(x).getNodeName();
  newParent.setAttribute(name, map.item(x).getNodeValue());

代码示例来源:origin: org.picketlink.distribution/picketlink-jbas7

/**
 * Given a binary token, create a {@link SOAPElement}
 *
 * @param token
 *
 * @return
 *
 * @throws SOAPException
 */
private SOAPElement create(String token) throws SOAPException {
  if (factory == null) {
    factory = SOAPFactory.newInstance();
  }
  SOAPElement security = factory.createElement(Constants.WSSE_LOCAL, Constants.WSSE_PREFIX, Constants.WSSE_NS);
  if (valueTypeNamespace != null) {
    security.addNamespaceDeclaration(valueTypePrefix, valueTypeNamespace);
  }
  SOAPElement binarySecurityToken = factory.createElement(Constants.WSSE_BINARY_SECURITY_TOKEN, Constants.WSSE_PREFIX,
    Constants.WSSE_NS);
  binarySecurityToken.addTextNode(token);
  if (valueType != null && !valueType.isEmpty()) {
    binarySecurityToken.setAttribute(Constants.WSSE_VALUE_TYPE, valueType);
  }
  if (encodingType != null) {
    binarySecurityToken.setAttribute(Constants.WSSE_ENCODING_TYPE, encodingType);
  }
  security.addChildElement(binarySecurityToken);
  return security;
}

代码示例来源:origin: org.picketlink/picketlink-trust-jbossws

/**
* Given a binary token, create a {@link SOAPElement}
* @param token
* @return
* @throws SOAPException
*/
private SOAPElement create(String token) throws SOAPException
{
 if(factory == null)
   factory = SOAPFactory.newInstance();
 SOAPElement security = factory.createElement(Constants.WSSE_LOCAL, Constants.WSSE_PREFIX, Constants.WSSE_NS); 
 if (valueTypeNamespace != null)
 {
   security.addNamespaceDeclaration(valueTypePrefix, valueTypeNamespace);
 } 
 SOAPElement binarySecurityToken = factory.
 createElement(Constants.WSSE_BINARY_SECURITY_TOKEN, Constants.WSSE_PREFIX, Constants.WSSE_NS);
 binarySecurityToken.addTextNode(token);
 if( valueType != null && !valueType.isEmpty())
 {
   binarySecurityToken.setAttribute(Constants.WSSE_VALUE_TYPE, valueType);
 }
 if (encodingType != null)
 {
   binarySecurityToken.setAttribute(Constants.WSSE_ENCODING_TYPE, encodingType);
 }
 security.addChildElement(binarySecurityToken);
 return security; 
}

代码示例来源:origin: org.picketlink.distribution/picketlink-jbas5

/**
 * Given a binary token, create a {@link SOAPElement}
 *
 * @param token
 *
 * @return
 *
 * @throws SOAPException
 */
private SOAPElement create(String token) throws SOAPException {
  if (factory == null) {
    factory = SOAPFactory.newInstance();
  }
  SOAPElement security = factory.createElement(Constants.WSSE_LOCAL, Constants.WSSE_PREFIX, Constants.WSSE_NS);
  if (valueTypeNamespace != null) {
    security.addNamespaceDeclaration(valueTypePrefix, valueTypeNamespace);
  }
  SOAPElement binarySecurityToken = factory.createElement(Constants.WSSE_BINARY_SECURITY_TOKEN, Constants.WSSE_PREFIX,
    Constants.WSSE_NS);
  binarySecurityToken.addTextNode(token);
  if (valueType != null && !valueType.isEmpty()) {
    binarySecurityToken.setAttribute(Constants.WSSE_VALUE_TYPE, valueType);
  }
  if (encodingType != null) {
    binarySecurityToken.setAttribute(Constants.WSSE_ENCODING_TYPE, encodingType);
  }
  security.addChildElement(binarySecurityToken);
  return security;
}

代码示例来源:origin: org.pustefixframework.webservices/pustefix-webservices-jaxws

while(it.hasNext()) {
  SOAPElement elem=(SOAPElement)it.next();
  elem.setAttribute("class",error.getClass().getName());
  elem.removeContents();
  elem.removeAttribute("note");

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

SOAPBody soapBody = envelope.getBody();
SOAPElement soapBodyElem = soapBody.addChildElement("Get_Workers_Request", "wd", "urn:com.workday/bsvc");
SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("Request_References", "wd");
SOAPElement soapBodyElem2 = soapBodyElem1.addChildElement("Worker_Reference", "wd");
SOAPElement soapBodyElem3 = soapBodyElem2.addChildElement("ID", "wd");
soapBodyElem3.setAttribute("wd:type", "Employee_ID");
soapBodyElem3.addTextNode("123");

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

public void addTransform(String algorithmURI) throws XWSSecurityException {
  SOAPElement cipherReference = getCipherReference(false, null);

  try {
    SOAPElement dsTransform = 
      getSoapFactory().createElement(
        "Transform",
        MessageConstants.DSIG_PREFIX,
        MessageConstants.DSIG_NS);
    dsTransform.setAttribute("Algorithm", algorithmURI); 
    // need to check
    SOAPElement xencTransforms = null;
    Iterator i = cipherReference.getChildElements();
    if (i==null || !i.hasNext()) {
      xencTransforms =
        getSoapFactory().createElement(
          "Transforms",
          MessageConstants.XENC_PREFIX,
          MessageConstants.XENC_NS);
      xencTransforms = cipherReference.addChildElement(xencTransforms);
    } else
      xencTransforms = (SOAPElement)i.next();
    xencTransforms.addChildElement(dsTransform);
      } catch (SOAPException e) {
    // log
    throw new XWSSecurityException(e);
  }
}

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

password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest");
password.addTextNode(dig);

相关文章

微信公众号

最新文章

更多