SOAPUtilities

public class SOAPUtilities

The SOAPUtilities acts as a SOAP Helper for some operations that frequently used. Currently supported operations:

  • create a SOAP Element with specified tag name, value, ns prefix and uri (Also an attributes set).
  • get a SOAP Element with specified tag name, ns prefix and uri and which nth tag from a SOAP Message.
  • get a list of SOAP Element with specified tag name, ns prefix and uri from a SOAP Message.
Author:Twinsen

Methods

countElement

public static int countElement(SOAPMessage message, String tagname, String nsURI)

Count how many element with tagname and nsURI is in SOAPMessage message.

Parameters:
  • message – The SOAP message
  • tagname – The name of the tag to be counted.
  • nsURI – The namespace URI of the tag.
Throws:
  • SOAPException
Returns:

The number of element in the SOAP message.

createElement

public static SOAPElement createElement(String tagName, String tagValue, String nsPrefix, String nsURI)

Create a SOAP Element with the specified parameters.

Parameters:
  • tagName – the name of XML tag.
  • tagValue – the value of XML tag.
  • nsPrefix – the namespace prefix.
  • nsURI – the namespace URL.
Returns:

the new SOAP element created.

createElement

public static SOAPElement createElement(String tagName, String tagValue, String nsPrefix, String nsURI, Hashtable attrSet)

Create a SOAP Element with the specified parameters.

Also it create the attributes set as the parameter properties.

Parameters:
  • tagName – the name of XML tag.
  • tagValue – the value of XML tag.
  • nsPrefix – the namespace prefix.
  • nsURI – the namespace URL.
  • attrSet – the attributes set in the element.
Returns:

the new SOAP element created.

getElement

public static SOAPElement getElement(SOAPMessage message, String tagname, String nsURI, int whichOne)

Get a SOAP Element from the SOAPMessage (SOAPbody inside).

Parameters:
  • message – The SOAP message to be searched with.
  • tagname – The tag name of element to be retrieved.
  • nsURI – The namespace URI.
  • whichOne – The nth child element to be returned.
Returns:

The element in the tagname specified.

getElementList

public static List getElementList(SOAPMessage message, String tagname, String nsURI)

Get a SOAP Element list from the SOAPMessage (SOAPbody inside).

Parameters:
  • message – The SOAP message to be searched with.
  • tagname – The tag name of element to be retrieved.
  • nsURI – The namespace URI.
Throws:
  • SOAPException
Returns:

list of SOAP element

linkElements

public static boolean linkElements(SOAPMessage message, String parentTagName, String parentNsURI, String childTagName, String childNsURI)

Validate the existence of child SOAP element given the parent element.

Parameters:
  • message
  • parentTagName
  • parentNsURI
  • childTagName
  • childNsURI
Throws:
  • SOAPException
Returns:

true if child element exists