List of usage examples for javax.xml.soap SOAPElement getVisibleNamespacePrefixes
public Iterator<String> getVisibleNamespacePrefixes();
From source file:org.jbpm.bpel.integration.soap.SoapUtil.java
public static void copyVisibleNamespaces(Element target, SOAPElement source) { copyNamespaces(target, source, source.getVisibleNamespacePrefixes()); }
From source file:org.jbpm.bpel.integration.soap.SoapUtil.java
public static String getPrefix(String namespaceURI, SOAPElement contextElem) { Iterator prefixIt = contextElem.getVisibleNamespacePrefixes(); while (prefixIt.hasNext()) { String prefix = (String) prefixIt.next(); if (namespaceURI.equals(contextElem.getNamespaceURI(prefix))) return prefix; }/*from ww w. j a v a 2s . c o m*/ return null; }
From source file:org.springframework.ws.soap.saaj.support.SaajUtils.java
/** * Converts a {@link QName} to a {@link Name}. A {@link SOAPElement} is required to resolve namespaces. * * @param qName the <code>QName</code> to convert * @param resolveElement a <code>SOAPElement</code> used to resolve namespaces to prefixes * @return the converted SAAJ Name//w w w .ja v a 2 s . c o m * @throws SOAPException if conversion is unsuccessful * @throws IllegalArgumentException if <code>qName</code> is not fully qualified */ public static Name toName(QName qName, SOAPElement resolveElement) throws SOAPException { String qNamePrefix = QNameUtils.getPrefix(qName); SOAPEnvelope envelope = getEnvelope(resolveElement); if (StringUtils.hasLength(qName.getNamespaceURI()) && StringUtils.hasLength(qNamePrefix)) { return envelope.createName(qName.getLocalPart(), qNamePrefix, qName.getNamespaceURI()); } else if (StringUtils.hasLength(qName.getNamespaceURI())) { Iterator<?> prefixes; if (getSaajVersion(resolveElement) == SAAJ_11) { prefixes = resolveElement.getNamespacePrefixes(); } else { prefixes = resolveElement.getVisibleNamespacePrefixes(); } while (prefixes.hasNext()) { String prefix = (String) prefixes.next(); if (qName.getNamespaceURI().equals(resolveElement.getNamespaceURI(prefix))) { return envelope.createName(qName.getLocalPart(), prefix, qName.getNamespaceURI()); } } return envelope.createName(qName.getLocalPart(), "", qName.getNamespaceURI()); } else { return envelope.createName(qName.getLocalPart()); } }