List of usage examples for javax.xml.soap SOAPBodyElement getNamespacePrefixes
public Iterator<String> getNamespacePrefixes();
From source file:Main.java
private static HashMap<String, String> getNamespaceDeclarations(SOAPEnvelope env, SOAPBodyElement body) { HashMap<String, String> namespaceDeclarations = new HashMap<String, String>(); @SuppressWarnings("rawtypes") Iterator nss = env.getNamespacePrefixes(); // Retrieve all namespace declarations from SOAP-ENV node while (nss.hasNext()) { String prefix = (String) nss.next(); String uri = env.getNamespaceURI(prefix); // filter out SOAP-ENV namespace, since it is not interesting to us if (!uri.startsWith("http://schemas.xmlsoap.org/soap/envelope")) { namespaceDeclarations.put(prefix, uri); }/*from w ww. j a v a 2 s. c o m*/ } // Retrieve all namespace declarations from SOAP-BODY node nss = body.getNamespacePrefixes(); while (nss.hasNext()) { String prefix = (String) nss.next(); String uri = env.getNamespaceURI(prefix); namespaceDeclarations.put(prefix, uri); } return namespaceDeclarations; }