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
4) Rationale for Proposed Changes
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:
-
Support for SOAP version 1.2 message constructs in the API.
-
Factoring out the creation of all SAAJ Factory classes into a single SPI that allows creation of SOAP version aware Factories.
-
Addition of a few new classes and new methods in certain existing classes and interfaces.
-
Support for overloaded QName based methods in certain classes and interfaces.
-
Clarification of semantics and correction of wording of JavaDocs and specification.
4.1) SAAJ 1.3 is Backward Compatible with SAAJ 1.2
The proposed API changes in SAAJ 1.3 are backward compatible with SAAJ 1.2 APIs. 5) Summary of Proposed Changes
-
Support for SOAP Version 1.2 Message Constructs
Rationale: SOAP Version 1.2 has a number of changes in syntax and introduces several new Message Constructs. SAAJ 1.3 will support SOAP Version 1.2 Message Constructs.
-
SPI for Creation of Factory Instances
Rationale: SAAJ 1.3 will support SOAP Version 1.2 Message Constructs, while at the same time being backward compatible in its support for SOAP Version 1.1. We would like to define an SPI (SAAJMetaFactory) for factoring out the creation of SOAP Version aware Factory classes into a single place. Changing out the SAAJMetaFactory has the effect of changing out the entire SAAJ implementation. Backward compatibility is maintained by ensuring that the default protocol is set to SOAP Version 1.1. -
Definition of new Class SAAJResult
Rationale: A SAAJResult object acts as a holder for the results of a JAXP transformation or a JAXB marshalling, in the form of a SAAJ tree. This class will make it easier for the end user when dealing with transformations in situations where the result is expected to be a valid SAAJ tree. -
Addition of overloaded methods which accept a QName instead of a Name
Rationale: QName is the preferred representation of XML qualified names, and hence we would like to introduce overloaded methods in all APIs where a corresponding method was accepting a javax.xml.soap.Name as argument. The Name interface may be deprecated in a future release of SAAJ in favor of QName.
-
Clarify and correct the wording of JavaDocs and specification
Scope: None of these changes will break backward compatibility for SOAP 1.1 users.
Rationale: Corrections of this nature cost little and improve the overall integrity of the specification making correct implementations easier to create, validate and use. -
Addition of new methods in certain Interfaces and Classes
Rationale: A few new methods have been introduced in AttachmentPart, SOAPBody, and SOAPElement. These new methods are intended for ease of use and to assist SAAJ users when dealing with some of the newer SOAP features. -
Make SOAPPart a javax.xml.soap.Node
Rationale: The SOAPPart is also a SOAP Node. - Deferred Changes
5.1) Notational Convention Followed in this Document
5.2) SAAJ 1.3 Support for DOM Level 3
Implementations of SAAJ 1.3 MUST provide support for DOM Level 3 APIs. 6) Proposed
Changes Supporting Additional or Changed Syntax in SOAP Version
1.2
C001
javax.xml.soap
Interface SOAPHeader
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| 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 |
addNotUnderstoodHeaderElement
SOAPHeaderElement addNotUnderstoodHeaderElement(javax.xml.namespace.QName name)
throws SOAPException
- Creates a new NotUnderstood
SOAPHeaderElementobject initialized with the specified name and adds it to thisSOAPHeaderobject. This operation is supported only by SOAP 1.2.
-
- Parameters:
name- aQNameobject with the name of theSOAPHeaderElementobject that was not understood.- Returns:
- the new
SOAPHeaderElementobject that was inserted into thisSOAPHeaderobject - Throws:
SOAPException- if a SOAP error occurs.java.lang.UnsupportedOperationException- if this is a SOAP 1.1 Header.- Since:
- SAAJ 1.3
addUpgradeHeaderElement
SOAPHeaderElement addUpgradeHeaderElement(java.util.Iterator supportedSOAPURIs)
throws SOAPException
- Creates a new Upgrade
SOAPHeaderElementobject initialized with the specified List of supported SOAP URIs and adds it to thisSOAPHeaderobject. This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
-
- Parameters:
supportedSOAPURIs- anIteratorobject with the URIs of SOAP versions supported.- Returns:
- the new
SOAPHeaderElementobject that was inserted into thisSOAPHeaderobject - Throws:
SOAPException- if a SOAP error occurs.
- Since:
- SAAJ 1.3
addUpgradeHeaderElement
SOAPHeaderElement addUpgradeHeaderElement(java.lang.String[] supportedSoapUris)
throws SOAPException
- Creates a new Upgrade
SOAPHeaderElementobject initialized with the specified array of supported SOAP URIs and adds it to thisSOAPHeaderobject. This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
-
- Parameters:
supportedSoapUris- an array of the URIs of SOAP versions supported.- Returns:
- the new
SOAPHeaderElementobject that was inserted into thisSOAPHeaderobject - Throws:
SOAPException- if a SOAP error occurs.
- Since:
- SAAJ 1.3
addUpgradeHeaderElement
SOAPHeaderElement addUpgradeHeaderElement(java.lang.String supportedSoapUri)
throws SOAPException
- Creates a new Upgrade
SOAPHeaderElementobject initialized with the specified supported SOAP URI and adds it to thisSOAPHeaderobject. This operation is supported on both SOAP 1.1 and SOAP 1.2 header.
-
- Parameters:
supportedSoapUri- the URI of SOAP the version that is supported.- Returns:
- the new
SOAPHeaderElementobject that was inserted into thisSOAPHeaderobject - Throws:
SOAPException- if a SOAP error occurs.
- Since:
- SAAJ 1.3
C002
javax.xml.soap
Interface SOAPHeaderElement
All Superinterfaces: org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| 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 |
setRole
void setRole(java.lang.String uri)
throws SOAPException
- Sets the
Roleassociated with thisSOAPHeaderElementobject to the specifiedRole.
-
- Parameters:
uri- - the URI of theRole- Throws:
SOAPException - if there is an error in setting the rolejava.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Role.- Since:
- SAAJ 1.3
getRole
java.lang.String getRole()
- Returns the value of the Role attribute of this
SOAPHeaderElement.
-
- Returns:
- a
Stringgiving the URI of theRole - Throws:
java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Role.- Since:
- SAAJ 1.3
setRelay
void setRelay(boolean relay) throws SOAPException
- Sets the relay attribute for this
SOAPHeaderElementto 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.
-
- Parameters:
relay- the new value of the relay attribute- Throws:
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.- Since:
- SAAJ 1.3
- See Also:
setMustUnderstand(boolean),getRelay()
getRelay
boolean getRelay()
- Returns the boolean value of the relay attribute for this
SOAPHeaderElement
-
- Returns:
trueif the relay attribute is turned on;falseotherwise- Throws:
java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Relay attribute.- Since:
- SAAJ 1.3
- See Also:
getMustUnderstand(),setRelay(boolean)
-
Rationale : New methods added to SOAPHeaderElement to support SOAP 1.2 Message Constructs
C003
javax.xml.soap
Interface SOAPConstants
| 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 |
DYNAMIC_SOAP_PROTOCOL
static final java.lang.String DYNAMIC_SOAP_PROTOCOL
- Used to create
MessageFactoryinstances that createSOAPMessageswhose concrete type is based on thecontent-typeMIME header passed to thecreateMessagemethod. If nocontent-typeheader is passed then thecreateMessagemay throw anIllegalArgumentExceptionor, in the case of the no argument version ofcreateMessage, anUnsupportedOperationException.- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
SOAP_1_1_PROTOCOL
static final java.lang.String SOAP_1_1_PROTOCOL
- Used to create
MessageFactoryinstances that createSOAPMessageswhose behavior supports the SOAP 1.1 specification.- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
SOAP_1_2_PROTOCOL
static final java.lang.String SOAP_1_2_PROTOCOL
- Used to create
MessageFactoryinstances that createSOAPMessageswhose behavior supports the SOAP 1.2 specification- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
DEFAULT_SOAP_PROTOCOL
static final java.lang.String DEFAULT_SOAP_PROTOCOL
- The default protocol: SOAP 1.1 for backwards compatibility.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
URI_NS_SOAP_1_1_ENVELOPE
static final java.lang.String URI_NS_SOAP_1_1_ENVELOPE
- The namespace identifier for the SOAP 1.1 envelope.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
URI_NS_SOAP_1_2_ENVELOPE
static final java.lang.String URI_NS_SOAP_1_2_ENVELOPE
- The namespace identifier for the SOAP 1.2 envelope.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
URI_NS_SOAP_1_2_ENCODING
static final java.lang.String URI_NS_SOAP_1_2_ENCODING
- The namespace identifier for the SOAP 1.2 encoding.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
SOAP_1_1_CONTENT_TYPE
static final java.lang.String SOAP_1_1_CONTENT_TYPE
- The media type of the Content-Type MIME header in SOAP 1.1.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
SOAP_1_2_CONTENT_TYPE
static final java.lang.String SOAP_1_2_CONTENT_TYPE
- The media type of the Content-Type MIME header in SOAP 1.2.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
URI_SOAP_1_2_ROLE_NEXT
static final 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).
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
URI_SOAP_1_2_ROLE_NONE
static final java.lang.String URI_SOAP_1_2_ROLE_NONE
- The URI specifying the role None in SOAP 1.2.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER
static final java.lang.String URI_SOAP_1_2_ROLE_ULTIMATE_RECEIVER
- The URI identifying the ultimate receiver of the SOAP 1.2
message.
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
SOAP_ENV_PREFIX
static final java.lang.String SOAP_ENV_PREFIX
- The default namespace prefix for
http://www.w3.org/2003/05/soap-envelope
- Since:
- SAAJ 1.3
- See Also:
- Constant Field Values
Rationale: All these fields are added new in SOAPConstants as part of providing support for SOAP Version 1.2, and for providing a facility to create SOAP Version aware Factory instances.
URI_NS_SOAP_1_1_ENVELOPE is the same as the SAAJ 1.2 constant URI_NS_SOAP_ENVELOPE
C004
javax.xml.soap
Interface SOAPFault
All Superinterfaces: org.w3c.dom.Element, org.w3c.dom.Node, SOAPBodyElement, SOAPElement
| 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 |
getFaultSubcodes
java.util.Iterator getFaultSubcodes()
- Gets the Subcodes for this
SOAPFaultas an iterator overQNames.
-
- Returns:
- an
Iteratorthat accesses a sequence ofQNames. ThisIteratorshould not support the optionalremovemethod. The order in which the Subcodes are returned reflects the hierarchy of Subcodes present in the fault from top to bottom. - Throws:
java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Subcode.- Since:
- SAAJ 1.3
removeAllFaultSubcodes
void removeAllFaultSubcodes()
- Removes any Subcodes that may be contained by this
SOAPFault. Subsequent calls togetFaultSubcodeswill return an empty iterator until a call toappendFaultSubcodeis made.
-
- Throws:
java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Subcode.- Since:
- SAAJ 1.3
appendFaultSubcode
public void appendFaultSubcode(javax.xml.namespace.QName subcode)
throws SOAPException
- Adds a Subcode to the end of the sequence of Subcodes contained
by this
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.
-
- Parameters:
subcode- a QName containing the Value of the Subcode.- Throws:
SOAPException- if there was an error in setting the Subcodejava.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Subcode.- Since:
- SAAJ 1.3
getFaultReasonLocales
public java.util.Iterator getFaultReasonLocales()
throws SOAPException
- Returns an
Iteratorover a distinct sequence ofLocales for which there are associated Reason Text items. Any of theseLocales can be used in a call togetFaultReasonTextin order to obtain a localized version of the Reason Text string.
-
- Returns:
- an
Iteratorover a sequence ofLocaleobjects for which there are associated Reason Text items. - Throws:
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.- Since:
- SAAJ 1.3
getFaultReasonTexts
public java.util.Iterator getFaultReasonTexts()
throws SOAPException
- Returns an
Iteratorover a sequence ofStringobjects containing all of the Reason Text items for thisSOAPFault.
-
- Returns:
- an
Iteratorover env:Fault/env:Reason/env:Text items. - Throws:
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.- Since:
- SAAJ 1.3
getFaultReasonText
public java.lang.String getFaultReasonText(java.util.Locale locale)
throws SOAPException
- Returns the Reason Text associated with the given
Locale. If more than one such Reason Text exists the first matching Text is returned
-
- Parameters:
locale- -- theLocalefor which a localized Reason Text is desired- Returns:
- the Reason Text associated with
locale - Throws:
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.- Since:
- SAAJ 1.3
- See Also:
getFaultString()
addFaultReasonText
public void addFaultReasonText(java.lang.String text,
java.util.Locale locale)
throws SOAPException
- Appends or replaces a Reason Text item containing the specified
text message and an xml:lang derived from
locale. If a Reason Text item with this xml:lang already exists its text value will be replaced withtext. Thelocaleparameter should not benullCode sample:
SOAPFault fault = ...;
fault.addFaultReasonText("Version Mismatch", Locale.ENGLISH);
-
- Parameters:
text- -- reason message stringlocale- -- Locale object representing the locale of the message- Throws:
SOAPException- if there was an error in adding the Reason text or thelocalepassed wasnull.java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Reason.- Since:
- SAAJ 1.3
getFaultNode
java.lang.String getFaultNode()
- Returns the optional
Nodeelement value for thisSOAPFaultobject. TheNodeelement is optional in SOAP 1.2.
-
- Returns:
- Content of the env:Fault/env:Node element as a String or
nullif none - Throws:
java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Node.- Since:
- SAAJ 1.3
setFaultNode
public void setFaultNode(java.lang.String uri)
throws SOAPException
- Creates or replaces any existing Node element value for this
SOAPFaultobject. The Node element is optional in SOAP 1.2.
-
- Throws:
SOAPException- if there was an error in setting the Node for thisSOAPFaultobject.java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Node.- Since:
- SAAJ 1.3
getFaultRole
public java.lang.String getFaultRole()
- Returns the optional Role element value for this
SOAPFaultobject. The Role element is optional in SOAP 1.2.
-
- Returns:
- Content of the env:Fault/env:Role element as a String or
nullif none - Throws:
java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Role.- Since:
- SAAJ 1.3
setFaultRole
public void setFaultRole(java.lang.String uri)
throws SOAPException
- Creates or replaces any existing Role element value for this
SOAPFaultobject. The Role element is optional in SOAP 1.2.
-
- Parameters:
uri- - the URI of the Role- Throws:
SOAPException- if there was an error in setting the Role for thisSOAPFaultobject.java.lang.UnsupportedOperationException- if this message does not support the SOAP 1.2 concept of Fault Role.- Since:
- SAAJ 1.3
hasDetail
boolean hasDetail()
- Returns true if this
SOAPFaulthas aDetailsubelement and false otherwise. Equivalent to(getDetail()!=null).
-
- Returns:
- true if this
SOAPFaulthas aDetailsubelement and false otherwise. - Since:
- SAAJ 1.3
C005
javax.xml.soap
Class MessageFactory
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 |
|---|
newInstance
public static MessageFactory newInstance(java.lang.String protocol)
throws SOAPException
- Creates a new
MessageFactoryobject 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 thecreateMessagemethod. This method uses the SAAJMetaFactory to locate the implementation class and create the MessageFactory instance.
-
-
- Parameters:
protocol- a string constant representing the class of the specified message factory implementation. May be eitherDYNAMIC_SOAP_PROTOCOL,DEFAULT_SOAP_PROTOCOL(which is the same as)SOAP_1_1_PROTOCOL, orSOAP_1_2_PROTOCOL.- Returns:
- a new instance of a
MessageFactory - Throws:
SOAPException- if there was an error in creating the specified implementation ofMessageFactory.- See Also:
SAAJMetaFactory- Since:
- SAAJ 1.3
C006
javax.xml.soap
Class SOAPFactory
java.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 |
newInstance
public static SOAPFactory newInstance(java.lang.String protocol)
throws SOAPException
- Creates a new
SOAPFactoryobject that is an instance of the specified implementation, this method uses the SAAJMetaFactory to locate the implementation class and create the SOAPFactory instance.
-
-
- Parameters:
protocol- a string constant representing the protocol of the specified SOAP factory implementation. May be eitherDYNAMIC_SOAP_PROTOCOL, DEFAULT_SOAP_PROTOCOL(which is the same as)SOAP_1_1_PROTOCOL, orSOAP_1_2_PROTOCOL.
- Returns:
- a new instance of a
SOAPFactory - Throws:
SOAPException- if there was an error creating the specifiedSOAPFactory- See Also:
SAAJMetaFactory- Since:
- SAAJ 1.3
Rationale : Facilitate creation of SOAP Version aware SOAPFactory
C007
javax.xml.soap
Interface SOAPConstants
| 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 |
SOAP_VERSIONMISMATCH_FAULT
static final javax.xml.namespace.QName SOAP_VERSIONMISMATCH_FAULT
- SOAP 1.2 VersionMismatch Fault
- Since:
- SAAJ 1.3
SOAP_MUSTUNDERSTAND_FAULT
static final javax.xml.namespace.QName SOAP_MUSTUNDERSTAND_FAULT
- SOAP 1.2 MustUnderstand Fault
- Since:
- SAAJ 1.3
SOAP_DATAENCODINGUNKNOWN_FAULT
static final javax.xml.namespace.QName SOAP_DATAENCODINGUNKNOWN_FAULT
- SOAP 1.2 DataEncodingUnknown Fault
- Since:
- SAAJ 1.3
SOAP_SENDER_FAULT
static final javax.xml.namespace.QName SOAP_SENDER_FAULT
- SOAP 1.2 Sender Fault
- Since:
- SAAJ 1.3
SOAP_RECEIVER_FAULT
static final javax.xml.namespace.QName SOAP_RECEIVER_FAULT
- SOAP 1.2 Receiver Fault
- Since:
- SAAJ 1.3
7)
Proposed Changes for Adding SPI for creation of Factory instances
C008
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
C009
javax.xml.soap
Class SAAJResult
java.lang.Object
javax.xml.transform.dom.DOMResult
javax.xml.soap.SAAJResult
- All Implemented Interfaces:
- javax.xml.transform.Result
-
public class SAAJResult
- extends javax.xml.transform.dom.DOMResult
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.
- Since:
- SAAJ 1.3
| 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 |
|---|
SAAJResult
public SAAJResult()
throws SOAPException
- Creates a
SAAJResultthat will present results in the form of a SAAJ tree that supports the default (SOAP 1.1) protocol.This kind of
SAAJResultis meant for use in situations where the results will be used as a parameter to a method that takes a parameter whose type, such asSOAPElement, is drawn from the SAAJ API. When used in a transformation, the results are populated into theSOAPPartof aSOAPMessagethat is created internally. TheSOAPPartreturned byDOMResult.getNode()is not guaranteed to be well-formed.- Throws:
SOAPException- if there is a problem creating aSOAPMessage- Since:
- SAAJ 1.3
SAAJResult
public SAAJResult(java.lang.String protocol)
throws SOAPException
- Creates a
SAAJResultthat will present results in the form of a SAAJ tree that supports the specified protocol. TheDYNAMIC_SOAP_PROTOCOLis ambiguous in this context and will cause this constructor to throw anUnsupportedOperationException.This kind of
SAAJResultis meant for use in situations where the results will be used as a parameter to a method that takes a parameter whose type, such asSOAPElement, is drawn from the SAAJ API. When used in a transformation the results are populated into theSOAPPartof aSOAPMessagethat is created internally. TheSOAPPartreturned byDOMResult.getNode()is not guaranteed to be well-formed.- Parameters:
protocol- - the name of the SOAP protocol that the resulting SAAJ tree should support- Throws:
SOAPException- if aSOAPMessagesupporting the specified protocol cannot be created- Since:
- SAAJ 1.3
SAAJResult
public SAAJResult(SOAPMessage message)
- Creates a
SAAJResultthat will write the results into an existingSOAPMessage. In the normal case these results will be written using DOM APIs and, as a result, the finishedSOAPPartwill 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.- Parameters:
message- - the message whoseSOAPPartwill be populated as a result of some transformation or marshalling operation- Since:
- SAAJ 1.3
SAAJResult
public SAAJResult(SOAPElement rootNode)
- Creates a
SAAJResultthat will write the results as a child node of theSOAPElementspecified. 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 ofSAAJResultshould only be used when the validity of the incoming data can be guaranteed by means outside of the SAAJ specification.- Parameters:
rootNode- - the root to which the results will be appended- Since:
- SAAJ 1.3
| Method Detail |
|---|
getResult
public Node getResult()
-
- Returns:
- the resulting Tree that was created under the specified root Node.
- Since:
- SAAJ 1.3
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.
9)
Proposed Addition of Overloaded Methods which Accept QName
Instead of Name
C010
javax.xml.soap
Interface Detail
| 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)
Rationale : QName support
C011
javax.xml.soap
Interface SOAPBody
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| 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 |
addFault
SOAPFault addFault(javax.xml.namespace.QName faultCode,
java.lang.String faultString,
java.util.Locale locale)
throws SOAPException
- Creates a new
SOAPFaultobject and adds it to thisSOAPBodyobject. 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 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- aQNameobject giving the fault code to be set; must be one of the fault codes defined in a SOAP specification 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.3
- See Also:
SOAPFault.setFaultCode(javax.xml.soap.Name),SOAPFault.setFaultString(java.lang.String),addFault(Name faultCode, String faultString, Locale locale)
addFault
SOAPFault addFault(javax.xml.namespace.QName faultCode,
java.lang.String faultString)
throws SOAPException
- Creates a new
SOAPFaultobject and adds it to thisSOAPBodyobject. 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- aQNameobject giving the fault code to be set; must be one of the fault codes defined in a SOAP specification and of type QNamefaultString- aStringgiving an explanation of the fault- Returns:
- the new
SOAPFaultobject - Throws:
SOAPException- if there is a SOAP error- Since:
- SAAJ 1.3
- See Also:
SOAPFault.setFaultCode(javax.xml.soap.Name),SOAPFault.setFaultString(java.lang.String),addFault(Name faultCode, String faultString)
addBodyElement
SOAPBodyElement addBodyElement(javax.xml.namespace.QName qname)
throws SOAPException
- Creates a new
SOAPBodyElementobject with the specified QName and adds it to thisSOAPBodyobject.
-
- Parameters:
qname- aQNameobject with the qname for the newSOAPBodyElementobject- Returns:
- the new
SOAPBodyElementobject - Throws:
SOAPException- if a SOAP error occurs- Since:
- SAAJ 1.3
- See Also:
addBodyElement(Name)
Rationale : QName support
C012
javax.xml.soap
Interface SOAPElement
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node
- All Known Subinterfaces:
- Detail, DetailEntry, SOAPBody, SOAPBodyElement, SOAPEnvelope,
SOAPFault, SOAPFaultElement, SOAPHeader, SOAPHeaderElement
| 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. |
java.util.Iterator |
getAllAttributesAsQNames()
Returns an Iterator
over all of the attributes in this SOAPElement as QName
objects. |
| Method Detail |
addChildElement
public SOAPElement addChildElement(javax.xml.namespace.QName qname)
throws SOAPException
- Creates a new
SOAPElementobject initialized with the givenQNameobject and adds the new element to thisSOAPElementobject. The namespace, localname and prefix of the newSOAPElementare all taken from theqnameargument.
-
- Parameters:
qname- aQNameobject 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- Since:
- SAAJ 1.3
- See Also:
addChildElement(Name)
addAttribute
SOAPElement addAttribute(javax.xml.namespace.QName qname,
java.lang.String value)
throws SOAPException
- Adds an attribute with the specified name and value to this
SOAPElementobject.
-
- Parameters:
qname- aQNameobject with the name of the attributevalue- aStringgiving the value of the attribute- Returns:
- the
SOAPElementobject into which the attribute was inserted - Throws:
SOAPException- if there is an error in creating the Attribute, or it is invalid to set an attribute withQNameqnameon this SOAPElement.- Since:
- SAAJ 1.3
- See Also:
addAttribute(Name, String)
getAttributeValue
java.lang.String getAttributeValue(javax.xml.namespace.QName qname)
- Returns the value of the attribute with the specified qname.
-
- Parameters:
qname- aQNameobject with the qname of the attribute- Returns:
- a
Stringgiving the value of the specified attribute, Null if there is no such attribute - Since:
- SAAJ 1.3
- See Also:
getAttributeValue(Name)
createQName
javax.xml.namespace.QName createQName(java.lang.String localName,
java.lang.String prefix)
throws SOAPException
- Creates a
QNamewhose namespace URI is the one associated with the parameter,prefix, in the context of thisSOAPElement. The remaining elements of the newQNameare taken directly from the parameters,localNameandprefix.
-
- Parameters:
localName- aStringcontaining the local part of the name.prefix- aStringcontaining the prefix for the name.- Returns:
- a
QNamewith the specifiedlocalNameandprefix, and with a namespace that is associated with theprefixin the context of thisSOAPElement. This namespace will be the same as the one that would be returned byif it were givengetNamespaceURI(String)prefixas it's parameter. - Throws:
SOAPException- if theQNamecannot be created.- Since:
- SAAJ 1.3
getElementQName
javax.xml.namespace.QName getElementQName()
- Returns the qname of this
SOAPElementobject.
-
- Returns:
- a
QNameobject with the qname of thisSOAPElementobject - Since:
- SAAJ 1.3
- See Also:
getElementName()
setElementQName
public SOAPElement setElementQName(javax.xml.namespace.QName newName)
throws SOAPException
- Changes the name of this
ElementtonewNameif 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
SOAPElementto a renamed instance.
-
- Parameters:
newName- the new name for theElement.- Returns:
- The renamed Node
- Throws:
SOAPException- if changing the name of thisElementis not allowed.- Since:
- SAAJ 1.3
removeAttribute
boolean removeAttribute(javax.xml.namespace.QName qname)
- Removes the attribute with the specified qname.
-
- Parameters:
qname- theQNameobject with the qname of the attribute to be removed- Returns:
trueif the attribute was removed successfully;falseif it was not- Since:
- SAAJ 1.3
- See Also:
removeAttribute(Name)
getAllAttributesAsQNames
java.util.Iterator getAllAttributesAsQNames()
- Returns an
Iteratorover all of the attributes in thisSOAPElementasQNameobjects. The iterator can be used to get the attribute QName, which can then be passed to the methodgetAttributeValueto retrieve the value of each attribute. -
- Returns:
- an iterator over the QNames of the attributes
- Since:
- SAAJ 1.3
- See Also:
getAllAttributes()
getChildElements
java.util.Iterator getChildElements(javax.xml.namespace.QName qname)
- Returns an
Iteratorover all the immediate childNodes of this element with the specified qname. All of these children will beSOAPElementnodes.Calling this method may cause child
Element,SOAPElementandorg.w3c.dom.Textnodes to be replaced bySOAPElement,SOAPHeaderElement,SOAPBodyElementorjavax.xml.soap.Textnodes 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 thisIterator. This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details.
Rationale : QName support
C013
javax.xml.soap
Interface SOAPFault
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPBodyElement,
SOAPElement
| 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 |
getFaultCodeAsQName
javax.xml.namespace.QName getFaultCodeAsQName()
- Gets the fault code for this
SOAPFaultobject as aQNameobject.
-
- Returns:
- a
QNamerepresenting the faultcode - Since:
- SAAJ 1.3
- See Also:
setFaultCode(QName)
setFaultCode
void setFaultCode(javax.xml.namespace.QName faultCodeQName)
throws SOAPException
- Sets this
SOAPFaultobject with the given fault code. It is preferable to use this method oversetFaultCode(Name).
-
- Parameters:
faultCodeQName- aQNameobject giving the fault code to be set. It must be namespace qualified.- Throws:
SOAPException- if there was an error in adding thefaultcodeelement to the underlying XML tree.- Since:
- SAAJ 1.3
- See Also:
getFaultCodeAsQName(),setFaultCode(Name),getFaultCodeAsQName()
Rationale: QName support
C014
javax.xml.soap
Class SOAPFactory
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 |
createElement
public SOAPElement createElement(javax.xml.namespace.QName qname)
throws SOAPException
- Creates a
SOAPElementobject initialized with the givenQNameobject. 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:
qname- aQNameobject 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- Since:
- SAAJ 1.3
- See Also:
createElement(Name)
Rationale : QName support
C015
javax.xml.soap
Interface SOAPHeader
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| 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 |
addHeaderElement
SOAPHeaderElement addHeaderElement(javax.xml.namespace.QName qname)
throws SOAPException
- Creates a new
SOAPHeaderElementobject initialized with the specified qname and adds it to thisSOAPHeaderobject.
-
- Parameters:
qname- aQNameobject with the qname of the newSOAPHeaderElementobject- Returns:
- the new
SOAPHeaderElementobject that was inserted into thisSOAPHeaderobject - Throws:
SOAPException- if a SOAP error occurs- Since:
- SAAJ 1.3
- See Also:
addHeaderElement(Name)
Rationale: QName support
10) Proposed Changes to Clarify and Correct the Wording of JavaDocs and Specification
C016
javax.xml.soap
Class MessageFactory
java.lang.Object
javax.xml.soap.MessageFactory
-
public abstract class MessageFactory
- extends java.lang.Object
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:
- A
SOAPPartobject - A
SOAPEnvelopeobject - A
SOAPBodyobject - A
SOAPHeaderobject
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.
In some cases, specialized MessageFactory objects may be obtained that produce messages prepopulated with additional entries in the
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
This is the method clients would normally use to create a request message.createMessage(MimeHeaders, java.io.InputStream)-- message has content from theInputStreamobject and headers from theMimeHeadersobject
This method can be used internally by a service implementation to create a message that is a response to a request.
C017
javax.xml.soap
Class MessageFactory
java.lang.Object
javax.xml.soap.MessageFactory
Method Detail
newInstance
public static MessageFactory newInstance()
throws SOAPException
- Creates a new
MessageFactoryobject 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:- Use the javax.xml.soap.MessageFactory 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.MessageFactory in jars available to the runtime.
- Use the SAAJMetaFactory instance to locate the MessageFactory implementation class.
-
-
-
- Returns:
- a new instance of a
MessageFactory - Throws:
SOAPException- if there was an error in creating the default implementation of theMessageFactory.- See Also:
SAAJMetaFactory
createMessage
public abstract SOAPMessage createMessage()
throws SOAPException
- Creates a new
SOAPMessageobject with the defaultSOAPPart,SOAPEnvelope,SOAPBody, andSOAPHeaderobjects. Profile-specific message factories can choose to prepopulate theSOAPMessageobject with profile-specific headers.Content can be added to this message's
SOAPPartobject, and the message can be sent "as is" when a message containing only a SOAP part is sufficient. Otherwise, theSOAPMessageobject needs to create one or moreAttachmentPartobjects and add them to itself. Any content that is not in XML format must be in anAttachmentPartobject. -
- Returns:
- a new
SOAPMessageobject - Throws:
SOAPException- if a SOAP error occursjava.lang.UnsupportedOperationException- if the protocol of thisMessageFactoryinstance isDYNAMIC_SOAP_PROTOCOL.
createMessage
public abstract SOAPMessage createMessage(MimeHeaders headers,
java.io.InputStream in)
throws java.io.IOException,
SOAPException
- Internalizes the contents of the given
InputStreamobject into a newSOAPMessageobject and returns theSOAPMessageobject. -
- Parameters:
in- theInputStreamobject 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- Returns:
- a new
SOAPMessageobject containing the data from the givenInputStreamobject - Throws:
java.io.IOException- if there is a problem in reading data from the input streamSOAPException- may be thrown if the message is invalidjava.lang.IllegalArgumentException- if theMessageFactoryrequires one or more MIME headers to be present in theheadersparameter and they are missing.MessageFactoryimplementations forSOAP_1_1_PROTOCOLorSOAP_1_2_PROTOCOLmust not throwIllegalArgumentExceptionfor this reason.
C018
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.
C019
javax.xml.soap
Class SOAPFactory
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 wasDYNAMIC_SOAP_PROTOCOL
C020
javax.xml.soap
Interface SOAPFault
All Superinterfaces: org.w3c.dom.Element, org.w3c.dom.Node, SOAPBodyElement, SOAPElement
-
public interface SOAPFault
- extends SOAPBodyElement
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 |
|---|
getFaultString
public java.lang.String getFaultString()
- Gets the fault string for this
SOAPFaultobject.If this
SOAPFaultis 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;
-
- Returns:
- a
Stringgiving an explanation of the fault - See Also:
setFaultString(String),setFaultString(String, Locale)
getFaultActor
java.lang.String getFaultActor()
- Gets the fault actor for this
SOAPFaultobject.If this
SOAPFaultsupports SOAP 1.2 then this call is equivalent togetFaultRole()
-
- Returns:
- a
Stringgiving the actor in the message path that caused thisSOAPFaultobject - See Also:
setFaultActor(java.lang.String)
setFaultActor
void setFaultActor(java.lang.String faultActor) throws SOAPException
- Sets this
SOAPFaultobject with the given fault actor.The fault actor is the recipient in the message path who caused the fault to happen.
If this
SOAPFaultsupports SOAP 1.2 then this call is equivalent tosetFaultRole(String)
-
- Parameters:
faultActor- aStringidentifying the actor that caused thisSOAPFaultobject- Throws:
SOAPException- if there was an error in adding thefaultActorto the underlying XML tree.- See Also:
getFaultActor()
getDetail
Detail getDetail()
- Returns the optional detail element for this
SOAPFaultobject.A
Detailobject carries application-specific error information related toSOAPBodyElementobjects, the scope of the error information is restricted to faults in theSOAPBodyElementobjects if this is a SOAP 1.1 Fault.
-
- Returns:
- a
Detailobject with application-specific error information if present, null otherwise.
setFaultString
void setFaultString(java.lang.String faultString)
throws SOAPException
- Sets the fault string for this
SOAPFaultobject to the given string.If this
SOAPFaultis part of a message that supports SOAP 1.2 then this call is equivalent to:addFaultReasonText(faultString, Locale.getDefault());
-
- Parameters:
faultString- aStringgiving an explanation of the fault- Throws:
SOAPException- if there was an error in adding thefaultStringto the underlying XML tree.- See Also:
getFaultString()
setFaultString
void setFaultString(java.lang.String faultString,
java.util.Locale locale)
throws SOAPException
- Sets the fault string for this
SOAPFaultobject to the given string and localized to the given locale.If this
SOAPFaultis part of a message that supports SOAP 1.2 then this call is equivalent to:addFaultReasonText(faultString, locale);
-
- Parameters:
faultString- aStringgiving an explanation of the faultlocale- aLocaleobject indicating the native language of thefaultString- Throws:
SOAPException- if there was an error in adding thefaultStringto the underlying XML tree.- Since:
- SAAJ 1.2
- See Also:
getFaultString()
getFaultStringLocale
public java.util.Locale getFaultStringLocale()
- Gets the locale of the fault string for this
SOAPFaultobject.If this
SOAPFaultis 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;
-
- Returns:
- a
Localeobject indicating the native language of the fault string ornullif no locale was specified - Since:
- SAAJ 1.2
- See Also:
setFaultString(String, Locale)
C021
javax.xml.soap
Interface SOAPElement
org.w3c.dom.Element, org.w3c.dom.Node
All Known Subinterfaces:
Detail, DetailEntry, SOAPBody, SOAPBodyElement, SOAPEnvelope, SOAPFault, SOAPFaultElement, SOAPHeader, SOAPHeaderElement
| Method Detail |
|---|
addTextNode
SOAPElement addTextNode(java.lang.String text)
throws SOAPException
- Creates a new
Textobject initialized with the givenStringand adds it to thisSOAPElementobject.
-
- Parameters:
text- aStringobject with the textual content to be added- Returns:
- the
SOAPElementobject into which the newTextobject was inserted - Throws:
SOAPException- if there is an error in creating the newTextobject or if it is not legal to attach it as a child to thisSOAPElement
setEncodingStyle
void setEncodingStyle(java.lang.String encodingStyle)
throws SOAPException
- Sets the encoding style for this
SOAPElementobject to one specified.
-
- Parameters:
encodingStyle- aStringgiving the encoding style- Throws:
java.lang.IllegalArgumentException- if there was a problem in the encoding style being set.SOAPException- if setting the encodingStyle is invalid for this SOAPElement.- See Also:
getEncodingStyle()
Rationale : If this SOAPElement is a SOAP 1.2 element then there are restrictions in SOAP 1.2 as to which elements in SOAP 1.2 may contain this attribute.
getAttributeValue
java.lang.String getAttributeValue(Name name)
name - a Name object with the name of the
attribute
Returns:
a
String giving the value of the specified attribute, Null if there is no such attributeSee Also:
getAttributeValue(javax.xml.namespace.QName)addAttribute
SOAPElement addAttribute(Name name,
java.lang.String value)
throws SOAPException
- Adds an attribute with the specified name and value to this
SOAPElementobject.
-
- Parameters:
name- aNameobject with the name of the attributevalue- aStringgiving the value of the attribute- Returns:
- the
SOAPElementobject into which the attribute was inserted - Throws:
SOAPException- if there is an error in creating the Attribute, or it is invalid to set an attribute withNamenameon this SOAPElement.- See Also:
addAttribute(javax.xml.namespace.QName, String)
Rationale : For example, If this SOAPElement is a SOAP 1.2 element and the attribute has the qualified name env:encodingStyle, then there are restrictions in SOAP 1.2 as to which elements in SOAP 1.2 may contain this attribute.
addChildElement
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. -
This method may be deprecated in a future release of SAAJ in favor of
addChildElement(javax.xml.namespace.QName)
-
- 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:
addChildElement(javax.xml.namespace.QName)
Rationale : The semantics of
this
method was underspecified in the boundary case when the
Namespace URI of the Name is empty ("").addChildElement
SOAPElement addChildElement(java.lang.String localName)
throws SOAPException
- Creates a new
SOAPElementobject initialized with the specified local name and adds the new element to thisSOAPElementobject. The newSOAPElementinherits any in-scope default namespace.
-
- Parameters:
localName- aStringgiving the local name for the element- Returns:
- the new
SOAPElementobject that was created - Throws:
SOAPException- if there is an error in creating theSOAPElementobject
Rationale : The semantics of this method was unclear on the namespace of the new child element.
addChildElement
SOAPElement addChildElement(java.lang.String localName,
java.lang.String prefix)
throws SOAPException
- Creates a new
SOAPElementobject initialized with the specified local name and prefix and adds the new element to thisSOAPElementobject.
-
- Parameters:
localName- aStringgiving the local name for the new elementprefix- aStringgiving the namespace prefix for the new element- Returns:
- the new
SOAPElementobject that was created - Throws:
SOAPException- If theprefixis not valid in the context of thisSOAPElementor if there is an error in creating theSOAPElelementobject.
addChildElement
public SOAPElement addChildElement(SOAPElement element)
throws SOAPException
- Add a
SOAPElementas a child of thisSOAPElementinstance. TheSOAPElementis expected to be created by aSOAPElementFactory. Callers should not rely on the element instance being added as is into the XML tree. Implementations could end up copying the content of theSOAPElementpassed into an instance of a differentSOAPElementimplementation. For instance ifaddChildElement()is called on aSOAPHeader,elementwill be copied into an instance of aSOAPHeaderElement.The fragment rooted in
elementis either added as a whole or not at all, if there was an error.The fragment rooted in
elementcannot 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.
-
- Parameters:
element- theSOAPElementto be added as a new child- Returns:
- an instance representing the new SOAP element that was actually added to the tree.
- Throws:
SOAPException- if there was an error in adding this element as a child
Rationale : SOAPElementFactory has been deprecated
C022
javax.xml.soap
Interface SOAPConstants
The definition of constants pertaining to the SOAP 1.1 protocol.
C023
javax.xml.soap
Interface Name
- public interface Name
A 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.
getQualifiedNamewill return "prefix:LocalName" = "WOMBAT:GetLastTradePrice"getURIwill return "http://www.wombat.org/trader"getLocalNamewill return "GetLastTracePrice"getPrefixwill 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
- See Also:
SOAPEnvelope.createName,SOAPFactory.createName
Rationale: QName is the preferred representation of XML qualified names
C024
javax.xml.soap
Interface SOAPHeader
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| Method Detail |
|---|
examineMustUnderstandHeaderElements
java.util.Iterator examineMustUnderstandHeaderElements(java.lang.String actor)
- Returns an
Iteratorover all theSOAPHeaderElementobjects in thisSOAPHeaderobject that have the specified actor and that have a MustUnderstand attribute whose value is equivalent totrue.In SOAP 1.2 the env:actor attribute is replaced by the env:role attribute, but with essentially the same semantics.
-
- Parameters:
actor- aStringgiving the URI of theactor/rolefor which to search- Returns:
- an
Iteratorobject over all theSOAPHeaderElementobjects that contain the specifiedactor/roleand are marked as MustUnderstand - Since:
- SAAJ 1.2
- See Also:
examineHeaderElements(java.lang.String),extractHeaderElements(java.lang.String),SOAPConstants.URI_SOAP_ACTOR_NEXT
examineHeaderElements
java.util.Iterator examineHeaderElements(java.lang.String actor)
- Returns an
Iteratorover all theSOAPHeaderElementobjects in thisSOAPHeaderobject 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 aSOAPHeaderobject, 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.
-
- Parameters:
actor- aStringgiving the URI of theactor/rolefor which to search- Returns:
- an
Iteratorobject over all theSOAPHeaderElementobjects that contain the specifiedactor/role - See Also:
extractHeaderElements(java.lang.String),SOAPConstants.URI_SOAP_ACTOR_NEXT
extractHeaderElements
java.util.Iterator extractHeaderElements(java.lang.String actor)
- Returns an
Iteratorover all theSOAPHeaderElementobjects in thisSOAPHeaderobject that have the specified actor and detaches them from thisSOAPHeaderobject.This method allows an actor to process the parts of the
SOAPHeaderobject 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.
-
- Parameters:
actor- aStringgiving the URI of theactor/rolefor which to search- Returns:
- an
Iteratorobject over all theSOAPHeaderElementobjects that contain the specifiedactor/role - See Also:
examineHeaderElements(java.lang.String),SOAPConstants.URI_SOAP_ACTOR_NEXT
C025
javax.xml.soap
Interface SOAPHeaderElement
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| Method Detail |
|---|
getActor
java.lang.String getActor()
- Returns the uri of the actor attribute of this
SOAPHeaderElement.If this
SOAPHeaderElementsupports SOAP 1.2 then this call is equivalent togetRole()
-
- Returns:
- a
Stringgiving the URI of the actor - See Also:
setActor(java.lang.String)
setActor
void setActor(java.lang.String actorURI)
- Sets the actor associated with this
SOAPHeaderElementobject to the specified actor. The default value of an actor is:SOAPConstants.URI_SOAP_ACTOR_NEXTIf this
SOAPHeaderElementsupports SOAP 1.2 then this call is equivalent tosetRole(String)
-
- Parameters:
actorURI- aStringgiving the URI of the actor to set- Throws:
java.lang.IllegalArgumentException- if there is a problem in setting the actor.- See Also:
getActor()
C026
javax.xml.soap
Class SOAPMessage
java.lang.Object
javax.xml.soap.SOAPMessage
| Method Detail |
|---|
writeTo
public abstract void writeTo(java.io.OutputStream out)
throws SOAPException,
java.io.IOException
- Writes this
SOAPMessageobject 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,
writeTowrites a MIME-encoded byte stream.Note that this method does not write the transport-specific MIME Headers of the Message
-
- Parameters:
out- theOutputStreamobject to which thisSOAPMessageobject will be written- Throws:
java.io.IOException- if an I/O error occursSOAPException- if there was a problem in externalizing this SOAP message
createAttachmentPart
public AttachmentPart createAttachmentPart(java.lang.Object content,
java.lang.String contentType)
- Creates an
AttachmentPartobject and populates it with the specified data of the specified content type. The type of theObjectshould correspond to the value given for theContent-Type. -
- Parameters:
content- anObjectcontaining the content for thisSOAPMessagetheAttachmentPartobject to be createdcontentType- aStringobject giving the type of content; examples are "text/xml", "text/plain", and "image/jpeg"- Returns:
- a new
AttachmentPartobject that contains the given data - Throws:
java.lang.IllegalArgumentException- may be thrown if the contentType does not match the type of the content object, or if there was noDataContentHandlerobject for the given content object- See Also:
DataHandler,DataContentHandler
C027
setContent
public abstract void setContent(java.lang.Object object,
java.lang.String contentType)
- Sets the content of this attachment part to that of the given
Objectand sets the value of theContent-Typeheader to the given type. The type of theObjectshould correspond to the value given for theContent-Type. This depends on the particular set ofDataContentHandlerobjects in use. -
- Parameters:
object- the Java object that makes up the content for this attachment partcontentType- the MIME string that specifies the type of the content- Throws:
java.lang.IllegalArgumentException- may be thrown if the contentType does not match the type of the content object, or if there was noDataContentHandlerobject for this content object- See Also:
getContent()
11) Proposed Changes Supporting Addition of New Methods in Certain APIs
C028
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
C029
javax.xml.soap
Class SOAPFactory
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 |
createElement
public SOAPElement createElement(org.w3c.dom.Element domElement)throws SOAPException
- Creates a
SOAPElementobject from an existing DOMElement. If the DOMElementthat is passed in as an argument is already aSOAPElementthen this method must return it unmodified without any further work. Otherwise, a newSOAPElementis created and a deep copy is made of thedomElementargument. The concrete type of the return value will depend on the name of thedomElementargument. If any part of the tree rooted indomElementviolates SOAP rules, aSOAPExceptionwill be thrown. -
- Parameters:
domElement- - theElementto be copied.- Returns:
- a new
SOAPElementthat is a copy ofdomElement. - Throws:
SOAPException- if there is an error in creating theSOAPElementobject- Since:
- SAAJ 1.3
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
C030
javax.xml.soap
Interface SOAPBody
- All Superinterfaces:
- org.w3c.dom.Element, org.w3c.dom.Node, SOAPElement
| 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 |
extractContentAsDocument
org.w3c.dom.Document extractContentAsDocument()throws SOAPException
- Creates a new DOM
and sets the first child of thisDocumentSOAPBodyas it's document element. The childSOAPElementis removed as part of the process.
-
- Returns:
- the
representation of theDocumentSOAPBodycontent. - Throws:
SOAPException- if there is not exactly one childSOAPElementof theSOAPBody.- Since:
- SAAJ 1.3
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).
C031
javax.xml.soap
Class SOAPConnection
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 |
get
public SOAPMessage get(java.lang.Object to)Gets a message from a specific endpoint and blocks until it receives,
throws SOAPException
- Parameters:
to- anObjectthat identifies where the request should be sent. Objects of typejava.lang.Stringandjava.net.URLmust be supported.- Returns:
- the
SOAPMessageobject that is the response to the get message request - Throws:
SOAPException- if there is a SOAP error- Since:
- SAAJ 1.3
Rationale : Support for HTTP GET on SOAPConnection
C032
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.Note that reading from the returned InputStream would result in consuming the data in the stream. It is the responsibility of the caller to reset the InputStream appropriately before calling a Subsequent API. If a copy of the raw attachment content is required then the
getRawContentBytes()API should be used instead.
- 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
- See Also:
getRawContentBytes()
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.
12) Proposed Change Making SOAPPart a javax.xml.soap.Node
C033
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.
- Deprecating the Name interface in favor of the QName class.
14) Constant Field Values
C034
Constant Field Values
Contents
- javax.xml.*
| 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" |