Spring Web Services Framework

org.springframework.ws.soap.saaj.support
Class SaajUtils

java.lang.Object
  extended by org.springframework.ws.soap.saaj.support.SaajUtils

public abstract class SaajUtils
extends Object

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
Author:
Arjen Poutsma
See Also:
Name, QName

Field Summary
static int SAAJ_11
           
static int SAAJ_12
           
static int SAAJ_13
           
 
Constructor Summary
SaajUtils()
           
 
Method Summary
static SOAPEnvelope getEnvelope(SOAPElement element)
          Returns the SAAJ SOAPEnvelope for the given element.
static int getSaajVersion()
          Gets the SAAJ version.
static int getSaajVersion(SOAPElement soapElement)
          Gets the SAAJ version for the specified SOAPElement.
static int getSaajVersion(SOAPMessage soapMessage)
          Gets the SAAJ version for the specified SOAPMessage.
static String getSaajVersionString()
          Returns the SAAJ version as a String.
static SOAPMessage loadMessage(Resource resource, MessageFactory messageFactory)
          Loads a SAAJ SOAPMessage from the given resource with a given message factory.
static Name toName(QName qName, SOAPElement resolveElement)
          Converts a QName to a Name.
static QName toQName(Name name)
          Converts a javax.xml.soap.Name to a javax.xml.namespace.QName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAAJ_11

public static final int SAAJ_11
See Also:
Constant Field Values

SAAJ_12

public static final int SAAJ_12
See Also:
Constant Field Values

SAAJ_13

public static final int SAAJ_13
See Also:
Constant Field Values
Constructor Detail

SaajUtils

public SaajUtils()
Method Detail

getSaajVersion

public static int getSaajVersion()
Gets the SAAJ version.

Returns:
a code comparable to the SAAJ_XX codes in this class
See Also:
SAAJ_11, SAAJ_12, SAAJ_13

getSaajVersion

public static int getSaajVersion(SOAPMessage soapMessage)
                          throws SOAPException
Gets the SAAJ version for the specified SOAPMessage.

Returns:
a code comparable to the SAAJ_XX codes in this class
Throws:
SOAPException
See Also:
SAAJ_11, SAAJ_12, SAAJ_13

getSaajVersion

public static int getSaajVersion(SOAPElement soapElement)
Gets the SAAJ version for the specified SOAPElement.

Returns:
a code comparable to the SAAJ_XX codes in this class
See Also:
SAAJ_11, SAAJ_12, SAAJ_13

getSaajVersionString

public static String 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:
getSaajVersion()

toName

public static Name toName(QName qName,
                          SOAPElement resolveElement)
                   throws SOAPException
Converts a QName to a Name. A SOAPElement is required to resolve namespaces.

Parameters:
qName - the QName to convert
resolveElement - a SOAPElement used to resolve namespaces to prefixes
Returns:
the converted SAAJ Name
Throws:
SOAPException - if conversion is unsuccessful
IllegalArgumentException - if qName is not fully qualified

toQName

public static QName toQName(Name name)
Converts a javax.xml.soap.Name to a javax.xml.namespace.QName.

Parameters:
name - the Name to convert
Returns:
the converted QName

loadMessage

public static SOAPMessage loadMessage(Resource resource,
                                      MessageFactory messageFactory)
                               throws SOAPException,
                                      IOException
Loads a SAAJ SOAPMessage from the given resource with a given message factory.

Parameters:
resource - the resource to read from
messageFactory - SAAJ message factory used to construct the message
Returns:
the loaded SAAJ message
Throws:
SOAPException - if the message cannot be constructed
IOException - if the input stream resource cannot be loaded

getEnvelope

public static SOAPEnvelope getEnvelope(SOAPElement element)
Returns the SAAJ SOAPEnvelope for the given element.

Parameters:
element - the element to return the envelope from
Returns:
the envelope, or null if not found

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.