public class SAAJSource extends java.lang.Object implements Source
Source that is backed by a SAAJ SOAPMessage object. A SAAJSource is typically converted to and from MessageContextSource and MimeSource.
The serialization representation of this source is entirely determined by the SOAPMessage object. However, character-set encoding can be modified via the TransformOptions.CHARACTER_ENCODING options.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MESSAGE_FACTORY
an optional transform option used during transformations that tells the transformer to use the specified instance of
MessageFactory to create instances of SAAJ messages. |
static java.lang.String |
SOAP12_VERSION
an optional transform option used during transformations that tells the transformer to create an instance of SOAP Message of specified SOAP protocol when transforming from some Source to SAAJSource
The meaning of the flag is as follows: if set to true - SOAP1.2 protocol version of SOAP Message will be created if set to false - - SOAP1.1 protocol version of SOAP Message will be created if not set - the caller does not know which version If not specified, the source payload will be (partially) parsed in order to determine which SOAP version it uses |
DEFAULT_CHARACTER_SET_ENCODING| Constructor and Description |
|---|
SAAJSource(javax.xml.soap.SOAPMessage message) |
SAAJSource(javax.xml.soap.SOAPMessage message, javax.xml.soap.MessageFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCharacterEncoding()
Returns the character encoding of the message (do we need this?)
|
java.lang.String |
getContentType() |
javax.xml.soap.MessageFactory |
getFactory() |
java.io.InputStream |
getInputStream(TransformOptions options)
Returns streaming byte-baseed representation of the Source's content.
|
javax.xml.soap.SOAPMessage |
getSOAPMessage()
Returns the underlying SOAPMessage.
|
void |
writeTo(java.io.OutputStream os, TransformOptions options)
Serializes the Source's content to a byte-based stream.
|
public static final java.lang.String MESSAGE_FACTORY
MessageFactory to create instances of SAAJ messages. Be careful when using this option to pass an instance of Message Factory that suppoorts desired SOAP protocol.
e.g.
MessageFactory msgFactory = isSoap12 ?
MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL) :
MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
(or something like
MessageFactory msgFactory = isSoap12 ?
new oracle.j2ee.ws.saaj.soap.MessageFactoryImpl("soap1.2") :
new oracle.j2ee.ws.saaj.soap.MessageFactoryImpl("soap1.1");
)
options.put(SAAJSource.MESSAGE_FACTORY, msgFactory);
SAAJSource saaj = ...getTransformer().transform(source, SAAJSource.class, options);
If not specified, the default platform SAAJ factory will be used.public static final java.lang.String SOAP12_VERSION
The meaning of the flag is as follows:
public SAAJSource(javax.xml.soap.SOAPMessage message)
public SAAJSource(javax.xml.soap.SOAPMessage message,
javax.xml.soap.MessageFactory factory)
public javax.xml.soap.SOAPMessage getSOAPMessage()
public javax.xml.soap.MessageFactory getFactory()
public java.lang.String getCharacterEncoding()
public java.lang.String getContentType()
public java.io.InputStream getInputStream(TransformOptions options) throws java.io.IOException, TransformException
SourcegetInputStream in interface Sourceoptions - Options used to affect the serializationjava.io.IOExceptionTransformException
public void writeTo(java.io.OutputStream os,
TransformOptions options)
throws java.io.IOException,
TransformException
SourceNote that this method may involve an internal transformation, although it should not in any way change the underlying content.
writeTo in interface Sourceos - the OutputStream to which serialized content will be writtenoptions - TransformOptions used to affect the serializationjava.io.IOExceptionTransformException