|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tsik.messaging.SoapMessage
Provides SOAP message processing.
When used for implementing a web service, this class is the complement
of the XmlTransportSoap
class used for implementing web service
clients. It is also possible to use SoapMessage
directly for
implementing a web service client, gateway, or SOAP router, without using
XmlTransportSoap
.
There are two ways of processing SOAP message security information:
Field Summary | |
---|---|
static String |
VERSION_1_1
TODO javadoc. |
static String |
VERSION_1_2
TODO javadoc. |
static String |
VERSION_1_2_2002_12
TODO javadoc. |
Constructor Summary | |
---|---|
SoapMessage(Document doc)
Creates a SOAP message object for a given SOAP document, wrapping the document in a SOAP 1.1 envelope if it doesn't already have one. |
|
SoapMessage(Document doc,
String version)
Creates a SOAP message object for a given SOAP document, wrapping the document in a SOAP envelope if it doesn't already have one. |
Method Summary | |
---|---|
void |
addBody(Element bodyBlock)
Adds the given body block element as the last child of the SOAP Body element. |
void |
addHeader(Element headerBlock)
Adds a SOAP header block before any existing header blocks. |
Document |
extractBody()
Returns a copy of the first child element of the SOAP Body
which is not a fault element. |
Element |
getBody()
Returns the first child element of the SOAP Body which is
not a fault element. |
Document |
getDocument()
Returns the SOAP message document. |
SoapFault |
getFault()
Returns the SOAP fault contained in this message. |
WsHandler[] |
getHandlers()
Returns the handlers, not a copy. |
Element |
getHeader(String namespaceURI,
String localName)
Returns a SOAP header block contained in this message. |
Element[] |
getHeaders()
Returns all SOAP header blocks contained in this message. |
boolean |
getMustUnderstand(Element header)
Returns whether the mustUnderstand attribute is set to true on a header element. |
static String |
getSoapVersion(Document doc)
Returns the SOAP version (envelope namespace) of the given document, or null if the document element is not a SOAP Envelope. |
static String |
getSoapVersion(DOMCursor c)
Returns the SOAP version (envelope namespace) of the element at the given cursor, or null if the element is not a SOAP Envelope. |
static String |
getSoapVersion(DOMCursor c,
boolean translate)
Translates 2002_12 into 2003_05 if requested. |
static String |
getSoapVersion(String uri)
Returns the SOAP version constant for the given namespace, or null if the namespace is not a SOAP Envelope namespace. |
static String |
getSoapVersion(String uri,
boolean translate)
Returns the actual namespace URI, that is, if translation is requested 2002_12 will be returned if it is the SOAP version. |
String |
getVersion()
Returns the SOAP version of the message: VERSION_1_1 or VERSION_1_2 . |
static boolean |
isSoapMessage(Document doc)
Tests whether a document's root element is the SOAP Envelope element. |
void |
process()
Processes the SOAP message with the set of WsHandlers. |
void |
setFault(SoapFault fault)
Adds the given SOAP fault under the SOAP Body element. |
void |
setHeaders(Element[] headerBlocks)
Sets the specified SOAP header blocks, after deleting any existing header blocks. |
void |
setMustUnderstand(Element header,
boolean mustUnderstand)
Sets or clears the mustUnderstand attribute on a header element. |
void |
use(WsHandler[] wsHandlers)
TODO javadoc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String VERSION_1_1
public static final String VERSION_1_2
public static final String VERSION_1_2_2002_12
Constructor Detail |
public SoapMessage(Document doc)
doc
- is a document whose document element is a SOAP envelope or a
body element to be wrapped in a SOAP envelope and SOAP body. This
document will be modified so the user must clone the document if they
need to keep an unmodified copy of it. If the document is empty then
the SOAP body will also be empty.public SoapMessage(Document doc, String version)
doc
- is a document whose document element is a SOAP envelope or a
body element to be wrapped in a SOAP envelope and SOAP body. This
document will be modified so the user must clone the document if they
need to keep an unmodified copy of it. If the document is empty then
the SOAP body will also be empty.version
- is the SOAP version to use in the case where the given
document does not have a SOAP envelope: VERSION_1_1
or VERSION_1_2
.Method Detail |
public void use(WsHandler[] wsHandlers)
wsHandlers
- TODO.public WsHandler[] getHandlers()
public void process()
public static boolean isSoapMessage(Document doc)
doc
- the document containing the SOAP Envelope.
public static String getSoapVersion(Document doc)
doc
- the document containing the SOAP Envelope.
VERSION_1_1
or VERSION_1_2
.public static String getSoapVersion(DOMCursor c)
c
- the cursor pointing at the SOAP Envelope.
VERSION_1_1
or VERSION_1_2
.public static String getSoapVersion(DOMCursor c, boolean translate)
c
- the cursor pointing at the SOAP Envelope.translate
- if true; VERSION_1_2_2002_12 will be returned as
VERSION_1_2; otherwise as VERSION_1_2_2002_12.
VERSION_1_1
or VERSION_1_2
.public static String getSoapVersion(String uri)
Returns the SOAP version constant for the given namespace, or null if the namespace is not a SOAP Envelope namespace.
uri
- is the URI to parse. (Note that
http://www.w3.org/2002/12/soap-envelope
will be returned
as VERSION_1_2
.)
VERSION_1_1
or VERSION_1_2
.public static String getSoapVersion(String uri, boolean translate)
uri
- the namespace URI.translate
- if true; VERSION_1_2_2002_12 will be returned as
VERSION_1_2; otherwise as VERSION_1_2_2002_12.
VERSION_1_1
or VERSION_1_2
.public Document getDocument()
public String getVersion()
VERSION_1_1
or VERSION_1_2
. A reference to one of these version constants is always
returned, so that it may be compared to the constants using ==.
public void setHeaders(Element[] headerBlocks)
Header
element will be created if
necessary.
headerBlocks
- is an array of SOAP header block elements conforming
to the SOAP specification, or null if all header blocks are to be
cleared.public void addHeader(Element headerBlock)
headerBlock
- is a SOAP header block element conforming to the
SOAP specification.public Element[] getHeaders()
public Element getHeader(String namespaceURI, String localName)
namespaceURI
- is the namespace of the element to be returned. A
namespace is required for all SOAP header blocks.localName
- is the local name of the element to be returned. The
local name does not include the namespace prefix.
public void setMustUnderstand(Element header, boolean mustUnderstand)
The attribute value for true is 'true' for a SOAP 1.2 message and '1' for a SOAP 1.1 message.
header
- is a SOAP header element of any type.mustUnderstand
- is true to set the attribute or false to remove
the attribute.public boolean getMustUnderstand(Element header)
The attribute value for true is 'true' for a SOAP 1.2 message and '1' for a SOAP 1.1 message.
header
- is a SOAP header element of any type.
public void setFault(SoapFault fault)
Body
element.
Any existing fault element will first be deleted.
fault
- is the SOAP fault to add, or null to delete the existing
fault only.public SoapFault getFault()
public void addBody(Element bodyBlock)
Body
element.
bodyBlock
- is the body block to add.public Element getBody()
Body
which is
not a fault element.
public Document extractBody()
Body
which is not a fault element. The element is extracted in such a way
that the namespaces defined in SOAP envelope are not included (unless
they are also defined in the body).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |