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
QName
s and vice-versa, and SAAJ version checking.- Since:
- 1.0.0
- Author:
- Arjen Poutsma
- See Also:
-
Name
QName
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.xml.soap.SOAPEnvelope
getEnvelope
(jakarta.xml.soap.SOAPElement element) Returns the SAAJSOAPEnvelope
for the given element.static jakarta.xml.soap.SOAPElement
getFirstBodyElement
(jakarta.xml.soap.SOAPBody body) Returns the first child element of the given body.static int
Gets the SAAJ version.static int
getSaajVersion
(jakarta.xml.soap.SOAPElement soapElement) Gets the SAAJ version for the specifiedSOAPElement
.static int
getSaajVersion
(jakarta.xml.soap.SOAPMessage soapMessage) Gets the SAAJ version for the specifiedSOAPMessage
.static String
Returns the SAAJ version as a String.static jakarta.xml.soap.SOAPMessage
loadMessage
(org.springframework.core.io.Resource resource, jakarta.xml.soap.MessageFactory messageFactory) Loads a SAAJSOAPMessage
from the given resource with a given message factory.static jakarta.xml.soap.Name
Converts aQName
to aName
.static QName
toQName
(jakarta.xml.soap.Name name) Converts ajakarta.xml.soap.Name
to ajavax.xml.namespace.QName
.
-
Field Details
-
SAAJ_11
public static final int SAAJ_11- See Also:
-
SAAJ_12
public static final int SAAJ_12- See Also:
-
SAAJ_13
public static final int SAAJ_13- See Also:
-
-
Constructor Details
-
SaajUtils
public SaajUtils()
-
-
Method Details
-
getSaajVersion
public static int getSaajVersion()Gets the SAAJ version. ReturnsSAAJ_13
as 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_13
as of Spring-WS 2.2. -
getSaajVersion
public static int getSaajVersion(jakarta.xml.soap.SOAPElement soapElement) Gets the SAAJ version for the specifiedSOAPElement
. ReturnsSAAJ_13
as 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
- theQName
to convertresolveElement
- aSOAPElement
used to resolve namespaces to prefixes- Returns:
- the converted SAAJ Name
- Throws:
jakarta.xml.soap.SOAPException
- if conversion is unsuccessfulIllegalArgumentException
- ifqName
is not fully qualified
-
toQName
Converts ajakarta.xml.soap.Name
to ajavax.xml.namespace.QName
.- Parameters:
name
- theName
to 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 SAAJSOAPMessage
from the given resource with a given message factory.- Parameters:
resource
- the resource to read frommessageFactory
- 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 SAAJSOAPEnvelope
for the given element.- Parameters:
element
- the element to return the envelope from- Returns:
- the envelope, or
null
if not found
-
getFirstBodyElement
public static jakarta.xml.soap.SOAPElement getFirstBodyElement(jakarta.xml.soap.SOAPBody body) Returns the first child element of the given body.
-