List of utility methods to do SOAP Message
Node | getBodyContent(SOAPBody body) Extract the first Node contaning the payload of a SOAPBody /
Iterator iterator = body.getChildElements(); Node firstNode = null; while (iterator.hasNext()) { Node currentNode = (Node) iterator.next(); if (currentNode instanceof SOAPBodyElement) { firstNode = currentNode; break; return firstNode; |
byte[] | getBytes(SOAPMessage soap) Returns the XML representing the SOAP message as bytes. ByteArrayOutputStream out = new ByteArrayOutputStream(); try { soap.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true"); soap.writeTo(out); } catch (SOAPException e) { throw new IOException(e); return out.toByteArray(); ... |
void | getDeclaredNamespaces(SOAPElement aElement, Map aPrefixMap) Finds all the namespaces and prefixes in effect for a SOAPElement using SAAJ interface methods for (SOAPElement element = aElement; element != null; element = element.getParentElement()) { for (Iterator it = element.getNamespacePrefixes(); it.hasNext();) { String prefix = (String) it.next(); String ns = element.getNamespaceURI(prefix); if (!aPrefixMap.containsKey(prefix)) { aPrefixMap.put(prefix, ns); |
Collection extends QName> | getExcludedTypes() get Excluded Types return null;
|
String[] | getFaultCodeAndString(SOAPMessage message) Retrieves the fault code, string and detail from a SOAP fault message. SOAPFault fault = message.getSOAPBody().getFault(); if (fault == null) { return null; return new String[] { fault.getFaultCode(), fault.getFaultString(), detail(fault.getDetail()) }; |
String | getHeaderValue(SOAPMessage message, String tagName) get Header Value String value = null; try { SOAPHeader header = message.getSOAPPart().getEnvelope().getHeader(); NodeList elements = header.getElementsByTagNameNS("*", tagName); if (elements.getLength() > 0) value = elements.item(0).getChildNodes().item(0).getNodeValue(); } catch (SOAPException e) { e.printStackTrace(); ... |
IPath | getJarredPluginPath(String bundleId) get Jarred Plugin Path IPath result = null; Bundle bundle = Platform.getBundle(bundleId); if (bundle != null) { try { File file = FileLocator.getBundleFile(bundle); result = new Path(file.getCanonicalPath()); } catch (IOException e) { return result; |
HashMap | getNamespaceDeclarations(SOAPEnvelope env, SOAPBodyElement body) get Namespace Declarations HashMap<String, String> namespaceDeclarations = new HashMap<String, String>(); @SuppressWarnings("rawtypes") Iterator nss = env.getNamespacePrefixes(); while (nss.hasNext()) { String prefix = (String) nss.next(); String uri = env.getNamespaceURI(prefix); if (!uri.startsWith("http://schemas.xmlsoap.org/soap/envelope")) { namespaceDeclarations.put(prefix, uri); ... |
String | getNamespacePrefix(SOAPElement element, String nsURI) Returns the prefix of the namespace that has the given URI. Iterator it = element.getVisibleNamespacePrefixes(); while (it.hasNext()) { String prefix = (String) it.next(); if (nsURI.equals(element.getNamespaceURI(prefix))) return prefix; return null; |
List | getNamespacePrefixes(SOAPElement element) Returns all namespace prefixes of a given SOAP element. List<String> nsPrefixes = new ArrayList<>(); Iterator<?> it = element.getNamespacePrefixes(); while (it.hasNext()) { nsPrefixes.add(it.next().toString()); return nsPrefixes; |