Class SaajUtils
java.lang.Object
org.springframework.ws.soap.saaj.support.SaajUtils
Collection of generic utility methods to work with SAAJ. Includes conversion from SAAJ
Name objects to QNames and vice-versa, and SAAJ version checking.- Since:
- 1.0.0
- See Also:
-
NameQName
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.xml.soap.SOAPEnvelopegetEnvelope(jakarta.xml.soap.SOAPElement element) Returns the SAAJSOAPEnvelopefor the given element.static jakarta.xml.soap.SOAPElementgetFirstBodyElement(jakarta.xml.soap.SOAPBody body) Returns the first child element of the given body.static intGets the SAAJ version.static intgetSaajVersion(jakarta.xml.soap.SOAPElement soapElement) Gets the SAAJ version for the specifiedSOAPElement.static intgetSaajVersion(jakarta.xml.soap.SOAPMessage soapMessage) Gets the SAAJ version for the specifiedSOAPMessage.static StringReturns the SAAJ version as a String.static jakarta.xml.soap.SOAPMessageloadMessage(org.springframework.core.io.Resource resource, jakarta.xml.soap.MessageFactory messageFactory) Loads a SAAJSOAPMessagefrom the given resource with a given message factory.static jakarta.xml.soap.NameConverts aQNameto aName.static QNametoQName(jakarta.xml.soap.Name name) Converts ajakarta.xml.soap.Nameto ajavax.xml.namespace.QName.
-
Field Details
-
SAAJ_11
public static final int SAAJ_11SAAJ version 1.1.- See Also:
-
SAAJ_12
public static final int SAAJ_12SAAJ version 1.2.- See Also:
-
SAAJ_13
public static final int SAAJ_13SAAJ version 1.3.- See Also:
-
-
Constructor Details
-
SaajUtils
public SaajUtils()
-
-
Method Details
-
getSaajVersion
public static int getSaajVersion()Gets the SAAJ version. ReturnsSAAJ_13as of Spring-WS 2.2.- Returns:
- a code comparable to the SAAJ_XX codes in this class
-
getSaajVersion
public static int getSaajVersion(jakarta.xml.soap.SOAPMessage soapMessage) throws jakarta.xml.soap.SOAPException Gets the SAAJ version for the specifiedSOAPMessage. ReturnsSAAJ_13as of Spring-WS 2.2. -
getSaajVersion
public static int getSaajVersion(jakarta.xml.soap.SOAPElement soapElement) Gets the SAAJ version for the specifiedSOAPElement. ReturnsSAAJ_13as of Spring-WS 2.2. -
getSaajVersionString
Returns the SAAJ version as a String. The returned string will be "SAAJ 1.3", "SAAJ 1.2", or "SAAJ 1.1".- Returns:
- a string representation of the SAAJ version
- See Also:
-
toName
public static jakarta.xml.soap.Name toName(QName qName, jakarta.xml.soap.SOAPElement resolveElement) throws jakarta.xml.soap.SOAPException - Parameters:
qName- theQNameto convertresolveElement- aSOAPElementused to resolve namespaces to prefixes- Returns:
- the converted SAAJ Name
- Throws:
jakarta.xml.soap.SOAPException- if conversion is unsuccessfulIllegalArgumentException- ifqNameis not fully qualified
-
toQName
Converts ajakarta.xml.soap.Nameto ajavax.xml.namespace.QName.- Parameters:
name- theNameto convert- Returns:
- the converted
QName
-
loadMessage
public static jakarta.xml.soap.SOAPMessage loadMessage(org.springframework.core.io.Resource resource, jakarta.xml.soap.MessageFactory messageFactory) throws jakarta.xml.soap.SOAPException, IOException Loads a SAAJSOAPMessagefrom the given resource with a given message factory.- Parameters:
resource- the resource to read frommessageFactory- the SAAJ message factory used to construct the message- Returns:
- the loaded SAAJ message
- Throws:
jakarta.xml.soap.SOAPException- if the message cannot be constructedIOException- if the input stream resource cannot be loaded
-
getEnvelope
public static jakarta.xml.soap.SOAPEnvelope getEnvelope(jakarta.xml.soap.SOAPElement element) Returns the SAAJSOAPEnvelopefor the given element.- Parameters:
element- the element to return the envelope from- Returns:
- the envelope, or
nullif not found
-
getFirstBodyElement
public static jakarta.xml.soap.SOAPElement getFirstBodyElement(jakarta.xml.soap.SOAPBody body) Returns the first child element of the given body.
-