|
Use of JCP site is subject to the
JCP Terms of Use and the
Oracle Privacy Policy
|
SOAP with Attachments API for JavaTM (SAAJ) 1.3 October 14 2004
Quick jump to changes C001, C002, C003, C004, C005, C006, C007, C008, C009, C010, C011, C012, C013, C014, C015, C016, C017, C018, C019, C020, C021, C022, C023, C024, C025, C026, C027, C028, C029, C030 , C031, C032, C033, C034 1) Description Maintenance revision of the SOAP with Attachments API for JavaTM (SAAJ), version 1.3 2) Specification Leads V B Kumar Jayanti and Marc Hadley Sun Microsystems, Inc. 3) Feedback Comments should be sent to mailto:jaxm-final@sun.com
The goal of this maintenance release is primarily to provide support for SOAP version 1.2 Message Constructs. In addition, we would like to take the opportunity to make a few corrections and clarifications to the specification and JavaDocs. SOAP version 1.2 has a number of changes in syntax and provides additional (or clarified) semantics from those described in SOAP 1.1. This maintenance release is concerned with the following areas:
4.1) SAAJ 1.3 is Backward Compatible with SAAJ 1.2The proposed API changes in SAAJ 1.3 are backward compatible with SAAJ 1.2 APIs. 5) Summary of Proposed Changes
5.1) Notational Convention Followed in this DocumentEverything that is in normal text in
all the sections below (with the exception of section 10) is added new in SAAJ 1.3. In section 10, normal text indicates what was
present in SAAJ 1.2, text that is underlined (underline) indicates what
has been added new in SAAJ 1.3, and text in red color with a
strikethrough (strikethrough)
text-style indicates text that was present in SAAJ 1.2 but has been
deleted in SAAJ 1.3.
5.2) SAAJ 1.3 Support for DOM Level 3
Implementations of SAAJ 1.3 MUST provide support for DOM Level 3 APIs. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Method Summary | |
|---|---|
SOAPHeaderElement |
addNotUnderstoodHeaderElement(javax.xml.namespace.QName name)
Creates a new NotUnderstood SOAPHeaderElement object initialized
with the specified name and adds it to this SOAPHeader
object. |
SOAPHeaderElement |
addUpgradeHeaderElement(java.util.Iterator supportedSOAPURIs)
Creates a new Upgrade SOAPHeaderElement object initialized with the
specified List of supported SOAP URIs and adds it to this SOAPHeader
object. |
SOAPHeaderElement |
addUpgradeHeaderElement(java.lang.String supportedSoapUri)
Creates a new Upgrade SOAPHeaderElement object initialized with the
specified supported SOAP URI and adds it to this SOAPHeader
object. |
SOAPHeaderElement |
addUpgradeHeaderElement(java.lang.String[] supportedSoapUris)
Creates a new Upgrade SOAPHeaderElement object initialized with the
specified array of supported SOAP URIs and adds it to this SOAPHeader
object. |
| Method Detail |
SOAPHeaderElement addNotUnderstoodHeaderElement(javax.xml.namespace.QName name)
throws SOAPException
SOAPHeaderElement
object initialized with the specified name and adds it to this SOAPHeader
object. This operation is supported only by SOAP 1.2.
name - a QName object with the
name of the SOAPHeaderElement object that was not
understood. SOAPHeaderElement object that was
inserted into this SOAPHeader object SOAPException - if a SOAP
error occurs. java.lang.UnsupportedOperationException - if
this is a SOAP 1.1 Header.SOAPHeaderElement addUpgradeHeaderElement(java.util.Iterator supportedSOAPURIs)
throws SOAPException
SOAPHeaderElement object
initialized with the specified List of supported SOAP URIs and adds it
to this SOAPHeader object. This operation is supported
on both SOAP 1.1 and SOAP 1.2 header. supportedSOAPURIs - an Iterator
object with the URIs of SOAP versions supported. SOAPHeaderElement object that was
inserted into this SOAPHeader object SOAPException - if a SOAP
error occurs. SOAPHeaderElement addUpgradeHeaderElement(java.lang.String[] supportedSoapUris)
throws SOAPException
SOAPHeaderElement object
initialized with the specified array of supported SOAP URIs and adds it
to this SOAPHeader object. This operation is supported on
both SOAP 1.1 and SOAP 1.2 header.
supportedSoapUris - an array of the URIs of SOAP
versions supported. SOAPHeaderElement object that was
inserted into this SOAPHeader object SOAPException - if a SOAP
error occurs. SOAPHeaderElement addUpgradeHeaderElement(java.lang.String supportedSoapUri)
throws SOAPException
SOAPHeaderElement object
initialized with the specified supported SOAP URI and adds it to this SOAPHeader
object. This operation is supported on both SOAP 1.1 and SOAP 1.2
header.
supportedSoapUri - the URI of SOAP the version
that is supported. SOAPHeaderElement object that was
inserted into this SOAPHeader object SOAPException - if a SOAP
error occurs. | Method Summary | |
|---|---|
boolean |
getRelay() Returns the boolean value of the relay attribute for this SOAPHeaderElement |
java.lang.String |
getRole() Returns the value of the Role attribute of this SOAPHeaderElement. |
void |
setRelay(boolean relay)
Sets the relay attribute for this SOAPHeaderElement to be either true or
false. |
void |
setRole(java.lang.String uri)
Sets the Role
associated with this SOAPHeaderElement object to the
specified Role. |
| Method Detail |
void setRole(java.lang.String uri)
throws SOAPException
Role associated with this SOAPHeaderElement
object to the specified Role. uri - - the URI of the Role SOAPException
- if there is an error in setting the role java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Role.java.lang.String getRole()
SOAPHeaderElement.
String giving the URI of the Role
java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Role.void setRelay(boolean relay) throws SOAPException
SOAPHeaderElement
to be either true or false.
The SOAP relay attribute is set to true to indicate that the
SOAP header block must be relayed by any node that is targeted by the
header block but not actually process it. This attribute is ignored on
header blocks whose mustUnderstand attribute is set to true or that are
targeted at the ultimate receiver (which is the default). The default
value of this attribute is false.
relay - the new value of the relay
attribute SOAPException
- if there is
a problem setting the relay attribute. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Relay attribute.setMustUnderstand(boolean), getRelay()boolean getRelay()
SOAPHeaderElement
true if the relay attribute is turned on; false
otherwise java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Relay
attribute.getMustUnderstand(), setRelay(boolean)| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_SOAP_PROTOCOL
The default protocol: SOAP 1.1 for backwards compatibility. |
static java.lang.String |
DYNAMIC_SOAP_PROTOCOL
Used to create MessageFactory instances that create SOAPMessages
whose concrete type is based on the Content-Type MIME
header passed to the createMessage method. |
static java.lang.String |
SOAP_ENV_PREFIX
The default namespace prefix for http://www.w3.org/2003/05/soap-envelope |
static java.lang.String |
SOAP_1_1_CONTENT_TYPE
The media type of the Content-Type MIME header in SOAP 1.1. |
static java.lang.String |
SOAP_1_1_PROTOCOL
Used to create MessageFactory instances that create SOAPMessages
whose behavior supports the SOAP 1.1 specification. |
static java.lang.String |
SOAP_1_2_CONTENT_TYPE
The media type of the Content-Type MIME header in SOAP 1.2. |
static java.lang.String |
SOAP_1_2_PROTOCOL
Used to create MessageFactory instances that create SOAPMessages
whose behavior supports the SOAP 1.2 specification |
static java.lang.String |
URI_NS_SOAP_1_1_ENVELOPE
The namespace identifier for the SOAP 1.1 envelope. |
static java.lang.String |
URI_NS_SOAP_1_2_ENCODING
The namespace identifier for the SOAP 1.2 encoding. |
static java.lang.String |
URI_NS_SOAP_1_2_ENVELOPE
The namespace identifier for the SOAP 1.2 envelope. |
static java.lang.String |
URI_SOAP_1_2_ROLE_NEXT
The URI identifying the next application processing a SOAP request as the intended role for a SOAP 1.2 header entry (see section 2.2 of part 1 of the SOAP 1.2 specification). |
static java.lang.String |
URI_SOAP_1_2_ROLE_NONE
The URI specifying the role None in SOAP 1.2. |
static java.lang.String |
URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER
The URI identifying the ultimate receiver of the SOAP 1.2 message. |
| Field Detail |
static final java.lang.String DYNAMIC_SOAP_PROTOCOL
MessageFactory instances that create
SOAPMessages whose concrete type is based on the content-type
MIME header passed to the createMessage method. If no content-type
header is passed then the createMessage may throw an IllegalArgumentException
or, in the case of the no argument version of createMessage,
an UnsupportedOperationException.
static final java.lang.String SOAP_1_1_PROTOCOL
MessageFactory instances that create
SOAPMessages whose behavior supports the SOAP 1.1
specification.
static final java.lang.String SOAP_1_2_PROTOCOL
MessageFactory instances that create
SOAPMessages whose behavior supports the SOAP 1.2
specification
static final java.lang.String DEFAULT_SOAP_PROTOCOL
static final java.lang.String URI_NS_SOAP_1_1_ENVELOPE
static final java.lang.String URI_NS_SOAP_1_2_ENVELOPE
static final java.lang.String URI_NS_SOAP_1_2_ENCODING
static final java.lang.String SOAP_1_1_CONTENT_TYPE
static final java.lang.String SOAP_1_2_CONTENT_TYPE
static final java.lang.String URI_SOAP_1_2_ROLE_NEXT
static final java.lang.String URI_SOAP_1_2_ROLE_NONE
static final java.lang.String URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER
static final java.lang.String SOAP_ENV_PREFIX
| Method Summary | |
|---|---|
void |
addFaultReasonText(java.lang.String text,
java.util.Locale locale) Appends or replaces a Reason Text item containing the specified text message and an xml:lang derived from locale. |
void |
appendFaultSubcode(javax.xml.namespace.QName subcode)
Adds a Subcode to the end of the sequence of Subcodes contained by this SOAPFault. |
java.lang.String |
getFaultNode()
Returns the optional Node element value for this SOAPFault
object. |
java.util.Iterator |
getFaultReasonLocales()
Returns an Iterator
over a distinct sequence of Locales for which there are
associated
Reason Text items. |
java.lang.String |
getFaultReasonText(java.util.Locale locale)
Returns the Reason Text associated with the given Locale. |
java.util.Iterator |
getFaultReasonTexts()
Returns an Iterator
over a sequence of String objects containing all of the
Reason Text items for this SOAPFault. |
java.lang.String |
getFaultRole()
Returns the optional Role element value for this SOAPFault
object. |
java.util.Iterator |
getFaultSubcodes()
Gets the Subcodes for this SOAPFault as an iterator over QNames. |
void |
removeAllFaultSubcodes()
Removes any Subcodes that may be contained by this SOAPFault. |
void |
setFaultNode(java.lang.String uri)
Creates or replaces any existing Node element value for this SOAPFault
object. |
void |
setFaultRole(java.lang.String uri)
Creates or replaces any existing Role element value for this SOAPFault
object. |
boolean |
hasDetail()
Returns true if this SOAPFault has a Detail
subelement and false otherwise. |
| Method Detail |
java.util.Iterator getFaultSubcodes()
SOAPFault as an iterator
over QNames. Iterator that accesses a sequence of QNames.
This Iterator should not support the optional remove
method. The order in which the Subcodes are returned reflects the
hierarchy of Subcodes present
in the fault from top to bottom. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Subcode.void removeAllFaultSubcodes()
SOAPFault.
Subsequent calls to getFaultSubcodes will return an empty
iterator until a call to appendFaultSubcode is made. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Subcode.public void appendFaultSubcode(javax.xml.namespace.QName subcode)
throws SOAPException
SOAPFault. Subcodes, which were introduced in
SOAP 1.2, are represented by a recursive sequence of subelements rooted
in the mandatory Code subelement of a SOAP Fault.
subcode - a QName containing the Value of the
Subcode. SOAPException - if there
was an error in setting the Subcode java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Subcode.public java.util.Iterator getFaultReasonLocales()
throws SOAPException
Iterator over a distinct sequence of Locales
for which there are associated Reason Text items. Any of these Locales
can be used in a call to getFaultReasonText in order to
obtain a localized version of the Reason Text string.
Iterator over a sequence of Locale
objects for which there are associated Reason Text items. SOAPException - if there
was an error in retrieving the fault Reason locales. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Reason.public java.util.Iterator getFaultReasonTexts()
throws SOAPException
Iterator over a sequence of String
objects containing all of the Reason Text items for this SOAPFault.
Iterator over env:Fault/env:Reason/env:Text
items. SOAPException - if there
was an error in retrieving the fault Reason texts. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Reason.public java.lang.String getFaultReasonText(java.util.Locale locale)
throws SOAPException
Locale.
If more than one such Reason Text exists the first matching Text is
returned
locale - -- the Locale for which a
localized Reason Text is desired locale SOAPException - if there
was an error in retrieving the fault Reason text for the specified
locale . java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Reason.getFaultString()public void addFaultReasonText(java.lang.String text,
java.util.Locale locale)
throws SOAPException
locale.
If a Reason Text item with this xml:lang already exists its
text value will be replaced with text. The locale
parameter should not be null
Code sample:
SOAPFault fault = ...;
fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);
text - -- reason message stringlocale - -- Locale object representing the
locale of the message SOAPException - if there
was an error in adding the Reason text or the locale
passed was null. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Reason.java.lang.String getFaultNode()
Node element value for this SOAPFault
object. The Node element is optional in SOAP 1.2. null
if none java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Node.public void setFaultNode(java.lang.String uri)
throws SOAPException
SOAPFault
object. The Node element is optional in SOAP 1.2.
SOAPException - if there
was an error in setting the Node for this SOAPFault
object. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Node.public java.lang.String getFaultRole()
SOAPFault
object. The Role element is optional in SOAP 1.2.
null
if none java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Role.public void setFaultRole(java.lang.String uri)
throws SOAPException
SOAPFault
object. The Role element is optional in SOAP 1.2.
uri - - the URI of the Role SOAPException - if there
was an error in setting the Role for this SOAPFault
object. java.lang.UnsupportedOperationException - if
this message does not support the SOAP 1.2 concept of Fault Role.boolean hasDetail()
SOAPFault has a Detail
subelement and false otherwise. Equivalent to (getDetail()!=null).
SOAPFault has a Detail
subelement and false otherwise.
java.lang.Object
javax.xml.soap.MessageFactory
| Method Summary | |
|---|---|
static MessageFactory |
newInstance(java.lang.String protocol)
Creates a new MessageFactory object that is an instance of the
specified implementation. |
| Method Detail |
|---|
public static MessageFactory newInstance(java.lang.String protocol)
throws SOAPException
MessageFactory object that is an
instance of the specified implementation. May be a dynamic message
factory, a SOAP 1.1 message factory, or a SOAP 1.2 message factory. A
dynamic message factory creates messages based on the MIME headers
specified as arguments to the createMessage
method. This method uses the SAAJMetaFactory to
locate the implementation class and create the MessageFactory instance.protocol - a string constant representing the
class of the specified message factory implementation. May be either DYNAMIC_SOAP_PROTOCOL,
DEFAULT_SOAP_PROTOCOL (which is the same as) SOAP_1_1_PROTOCOL,
or SOAP_1_2_PROTOCOL. MessageFactory SOAPException - if there
was an error in creating the specified implementation of MessageFactory.SAAJMetaFactoryjava.lang.Object
javax.xml.soap.SOAPFactory
| Method Summary | |
|---|---|
static SOAPFactory |
newInstance(java.lang.String protocol)
Creates a new SOAPFactory object that is an instance of the
specified implementation. |
| Method Detail |
public static SOAPFactory newInstance(java.lang.String protocol)
throws SOAPException
SOAPFactory object that is an
instance of the specified implementation, this method uses
the SAAJMetaFactory to locate the implementation class and create the
SOAPFactory instance.protocol - a string constant representing
the protocol of the specified SOAP factory implementation. May be
either DYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL
(which is the same as) SOAP_1_1_PROTOCOL, or SOAP_1_2_PROTOCOL.
SOAPFactory SOAPException - if there
was an error creating the specified SOAPFactorySAAJMetaFactory| Field Summary | |
|---|---|
static javax.xml.namespace.QName |
SOAP_DATAENCODINGUNKNOWN_FAULT
SOAP 1.2 DataEncodingUnknown Fault |
static javax.xml.namespace.QName |
SOAP_MUSTUNDERSTAND_FAULT
SOAP 1.2 MustUnderstand Fault |
static javax.xml.namespace.QName |
SOAP_RECEIVER_FAULT
SOAP 1.2 Receiver Fault |
static javax.xml.namespace.QName |
SOAP_SENDER_FAULT
SOAP 1.2 Sender Fault |
static javax.xml.namespace.QName |
SOAP_VERSIONMISMATCH_FAULT
SOAP 1.2 VersionMismatch Fault |
| Field Detail |
static final javax.xml.namespace.QName SOAP_VERSIONMISMATCH_FAULT
static final javax.xml.namespace.QName SOAP_MUSTUNDERSTAND_FAULT
static final javax.xml.namespace.QName SOAP_DATAENCODINGUNKNOWN_FAULT
static final javax.xml.namespace.QName SOAP_SENDER_FAULT
static final javax.xml.namespace.QName SOAP_RECEIVER_FAULT
7)
Proposed Changes for Adding SPI for creation of Factory instances
javax.xml.soap
Class SAAJMetaFactoryjava.lang.Object
javax.xml.soap.SAAJMetaFactory
public abstract class SAAJMetaFactory- extends java.lang.Object
The access point for the implementation classes of the factories defined in the SAAJ API. All of thenewInstancemethods defined on factories in SAAJ 1.3 defer to instances of this class to do the actual object creation. The implement ions ofnewInstance()methods (in SOAPFactory and MessageFactory) that existed in SAAJ 1.2 have been updated to also delegate to the SAAJMetaFactory when the SAAJ 1.2 defined lookup fails to locate the Factory implementation class name.
SAAJMetaFactory is a service provider interface. There are no public methods on this class.
- Since:
- SAAJ 1.3
Constructor Summary protectedSAAJMetaFactory()
Method Summary (package private) static SAAJMetaFactorygetInstance()
Creates a new instance of a concreteSAAJMetaFactoryobject.protected abstract MessageFactorynewMessageFactory(java.lang.String protocol)
Creates aMessageFactoryobject for the givenStringprotocol.protected abstract SOAPFactorynewSOAPFactory(java.lang.String protocol)
Creates aSOAPFactoryobject for the givenStringprotocol.
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail SAAJMetaFactory
protected SAAJMetaFactory()
Method Detail getInstance
static synchronized SAAJMetaFactory getInstance() throws SOAPException
Creates a new instance of a concreteSAAJMetaFactoryobject. The SAAJMetaFactory is an SPI, it pulls the creation of the other factories together into a single place. Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ implementation. Service providers provide the name of theirSAAJMetaFactoryimplementation. This method uses the following ordered lookup procedure to determine the SAAJMetaFactory implementation class to load:
- Use the javax.xml.soap.MetaFactory system property.
- Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.
- Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.soap.MetaFactory in jars available to the runtime.
- Default to com.sun.xml.messaging.saaj.soap.SAAJMetaFactoryImpl.
- Returns:
- a concrete
SAAJMetaFactoryobject- Throws:
SOAPException- if there is an error in creating theSAAJMetaFactory
newMessageFactory
protected abstract MessageFactory newMessageFactory(java.lang.String protocol)
throws SOAPException
- Creates a
MessageFactoryobject for the givenStringprotocol.
- Parameters:
protocol- aStringindicating the protocol- Throws:
SOAPException- if there is an error in creating the MessageFactory- See Also:
SOAPConstants.SOAP_1_1_PROTOCOL,SOAPConstants.SOAP_1_2_PROTOCOL,SOAPConstants.DYNAMIC_SOAP_PROTOCOL
newSOAPFactory
protected abstract SOAPFactory newSOAPFactory(java.lang.String protocol)
throws SOAPException
- Creates a
SOAPFactoryobject for the givenStringprotocol.
- Parameters:
protocol- aStringindicating the protocol- Throws:
SOAPException- if there is an error in creating the SOAPFactory- See Also:
SOAPConstants.SOAP_1_1_PROTOCOL,SOAPConstants.SOAP_1_2_PROTOCOL,SOAPConstants.DYNAMIC_SOAP_PROTOCOL
Rationale : This is the proposed new SPI in SAAJ 1.3 for factoring out Factory creation into a single place.Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ implementation
8) Proposed
Addition of SAAJResult
java.lang.Object
javax.xml.transform.dom.DOMResult
javax.xml.soap.SAAJResult
public class SAAJResult
Acts as a holder for the results of a JAXP transformation or a JAXB
marshalling, in the form of a SAAJ tree. These results should be
accessed by using the getResult()
method. The DOMResult.getNode()
method should be avoided
in almost all cases.
| Field Summary |
|---|
| Fields inherited from class javax.xml.transform.dom.DOMResult |
|---|
FEATURE |
| Fields inherited from interface javax.xml.transform.Result |
|---|
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING |
| Constructor Summary | |
|---|---|
SAAJResult()
Creates a SAAJResult
that will present results in the form of a SAAJ tree that supports the
default (SOAP 1.1) protocol. |
|
SAAJResult(SOAPElement rootNode)
Creates a SAAJResult
that will write the results as a child node of the SOAPElement
specified. |
|
SAAJResult(SOAPMessage message) Creates a SAAJResult
that will write the results into the SOAPPart of the
supplied SOAPMessage. |
|
SAAJResult(java.lang.String protocol)
Creates a SAAJResult
that will present results in the form of a SAAJ tree that supports the
specified protocol. |
|
| Method Summary | |
|---|---|
Node |
getResult()
|
| Methods inherited from class javax.xml.transform.dom.DOMResult |
|---|
getNextSibling, getNode, getSystemId, setNextSibling,
setNode, setSystemId |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SAAJResult()
throws SOAPException
SAAJResult that will present results in
the form of a SAAJ tree that supports the default (SOAP 1.1) protocol.
This kind of SAAJResult is meant for use in
situations where the results will be used as a parameter to a method
that takes a parameter whose type, such as SOAPElement,
is drawn from the SAAJ API. When used in a transformation, the results
are populated into the SOAPPart of a SOAPMessage
that is created internally. The SOAPPart
returned by DOMResult.getNode()
is not guaranteed to be well-formed.
SOAPException - if there is
a problem creating a SOAPMessage public SAAJResult(java.lang.String protocol)
throws SOAPException
SAAJResult that will present results in
the form of a SAAJ tree that supports the specified protocol. The DYNAMIC_SOAP_PROTOCOL
is ambiguous in this context and will cause this constructor to throw
an UnsupportedOperationException.
This kind of SAAJResult is meant for use in
situations where the results will be used as a parameter to a method
that takes a parameter whose type, such as SOAPElement,
is drawn from the SAAJ API. When used in a transformation the results
are populated into the SOAPPart of a SOAPMessage
that is created internally. The SOAPPart
returned by DOMResult.getNode()
is not guaranteed to be well-formed.
protocol - - the name of the SOAP protocol that
the resulting SAAJ tree should support SOAPException - if a SOAPMessage
supporting the specified protocol cannot be createdpublic SAAJResult(SOAPMessage message)
SAAJResult that will write the results
into an existing SOAPMessage. In the normal case these
results will be written using DOM APIs and, as a result, the finished SOAPPart
will not be guaranteed to be well-formed unless the data used to create
it is also well formed. When used in a
transformation the validity of the SOAPMessage after transformation can
be guaranteed only be means outside the SAAJ specification.
message - - the message whose SOAPPart
will be populated as a result of some transformation or marshalling
operationpublic SAAJResult(SOAPElement rootNode)
SAAJResult that will write the results as
a child node of the SOAPElement specified. In the normal
case these results will be written using DOM APIs and as a result may
invalidate the structure of the SAAJ tree. This kind of SAAJResult
should only be used when the validity of the incoming data can be
guaranteed by means outside of the SAAJ specification.
rootNode - - the root to which the results will
be appended| Method Detail |
|---|
public Node getResult()
Rationale : Acts as a holder for the results of a JAXP transformation or a JAXB marshalling, in the form of a SAAJ tree. Introduction of this class provides ease of use for the SAAJ developer since he need not deal with the usual DOM results.
| Method Summary | |
|---|---|
DetailEntry |
addDetailEntry(javax.xml.namespace.QName qname)
Creates a new DetailEntry object with the given QName and adds it
to this Detail object. |
Method Detail
addDetailEntry
DetailEntry addDetailEntry(javax.xml.namespace.QName qname)
throws SOAPException
- Creates a new
DetailEntryobject with the given QName and adds it to thisDetailobject. This method is the preferred over the one using Name.
- Parameters:
qname- aQNameobject identifying the newDetailEntryobject- Throws:
SOAPException- thrown when there is a problem in adding a DetailEntry object to this Detail object.- Since:
- SAAJ 1.3
- See Also:
addDetailEntry(Name name)
| Method Summary | |
|---|---|
SOAPBodyElement |
addBodyElement(javax.xml.namespace.QName qname)
Creates a new SOAPBodyElement object with the specified QName and
adds it to this SOAPBody object. |
SOAPFault |
addFault(javax.xml.namespace.QName faultCode,
java.lang.String faultString) Creates a new SOAPFault object and adds it to this SOAPBody
object. |
SOAPFault |
addFault(javax.xml.namespace.QName faultCode,
java.lang.String faultString, java.util.Locale locale)
Creates a new SOAPFault object and adds it to this SOAPBody
object. |
| Method Detail |
SOAPFault addFault(javax.xml.namespace.QName faultCode,
java.lang.String faultString,
java.util.Locale locale)
throws SOAPException
SOAPFault object and adds it to this SOAPBody
object. The type of the SOAPFault will be a SOAP 1.1 or a
SOAP 1.2 SOAPFault depending on the protocol
specified while creating the MessageFactory instance.
For SOAP 1.2 the faultCode parameter is the value
of the Fault/Code/Value element and the faultString
parameter is the value of the Fault/Reason element. For SOAP
1.1 the faultCode parameter is the value of the faultcode
element and the faultString parameter is the value of the
faultstring element.
A SOAPBody may contain at most one SOAPFault
child element.
faultCode - a QName object giving
the fault code to be set; must be one of the fault codes defined in a
SOAP specification and of type QNamefaultString - a String giving an
explanation of the faultlocale - a Locale object
indicating
the native language of the faultString SOAPFault object SOAPException - if there is
a SOAP errorSOAPFault.setFaultCode(javax.xml.soap.Name),
SOAPFault.setFaultString(java.lang.String),
addFault(Name
faultCode, String faultString, Locale locale)SOAPFault addFault(javax.xml.namespace.QName faultCode,
java.lang.String faultString)
throws SOAPException
SOAPFault object and adds it to this SOAPBody
object. The type of the SOAPFault will be a SOAP 1.1 or a
SOAP 1.2 SOAPFault depending on the protocol
specified while creating the MessageFactory instance.
For SOAP 1.2 the faultCode parameter is the value
of the Fault/Code/Value element and the faultString
parameter is the value of the Fault/Reason/Text element. For SOAP
1.1 the faultCode parameter is the value of the faultcode
element and the faultString parameter is the value of the
faultstring element.
In case of a SOAP 1.2 fault, the default value for the
mandatory xml:lang attribute on the Fault/Reason/Text
element will be set to java.util.Locale.getDefault()
A SOAPBody may contain at most one SOAPFault
child element
faultCode - a QName object giving
the fault code to be set; must be one of the fault codes defined in a
SOAP specification and of type QNamefaultString - a String giving an
explanation of the fault SOAPFault object SOAPException - if there is
a SOAP errorSOAPFault.setFaultCode(javax.xml.soap.Name),
SOAPFault.setFaultString(java.lang.String),
addFault(Name
faultCode, String faultString)SOAPBodyElement addBodyElement(javax.xml.namespace.QName qname)
throws SOAPException
SOAPBodyElement object with the
specified QName and adds it to this SOAPBody object. qname - a QName object with the
qname for the new SOAPBodyElement object SOAPBodyElement object SOAPException - if a SOAP
error occursaddBodyElement(Name)| Method Summary | |
|---|---|
SOAPElement |
addAttribute(javax.xml.namespace.QName qname,
java.lang.String value) Adds an attribute with the specified name and value to this SOAPElement
object. |
SOAPElement |
addChildElement(javax.xml.namespace.QName qname)
Creates a new SOAPElement object initialized with the given QName
object and adds the new element to this SOAPElement
object. |
javax.xml.namespace.QName |
createQName(java.lang.String localName,
java.lang.String prefix) Creates a QName
whose namespace URI is the one associated with the parameter, prefix,
in the context of this SOAPElement. |
java.lang.String |
getAttributeValue(javax.xml.namespace.QName qname)
Returns the value of the attribute with the specified qname. |
java.util.Iterator |
getChildElements(javax.xml.namespace.QName qname)
Returns an Iterator
over all the immediate child Nodes of this
element with the specified qname. |
javax.xml.namespace.QName |
getElementQName()
Returns the qname of this SOAPElement object. |
boolean |
removeAttribute(javax.xml.namespace.QName qname)
Removes the attribute with the specified qname. |
void |
setElementQName(javax.xml.namespace.QName newName)
Changes the name of this Element to newName if possible. |
| Method Detail |
public SOAPElement addChildElement(javax.xml.namespace.QName qname)
throws SOAPException
SOAPElement object initialized with
the given QName object and adds the new element to this SOAPElement
object. The namespace, localname and prefix of
the new SOAPElement are all taken from the qname
argument.
qname - a QName object with the
XML name for the new element SOAPElement object that was created SOAPException - if there is
an error in creating the SOAPElement objectaddChildElement(Name)SOAPElement addAttribute(javax.xml.namespace.QName qname,
java.lang.String value)
throws SOAPException
SOAPElement
object. qname - a QName object with the
name of the attributevalue - a String giving the value
of the attribute SOAPElement object into which the attribute
was inserted SOAPException - if there is
an error in creating the Attribute, or it is invalid to set an
attribute with QName qname on this
SOAPElement.addAttribute(Name,
String)java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
qname - a QName object with the
qname of the attribute String giving the value of the specified
attribute, Null if there is no such attributegetAttributeValue(Name)javax.xml.namespace.QName createQName(java.lang.String localName,
java.lang.String prefix)
throws SOAPException
QName whose namespace URI is the one
associated with the parameter, prefix, in the context of
this SOAPElement. The remaining elements of the new QName
are taken directly from the parameters, localName and prefix.
localName - a String containing
the local part of the name.prefix - a String containing the
prefix for the name. QName with the specified localName
and prefix, and with a namespace that is associated with
the prefix in the context of this SOAPElement.
This namespace will be the same as the one that would be returned by getNamespaceURI(String)
if it were given prefix as it's parameter. SOAPException - if the QName
cannot be created.javax.xml.namespace.QName getElementQName()
SOAPElement object. QName object with the qname of this SOAPElement
objectgetElementName()public SOAPElement setElementQName(javax.xml.namespace.QName newName)
throws SOAPException
Element to newName
if possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader,
SOAPBody etc. cannot have their names changed using this method. Any
attempt to do so will result in a SOAPException being thrown.
Callers should not rely on the element instance being renamed
as is. Implementations could end up copying the content of the SOAPElement
to a renamed instance.
newName - the new name for the Element.
SOAPException - if changing
the name of this Element is not allowed.boolean removeAttribute(javax.xml.namespace.QName qname)
qname - the QName object with the
qname of the attribute to be removed true if the attribute was removed successfully; false
if it was notremoveAttribute(Name)java.util.Iterator getChildElements(javax.xml.namespace.QName qname)
Iterator over all the immediate child Nodes of this
element with the specified qname. All of these children will be SOAPElement
nodes.
Calling this method may cause child Element, SOAPElement
and org.w3c.dom.Text nodes to be replaced by SOAPElement,
SOAPHeaderElement, SOAPBodyElement or javax.xml.soap.Text
nodes as appropriate for the type of this parent node. As a result the
calling application must treat any existing references to these child
nodes that have been obtained through DOM APIs as invalid and either
discard them or refresh them with the values returned by this Iterator.
This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap
for more details.
| Method Summary | |
|---|---|
javax.xml.namespace.QName |
getFaultCodeAsQName()
Gets the fault code for this SOAPFault object as a QName
object. |
void |
setFaultCode(javax.xml.namespace.QName faultCodeQName)
Sets this SOAPFault
object with the given fault code. |
| Method Detail |
javax.xml.namespace.QName getFaultCodeAsQName()
SOAPFault object
as a QName object. QName representing the faultcodesetFaultCode(QName)void setFaultCode(javax.xml.namespace.QName faultCodeQName)
throws SOAPException
SOAPFault object with the given fault
code. It is preferable to use this method over setFaultCode(Name).
faultCodeQName - a QName
object giving the fault code to be set. It must be namespace qualified.
SOAPException - if there
was an error in adding the faultcode element to the
underlying XML tree.getFaultCodeAsQName(), setFaultCode(Name),
getFaultCodeAsQName()java.lang.Object
javax.xml.soap.SOAPFactory
| Method Summary | |
|---|---|
SOAPElement |
createElement(javax.xml.namespace.QName qname)
Creates a SOAPElement
object initialized with the given QName object. |
| Method Detail |
public SOAPElement createElement(javax.xml.namespace.QName qname)
throws SOAPException
SOAPElement object initialized with
the given QName object. The concrete type of the return
value will depend on the name given to the new SOAPElement.
For instance, a new SOAPElement with the name
"{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause a SOAPEnvelope
that supports SOAP 1.2 behavior to be created. qname - a QName object with
the XML name for the new element SOAPElement object that was created SOAPException - if there is
an error in creating the SOAPElement objectcreateElement(Name)| Method Summary | |
|---|---|
SOAPHeaderElement |
addHeaderElement(javax.xml.namespace.QName qname)
Creates a new SOAPHeaderElement object initialized with the
specified qname and adds it to this SOAPHeader object. |
| Method Detail |
SOAPHeaderElement addHeaderElement(javax.xml.namespace.QName qname)
throws SOAPException
SOAPHeaderElement object
initialized with the specified qname and adds it to this SOAPHeader
object. qname - a QName object with
the qname of the new SOAPHeaderElement object SOAPHeaderElement object that was
inserted into this SOAPHeader object SOAPException - if a SOAP
error occursaddHeaderElement(Name)java.lang.Object
javax.xml.soap.MessageFactory
public abstract class MessageFactory
A factory for creating SOAPMessage objects.
A SAAJ client can create a MessageFactory object
using the method newInstance, as shown in the following
lines of code.
MessageFactory mf = MessageFactory.newInstance();A standalone client (a client that is not running in a container) can use the
MessageFactory mf12 = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
newInstance method
to create a MessageFactory
object.
All MessageFactory objects, regardless of how they
are created, will produce SOAPMessage objects that have
the following elements by default:
SOAPPart object SOAPEnvelope object SOAPBody object SOAPHeader object MessageFactory objects
can be initialized with a JAXM profile. In such a case it will produce
messages that also come prepopulated with additional entries in the SOAPHeader object
and the SOAPBody object.
SOAPHeader object and the SOAPBody object. The content of a
new SOAPMessage object depends on which of the two MessageFactory
methods is used to create it.
createMessage() --
message has no content createMessage(MimeHeaders, java.io.InputStream) --
message has content from the InputStream object and
headers from the MimeHeaders object
java.lang.Object
javax.xml.soap.MessageFactory
Method Detail
public static MessageFactory newInstance()
throws SOAPException
MessageFactory object that is an
instance of the default implementation (SOAP 1.1), This method uses the
following ordered lookup procedure to determine the MessageFactory
implementation class to load:
MessageFactory
SOAPException - if there
was an error in creating the default implementation of the MessageFactory.SAAJMetaFactorypublic abstract SOAPMessage createMessage()
throws SOAPException
SOAPMessage object with the default SOAPPart,
SOAPEnvelope, SOAPBody,
and SOAPHeader objects. Profile-specific message
factories can choose to prepopulate the SOAPMessage
object with profile-specific headers.
Content can be added to this message's SOAPPart
object, and the message can be sent "as is" when a message containing
only a SOAP part is sufficient. Otherwise, the SOAPMessage
object needs to create one or more AttachmentPart objects
and add them to itself. Any content that is not in XML format must be
in an AttachmentPart object.
SOAPMessage object SOAPException - if a SOAP
error occurs java.lang.UnsupportedOperationException
- if the protocol of this MessageFactory instance is DYNAMIC_SOAP_PROTOCOL.public abstract SOAPMessage createMessage(MimeHeaders headers,
java.io.InputStream in)
throws java.io.IOException,
SOAPException
InputStream
object into a new SOAPMessage object and returns the SOAPMessage
object. in - the InputStream object that
contains the data for a messageheaders - the transport-specific headers
passed to the message in a transport-independent fashion for creation
of the message SOAPMessage object containing the data
from the given InputStream object java.io.IOException - if there is a problem in
reading data from the input stream SOAPException - may be thrown if the message is invalid java.lang.IllegalArgumentException
- if the MessageFactory requires one or more MIME headers
to be present in the headers parameter and they are
missing. MessageFactory implementations for SOAP_1_1_PROTOCOL
or SOAP_1_2_PROTOCOL must not throw IllegalArgumentException
for this reason.javax.xml.soap
Interface SOAPBody
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
Method Detail addFault
SOAPFault addFault()throws SOAPException
- Creates a new
SOAPFaultobject and adds it to thisSOAPBodyobject. The newSOAPFaultwill have default values set for the mandatory child elements faultcode and faultstring. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.A
SOAPBodymay contain at most oneSOAPFaultchild element.
- Returns:
- the new
SOAPFaultobject- Throws:
SOAPException- if there is a SOAP error
addFault
SOAPFault addFault(Name faultCode,
java.lang.String faultString,
java.util.Locale locale)
throws SOAPException
- Creates a new
SOAPFaultobject and adds it to thisSOAPBodyobject. The newSOAPFaultwill have afaultcodeelement that is set to the faultcode parameter and afaultstringset tofaultstringand localized tolocale. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.For SOAP 1.2 the
faultCodeparameter is the value of the Fault/Code/Value element and thefaultStringparameter is the value of the Fault/Reason/Text element. For SOAP 1.1 thefaultCodeparameter is the value of thefaultcodeelement and thefaultStringparameter is the value of thefaultstringelement.A
SOAPBodymay contain at most oneSOAPFaultchild element.
- Parameters:
faultCode- aNameobject giving the fault code to be set; must be one of the fault codes defined in the version of SOAP 1.1 specification in use and of type QNamefaultString- aStringgiving an explanation of the faultlocale- aLocaleobject indicating the native language of thefaultString- Returns:
- the new
SOAPFaultobject- Throws:
SOAPException- if there is a SOAP error- Since:
- SAAJ 1.2
- See Also:
SOAPFault.setFaultCode(javax.xml.soap.Name),SOAPFault.setFaultString(java.lang.String)
addFault
SOAPFault addFault(Name faultCode,
java.lang.String faultString)
throws SOAPException
- Creates a new
SOAPFaultobject and adds it to thisSOAPBodyobject. The new SOAPFault will have a faultcode element set to the faultcode parameter and a faultstring set to faultstring. The type of theSOAPFaultwill be a SOAP 1.1 or a SOAP 1.2SOAPFaultdepending on theprotocolspecified while creating theMessageFactoryinstance.For SOAP 1.2 the
faultCodeparameter is the value of the Fault/Code/Value element and thefaultStringparameter is the value of the Fault/Reason/Text element. For SOAP 1.1 thefaultCodeparameter is the value of thefaultcodeelement and thefaultStringparameter is the value of thefaultstringelement.In case of a SOAP 1.2 fault, the default value for the mandatory
xml:langattribute on the Fault/Reason/Text element will be set tojava.util.Locale.getDefault()A
SOAPBodymay contain at most oneSOAPFaultchild element.
- Parameters:
faultCode- aNameobject giving the fault code to be set; must be one of the fault codes defined in the version of SOAP
1.1 specification in use and of type QName
faultString- aStringgiving an explanation of the fault- Returns:
- the new
SOAPFaultobject- Throws:
SOAPException- if there is a SOAP error- Since:
- SAAJ 1.2
- See Also:
SOAPFault.setFaultCode(javax.xml.soap.Name),SOAPFault.setFaultString(java.lang.String)
getFault
SOAPFault getFault()
- Returns the
SOAPFaultobject in thisSOAPBodyobject.
- Returns:
- the
SOAPFaultobject in thisSOAPBodyobject if present, null otherwise.
java.lang.Object
javax.xml.soap.SOAPFactory
Method Detail createElement
public abstract SOAPElement createElement(Name name) throws SOAPException
- Creates a
SOAPElementobject initialized with the givenNameobject. The concrete type of the return value will depend on the name given to the newSOAPElement. For instance, a newSOAPElementwith the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause aSOAPEnvelopethat supports SOAP 1.2 behavior to be created.
- Parameters:
name- aNameobject with the XML name for the new element- Returns:
- the new
SOAPElementobject that was created- Throws:
SOAPException- if there is an error in creating theSOAPElementobject- See Also:
createElement(javax.xml.namespace.QName)
createElement
public abstract SOAPElement createElement(java.lang.String localName,
java.lang.String prefix,
java.lang.String uri)
throws SOAPException
- Creates a new
SOAPElementobject with the given local name, prefix and uri. The concrete type of the return value will depend on the name given to the newSOAPElement. For instance, a newSOAPElementwith the name "{http://www.w3.org/2003/05/soap-envelope}Envelope" would cause aSOAPEnvelopethat supports SOAP 1.2 behavior to be created.
- Parameters:
localName- aStringgiving the local name for the new elementprefix- the prefix for thisSOAPElementuri- aStringgiving the URI of the namespace to which the new element belongs- Throws:
SOAPException- if there is an error in creating theSOAPElementobject
newInstance
public static SOAPFactory newInstance() throws SOAPException
Creates a new instance ofSOAPFactoryobject that is an instance of the default implementation (SOAP 1.1),This method uses the following ordered lookup procedure to determine the SOAPFactory implementation class to load:
- Use the javax.xml.soap.SOAPFactory system property.
- Use the properties file "lib/jaxm.properties" in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above.
- Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.soap.SOAPFactory in jars available to the runtime.
- Use the SAAJMetaFactory instance to locate the SOAPFactory implementation class.
- Returns:
- a new instance of a
SOAPFactory- Throws:
SOAPException- if there was an error creating the defaultSOAPFactory- See Also:
SAAJMetaFactory
createDetail
public abstract Detail createDetail()
throws SOAPException
- Creates a new
Detailobject which serves as a container forDetailEntryobjects.This factory method creates
Detailobjects for use in situations where it is not practical to use theSOAPFaultabstraction.
- Returns:
- a
Detailobject- Throws:
SOAPException- if there is a SOAP error
java.lang.UnsupportedOperationException - if the
protocol specified for the SOAPFactory was DYNAMIC_SOAP_PROTOCOLpublic interface SOAPFault
An element in the SOAPBody object that contains error
and/or status information. This information may relate to errors in the
SOAPMessage object or to problems that are not related to
the content in the message itself. Problems not related to the message
itself are generally errors in processing, such as the inability to
communicate with an upstream server.
The SOAPFault
interface provides methods for
retrieving the information contained in a SOAPFault
object and for setting the fault code, the
fault actor, and a string describing the fault. A fault code is one of
the codes defined in the SOAP 1.1 specification that describe the
fault. An actor is an intermediate recipient to whom a message was
routed. The message path may include one or more actors, or, if no
actors are specified, the message goes only to the default actor, which
is the final intended recipient.
Depending on the protocol
specified while creating the MessageFactory instance, a SOAPFault
has sub-elements as defined in the SOAP 1.1/SOAP 1.2 specification.
| Method Detail |
|---|
public java.lang.String getFaultString()
SOAPFault object.
If this SOAPFault
is part of a message that supports SOAP 1.2 then this call is
equivalent to:
String reason = null;
try {
reason = (String) getFaultReasonTexts().next();
} catch (SOAPException e) {}
return reason;
String giving an explanation of the faultsetFaultString(String), setFaultString(String,
Locale)java.lang.String getFaultActor()
SOAPFault object.
If this SOAPFault
supports SOAP 1.2 then this call is equivalent to getFaultRole()
String giving the actor in the message path
that caused this SOAPFault objectsetFaultActor(java.lang.String)void setFaultActor(java.lang.String faultActor) throws SOAPException
SOAPFault object with the given fault
actor.
The fault actor is the recipient in the message path who caused the fault to happen.
If this SOAPFault
supports SOAP 1.2 then this call is equivalent to setFaultRole(String)
faultActor - a String identifying
the actor that caused this SOAPFault object SOAPException - if there
was an error in adding the faultActor to the underlying
XML tree.getFaultActor()Detail getDetail()
SOAPFault
object.
A Detail object carries application-specific
error information related
to SOAPBodyElement objects,
the scope of the error
information is restricted to faults in the SOAPBodyElement
objects if this is a SOAP 1.1 Fault.
Detail object with application-specific error
information if present, null
otherwise.void setFaultString(java.lang.String faultString)
throws SOAPException
SOAPFault object to
the given string.
If this SOAPFault
is part of a message that supports SOAP 1.2 then this call is
equivalent to:
addFaultReasonText(faultString, Locale.getDefault());
faultString - a String giving an
explanation of the fault SOAPException - if there
was an error in adding the faultString to the underlying
XML tree.getFaultString()void setFaultString(java.lang.String faultString,
java.util.Locale locale)
throws SOAPException
SOAPFault object to
the given string and localized to the given locale.
If this SOAPFault
is part of a message that supports SOAP 1.2 then this call is
equivalent to:
addFaultReasonText(faultString, locale);
faultString - a String giving an
explanation of the faultlocale - a Locale object
indicating the native language of the faultString SOAPException - if there
was an error in adding the faultString to the underlying
XML tree.getFaultString()public java.util.Locale getFaultStringLocale()
SOAPFault
object.
If this SOAPFault
is part of a message that supports SOAP 1.2 then this call is
equivalent to:
Locale locale = null;
try {
locale = (Locale) getFaultReasonLocales().next();
} catch (SOAPException e) {}
return locale;
Locale object indicating the native language
of the fault string or null if no locale was specifiedsetFaultString(String, Locale)| Method Detail |
|---|
SOAPElement addTextNode(java.lang.String text)
throws SOAPException
Text object initialized with the
given String and adds it to this SOAPElement
object.
text - a String object with the
textual content to be added SOAPElement object into which the new Text
object was inserted SOAPException - if there is
an error in creating the new Text object or if it is not legal to attach it
as a child to this SOAPElementvoid setEncodingStyle(java.lang.String encodingStyle)
throws SOAPException
SOAPElement object
to one specified.
encodingStyle - a String giving
the encoding style java.lang.IllegalArgumentException - if there
was a problem in the encoding style being set. SOAPException - if setting the encodingStyle is
invalid for this SOAPElement.getEncodingStyle()java.lang.String getAttributeValue(Name name)
name - a Name object with the name of the
attribute
String giving the value of the specified attribute, Null if there is no such attributegetAttributeValue(javax.xml.namespace.QName)SOAPElement addAttribute(Name name,
java.lang.String value)
throws SOAPException
SOAPElement
object.
name - a Name object with the name
of the attributevalue - a String giving the value
of the attribute SOAPElement object into which the attribute
was inserted SOAPException - if there is
an error in creating the Attribute, or it is invalid to set an
attribute with Name name on this SOAPElement.addAttribute(javax.xml.namespace.QName,
String)SOAPElement addChildElement(Name name)
throws SOAPException
Creates a new SOAPElement
object initialized with the given Name object and
adds the new element to this SOAPElement object. name - a Name object with the XML
name for the new element SOAPElement object that was created SOAPException - if there is
an error in creating the SOAPElement objectaddChildElement(javax.xml.namespace.QName)this
method was underspecified in the boundary case when the
Namespace URI of the Name is empty ("").SOAPElement addChildElement(java.lang.String localName)
throws SOAPException
SOAPElement object initialized with
the specified local name and adds the new element to this SOAPElement
object. The new SOAPElement
inherits any in-scope default namespace.localName - a String giving the
local name for the element SOAPElement object that was created SOAPException - if there is
an error in creating the SOAPElement objectSOAPElement addChildElement(java.lang.String localName,
java.lang.String prefix)
throws SOAPException
SOAPElement object initialized with
the specified local name and prefix and adds the new element to this SOAPElement
object.
localName - a String giving the
local name for the new elementprefix - a String giving the
namespace prefix for the new element SOAPElement object that was created SOAPException - If the prefix is not valid in the context of
this SOAPElement or if there is an
error in creating the SOAPElelement object. public SOAPElement addChildElement(SOAPElement element)
throws SOAPException
SOAPElement as a child of this SOAPElement
instance. The SOAPElement is expected to be created by a SOAPElementFactory.
Callers should not rely on the element instance being added as is into
the XML tree. Implementations could end up copying the content of the SOAPElement
passed into an instance of a different SOAPElement
implementation. For instance if addChildElement() is
called on a SOAPHeader, element will be
copied into an instance of a SOAPHeaderElement.
The fragment rooted in element is either added as
a whole or not at all, if there was an error.
The fragment rooted in element cannot contain
elements named "Envelope", "Header" or "Body" and in the SOAP
namespace. Any namespace prefixes present in the fragment should be
fully resolved using appropriate namespace declarations within the
fragment itself.
element - the SOAPElement to be
added as a new child SOAPException - if there
was an error in adding this element as a childA representation of an XML name. This interface provides methods for getting the local and namespace-qualified names and also for getting the prefix associated with the namespace for the name. It is also possible to get the URI of the namespace.
The following is an example of a namespace declaration in an element.
<wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">("xmlns" stands for "XML namespace".) The following shows what the methods in the
Name interface will return.
getQualifiedName will return "prefix:LocalName" =
"WOMBAT:GetLastTradePrice" getURI will return "http://www.wombat.org/trader" getLocalName will return "GetLastTracePrice" getPrefix will return "WOMBAT" XML namespaces are used to disambiguate SOAP identifiers from application-specific identifiers.
Name objects are created using the method SOAPEnvelope.createName,
which has two versions. One method creates Name objects
with a local name, a namespace prefix, and a namespace URI. and the
second creates Name objects with just a local name. The
following line of code, in which se is a SOAPEnvelope
object, creates a new Name object with all three.
Name name = se.createName("GetLastTradePrice", "WOMBAT",
"http://www.wombat.org/trader");
The following line of code gives an example of how a Name
object can be used. The variable element is a SOAPElement
object. This code creates a new SOAPElement object with
the given name and adds it to element.
element.addChildElement(name);
The Name interface may be deprecated in a
future release of SAAJ in favor of javax.xml.namespace.QName
SOAPEnvelope.createName, SOAPFactory.createName| Method Detail |
|---|
java.util.Iterator examineMustUnderstandHeaderElements(java.lang.String actor)
Iterator over all the SOAPHeaderElement
objects in this SOAPHeader object that have the specified
actor and that have a MustUnderstand attribute whose value
is equivalent to true.
In SOAP 1.2 the env:actor attribute is replaced by the env:role attribute, but with essentially the same semantics.
actor - a String giving the URI of
the actor/role
for which to search Iterator object over all the SOAPHeaderElement
objects that contain the specified actor / role and are marked as
MustUnderstandexamineHeaderElements(java.lang.String), extractHeaderElements(java.lang.String),
SOAPConstants.URI_SOAP_ACTOR_NEXTjava.util.Iterator examineHeaderElements(java.lang.String actor)
Iterator over all the SOAPHeaderElement
objects in this SOAPHeader object that have the specified
actor. An actor is a global attribute that indicates
the intermediate parties that should process a message before it
reaches its ultimate receiver. An actor receives the message and
processes it before sending it on to the next actor. The default actor
is the ultimate intended recipient for the message, so if no actor
attribute is included in a SOAPHeader object, it is sent
to the ultimate receiver along with the message body.
In SOAP 1.2 the env:actor attribute is replaced by the env:role attribute, but with essentially the same semantics.
actor - a String giving the URI of
the actor/role
for which to search Iterator object over all the SOAPHeaderElement
objects that contain the specified actor/roleextractHeaderElements(java.lang.String), SOAPConstants.URI_SOAP_ACTOR_NEXTjava.util.Iterator extractHeaderElements(java.lang.String actor)
Iterator over all the SOAPHeaderElement
objects in this SOAPHeader object that have the specified
actor and detaches them from this SOAPHeader
object.
This method allows an actor to process the parts of the SOAPHeader
object that apply to it and to remove them before passing the message
on to the next actor.
In SOAP 1.2 the env:actor attribute is replaced by the env:role attribute, but with essentially the same semantics.
actor - a String giving the URI of
the actor/role for which to
search Iterator object over all the SOAPHeaderElement
objects that contain the specified actor/roleexamineHeaderElements(java.lang.String), SOAPConstants.URI_SOAP_ACTOR_NEXT| Method Detail |
|---|
java.lang.String getActor()
SOAPHeaderElement.
If this SOAPHeaderElement
supports SOAP 1.2 then this call is equivalent to getRole()
String giving the URI of the actorsetActor(java.lang.String)void setActor(java.lang.String actorURI)
SOAPHeaderElement
object to the specified actor. The default value of an actor is: SOAPConstants.URI_SOAP_ACTOR_NEXT
If this SOAPHeaderElement
supports SOAP 1.2 then this call is equivalent to setRole(String)
actorURI - a String giving the URI
of the actor to set java.lang.IllegalArgumentException - if there is
a problem in setting the actor.getActor()java.lang.Object
javax.xml.soap.SOAPMessage
| Method Detail |
|---|
public abstract void writeTo(java.io.OutputStream out)
throws SOAPException,
java.io.IOException
SOAPMessage object to the given output
stream. The externalization format is as defined by the SOAP 1.1 with
Attachments specification.
If there are no attachments, just an XML stream is written out.
For those messages that have attachments, writeTo writes
a MIME-encoded byte stream.
Note that this method does not write the transport-specific MIME Headers of the Message
out - the OutputStream object to
which this SOAPMessage object will be written java.io.IOException - if an I/O error occurs SOAPException - if there
was a problem in externalizing this SOAP messagepublic AttachmentPart createAttachmentPart(java.lang.Object content,
java.lang.String contentType)
AttachmentPart object and populates it
with the specified data of the specified content type. The type of the Object should correspond to the value
given for the Content-Type.
content - an Object containing the
content for this SOAPMessage
the AttachmentPart object to be createdcontentType - a String object
giving the type of content; examples are "text/xml", "text/plain", and
"image/jpeg" AttachmentPart object that contains the
given data java.lang.IllegalArgumentException - may be thrown if the
contentType does not match the type of the content object, or if there
was no DataContentHandler object for the given content
objectDataHandler, DataContentHandlerpublic abstract void setContent(java.lang.Object object,
java.lang.String contentType)
Object
and sets the value of the Content-Type header to the
given type. The type of the Object should correspond to
the value given for the Content-Type. This depends on the
particular set of DataContentHandler objects in use.
object - the Java object that makes up the
content for this attachment partcontentType - the MIME string that specifies the
type of the content java.lang.IllegalArgumentException - may be thrown if the
contentType does not match the type of the content object, or if there
was no DataContentHandler object for this content objectgetContent()javax.xml.soap
Class SOAPMessage
java.lang.Object
javax.xml.soap.SOAPMessage
Method Summary abstract AttachmentPartgetAttachment(SOAPElement element)
Returns anAttachmentPartobject that is associated with an attachment that is referenced by thisSOAPElementornullif no such attachment exists.abstract voidremoveAttachments(MimeHeaders headers)
Removes all theAttachmentPartobjects that have header entries that match the specified headers.
Method Detail
getAttachment
public abstract AttachmentPart getAttachment(SOAPElement element)
throws SOAPException
- Returns an
AttachmentPartobject that is associated with an attachment that is referenced by thisSOAPElementornullif no such attachment exists. References can be made via anhrefattribute as described in SOAP Messages with Attachments, or via a singleTextchild node containing a URI as described in the WS-I Attachments Profile 1.0 for elements of schema type ref:swaRef. These two mechanisms must be supported. The support for references viahrefattribute also implies that this method should also be supported on an element that is an xop:Include element ( XOP). other reference mechanisms may be supported by individual implementations of this standard. Contact your vendor for details.
- Parameters:
element- TheSOAPElementcontaining the reference to an Attachment- Returns:
- the referenced
AttachmentPartor null if no suchAttachmentPartexists or no reference can be found in thisSOAPElement.- Throws:
SOAPException- if there is an error in the attempt to access the attachment- Since:
- SAAJ 1.3
Rationale : see javadoc explanation above.
removeAttachments
public abstract void removeAttachments(MimeHeaders headers)
- Removes all the
AttachmentPartobjects that have header entries that match the specified headers. Note that the removed attachment could have headers in addition to those specified.
- Parameters:
headers- aMimeHeadersobject containing the MIME headers for which to search- Since:
- SAAJ 1.3
Rationale : There was no API in SAAJ 1.2 to remove a particular Attachment
java.lang.Object
javax.xml.soap.SOAPFactory
| Method Summary | |
|---|---|
SOAPElement |
createElement(org.w3c.dom.Element domElement)
Creates a SOAPElement
object from an existing DOM Element. |
abstract
SOAPFault |
createFault() Creates a new default SOAPFault object |
abstract
SOAPFault |
createFault(java.lang.String reasonText,
javax.xml.namespace.QName faultCode) Creates a new SOAPFault object initialized with the given reasonText
and faultCode |
| Method Detail |
public SOAPElement createElement(org.w3c.dom.Element domElement)throws SOAPException
SOAPElement object from an existing DOM Element.
If the DOM Element that is passed in as an argument is
already a SOAPElement then this method must return it
unmodified without any further work. Otherwise, a new SOAPElement
is created and a deep copy is made of the domElement
argument. The concrete type of the return value will depend on the name
of the domElement argument. If any part of the tree
rooted in domElement violates SOAP rules, a SOAPException
will be thrown. domElement - - the Element to be
copied. SOAPElement that is a copy of domElement.
SOAPException - if there is
an error in creating the SOAPElement object
Rationale: Useful when one wants to obtain a SAAJ Tree out of a DOM Tree
createFault
public abstract SOAPFault createFault()
throws SOAPException
- Creates a new default
SOAPFaultobject
- Returns:
- a
SOAPFaultobject- Throws:
SOAPException- if there is a SOAP error- Since:
- SAAJ 1.3
createFault
public abstract SOAPFault createFault(java.lang.String reasonText,
javax.xml.namespace.QName faultCode)
throws SOAPException
- Creates a new
SOAPFaultobject initialized with the givenreasonTextandfaultCode
- Parameters:
reasonText- the ReasonText/FaultString for the faultfaultCode- the FaultCode for the fault- Returns:
- a
SOAPFaultobject- Throws:
SOAPException- if there is a SOAP error- Since:
- SAAJ 1.3
Rationale: Provides a simple way of getting a SOAPFault instance that can be used to create a SOAPFaultException
| Method Summary | |
|---|---|
org.w3c.dom.Document |
extractContentAsDocument()
Creates a new DOM and sets the first child of
this SOAPBody as it's document element. |
| Method Detail |
org.w3c.dom.Document extractContentAsDocument()throws SOAPException
Document and sets
the first child of this SOAPBody as it's document
element. The child SOAPElement
is removed as part of the process. Document representation of
the SOAPBody content. SOAPException - if there is
not exactly one child SOAPElement of the SOAPBody.
Rationale : Useful when it is required to extract the content of SOAP Body as org.w3c.dom.Document. It is also the missing counterpart for SAAJ 1.2 addDocument(org.w3c.dom.Document).
javax.xml.soap.SOAPConnection| Method Summary | |
|---|---|
SOAPMessage |
get(java.lang.Object to)
Gets a message from a specific endpoint and blocks until it receives, |
| Method Detail |
public SOAPMessage get(java.lang.Object to)Gets a message from a specific endpoint and blocks until it receives,
throws SOAPException
to - an Object that identifies
where the request should be sent. Objects of type java.lang.String
and java.net.URL must be supported. SOAPMessage object that is the response to
the get message request SOAPException - if there is
a SOAP error
javax.xml.soap
Class AttachmentPartjava.lang.Object
javax.xml.soap.AttachmentPart
Method Summary abstract java.io.InputStreamgetBase64Content()
Returns anInputStreamwhich can be used to obtain the content ofAttachmentPartas Base64 encoded character data, this method would base64 encode the raw bytes of the attachment and return.abstract java.io.InputStreamgetRawContent()
Gets the content of thisAttachmentPartobject as an InputStream as if a call had been made togetContentand noDataContentHandlerhad been registered for thecontent-typeof thisAttachmentPart.abstract voidsetBase64Content(java.io.InputStream content, java.lang.String contentType)
Sets the content of this attachment part from the Base64 source InputStreamand sets the value of theContent-Typeheader to the value contained incontentType, This method would first decode the base64 input and write the resulting raw bytes to the attachment.abstract voidsetRawContent(java.io.InputStream content, java.lang.String contentType)
Sets the content of this attachment part to that contained by theInputStreamcontentand sets the value of theContent-Typeheader to the value contained incontentType.abstract byte[]getRawContentBytes()
Gets the content of thisAttachmentPartobject as a byte[] array as if a call had been made togetContentand noDataContentHandlerhad been registered for thecontent-typeof thisAttachmentPart.abstract voidsetRawContentBytes(byte[] content,int offset, int len, java.lang.String contentType)
Sets the content of this attachment part to that contained by thebyte[]arraycontentand sets the value of theContent-Typeheader to the value contained incontentType.
Method Detail
getBase64Content
public abstract java.io.InputStream getBase64Content()
throws SOAPException
- Returns an
InputStreamwhich can be used to obtain the content ofAttachmentPartas Base64 encoded character data, this method would base64 encode the raw bytes of the attachment and return.
- Returns:
- an
InputStreamfrom which the Base64 encodedAttachmentPartcan be read.- Throws:
SOAPException- if there is no content set into thisAttachmentPartobject or if there was a data transformation error.- Since:
- SAAJ 1.3
getRawContent
public abstract java.io.InputStream getRawContent()
throws SOAPException
- Gets the content of this
AttachmentPartobject as an InputStream as if a call had been made togetContentand noDataContentHandlerhad been registered for thecontent-typeof thisAttachmentPart.
- Returns:
- an
InputStreamfrom which the raw data contained by theAttachmentPartcan be accessed.- Throws:
SOAPException- if there is no content set into thisAttachmentPartobject or if there was a data transformation error.- Since:
- SAAJ 1.3
setRawContent
public abstract void setRawContent(java.io.InputStream content,
java.lang.String contentType) throws SOAPException
- Sets the content of this attachment part to that contained by the
A subsequent call to getSize() may not be an exact measure of the content size.InputStreamcontentand sets the value of theContent-Typeheader to the value contained incontentType.
- Parameters:
content- the raw data to add to the attachment partcontentType- the value to set into theContent-Typeheader- Throws:
SOAPException- if there is an error in setting the contentjava.lang.NullPointerException- ifcontentis null
- Since:
- SAAJ 1.3
setBase64Content
public abstract void setBase64Content(java.io.InputStream content,
java.lang.String contentType) throws SOAPException
- Sets the content of this attachment part from the Base64 source
InputStreamcontentand sets the value of theContent-Typeheader to the value contained incontentType, This method would first decode the base64 input and write the resulting raw bytes to the attachment.
A subsequent call to getSize() may not be an exact measure of the content size.
- Parameters:
content- the base64 encoded data to add to the attachment partcontentType- the value to set into theContent-Typeheader- Throws:
SOAPException- if there is an error in setting the contentjava.lang.NullPointerException- ifcontentis null- Since:
- SAAJ 1.3
getRawContentBytes
public abstract byte[] getRawContentBytes()
throws SOAPException
- Gets the content of this
AttachmentPartobject as a byte[] array as if a call had been made togetContentand noDataContentHandlerhad been registered for thecontent-typeof thisAttachmentPart.
- Returns:
- a
byte[]array containing the raw data of theAttachmentPart.- Throws:
SOAPException- if there is no content set into thisAttachmentPartobject or if there was a data transformation error.- Since:
- SAAJ 1.3
setRawContentBytes
public abstract void setRawContentBytes(byte[] content,
int offset,
int len,
java.lang.String contentType)
throws SOAPException
- Sets the content of this attachment part to that contained by the
byte[]arraycontentand sets the value of theContent-Typeheader to the value contained incontentType.
- Parameters:
content- the raw data to add to the attachment partcontentType- the value to set into theContent-Typeheaderoffset- the offset in the byte array of the contentlen- the number of bytes that form the content- Throws:
SOAPException- if an there is an error in setting the content or content is null- Since:
- SAAJ 1.3
Rationale : Following Methods have been added new in SAAJ 1.3.
These methods would allow retrieval of the contents of an attachment as base64/raw data and write an attachment from a base64 source. getBase64Content would base64 encode the raw bytes of the attachment, setBase64Content would decode the base64 input and write the resulting raw bytes to the attachment.
The XOP specification allows attachments to either be serialized inside the message as base64 or as raw bytes in an attachment, these methods would be convenient when switching between these two representations.
javax.xml.soap
java.lang.Object
Class SOAPPart
javax.xml.soap.SOAPPart
- All Implemented Interfaces:
- org.w3c.dom.Document, org.w3c.dom.Node
public abstract class SOAPPart- extends java.lang.Object
- implements org.w3c.dom.Document, Node
The container for the SOAP-specific portion of a
SOAPMessageobject. All messages are required to have a SOAP part, so when aSOAPMessageobject is created, it will automatically have aSOAPPartobject.A
SOAPPartobject is a MIME part and has the MIME headers Content-Id, Content-Location, and Content-Type. Because the value of Content-Type must be "text/xml", aSOAPPartobject automatically has a MIME header of Content-Type with its value set to "text/xml". The value must be "text/xml" because content in the SOAP part of a message must be in XML format. Content that is not of type "text/xml" must be in anAttachmentPartobject rather than in theSOAPPartobject.When a message is sent, its SOAP part must have the MIME header Content-Type set to "text/xml". Or, from the other perspective, the SOAP part of any message that is received must have the MIME header Content-Type with a value of "text/xml".
A client can access the
SOAPPartobject of aSOAPMessageobject by calling the methodSOAPMessage.getSOAPPart. The following line of code, in whichmessageis aSOAPMessageobject, retrieves the SOAP part of a message.SOAPPart soapPart = message.getSOAPPart();
A
SOAPPartobject contains aSOAPEnvelopeobject, which in turn contains aSOAPBodyobject and aSOAPHeaderobject. TheSOAPPartmethodgetEnvelopecan be used to retrieve theSOAPEnvelopeobject.
Rationale : In SAAJ 1.2 SOAPPart was implementing org.w3c.dom.Document only.
| javax.xml.* |
|---|
| javax.xml.soap.SOAPConstants | ||
|---|---|---|
public static final java.lang.String |
DEFAULT_SOAP_PROTOCOL |
"SOAP 1.1 Protocol" |
public static final java.lang.String |
DYNAMIC_SOAP_PROTOCOL |
"Dynamic Protocol" |
public static final java.lang.String |
SOAP_1_1_CONTENT_TYPE |
"text/xml" |
public static final java.lang.String |
SOAP_1_1_PROTOCOL |
"SOAP 1.1 Protocol" |
public static final java.lang.String |
SOAP_1_2_CONTENT_TYPE |
"application/soap+xml" |
public static final java.lang.String |
SOAP_1_2_PROTOCOL |
"SOAP 1.2 Protocol" |
public static final java.lang.String |
SOAP_ENV_PREFIX |
"env" |
public static final java.lang.String |
URI_NS_SOAP_1_1_ENVELOPE |
"http://schemas.xmlsoap.org/soap/envelope/" |
public static final java.lang.String |
URI_NS_SOAP_1_2_ENCODING |
"http://www.w3.org/2003/05/soap-encoding" |
public static final java.lang.String |
URI_NS_SOAP_1_2_ENVELOPE |
"http://www.w3.org/2003/05/soap-envelope" |
public static final java.lang.String |
URI_NS_SOAP_ENCODING |
"http://schemas.xmlsoap.org/soap/encoding/" |
public static final java.lang.String |
URI_NS_SOAP_ENVELOPE |
"http://schemas.xmlsoap.org/soap/envelope/" |
public static final java.lang.String |
URI_SOAP_1_2_ROLE_NEXT |
"http://www.w3.org/2003/05/soap-envelope/role/next" |
public static final java.lang.String |
URI_SOAP_1_2_ROLE_NONE |
"http://www.w3.org/2003/05/soap-envelope/role/none" |
public static final java.lang.String |
URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER |
"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver" |
public static final java.lang.String |
URI_SOAP_ACTOR_NEXT |
"http://schemas.xmlsoap.org/soap/actor/next" |