|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.ws4d.java.types.AttributableSupport
org.ws4d.java.service.Fault
public class Fault
Faults are the web-services correspondents to exceptions from the Java world.
They can be declared on Operations or DefaultEventSources
just like exceptions may be declared on Java methods. A fault has a
name, which must not be null and unique
within the scope of the surrounding operation/event, and an
action URI corresponding to the wsa:Action
property of the fault message within which the fault is sent . The action URI
must also not be null and must be unique within the operation.
However, when creating a user-defined Fault, it is possible to
omit specifying the action URI explicitly as the DPWS framework will provide
an auto-generated one in case it was not set prior to adding the fault to an
operation/event.
A Fault can also carry user-defined data, just like exceptions
can be designed to encapsulate additional state within their instance
variables. Within the Fault, this state is described by means of
its associated element.
It is important to notice that modifications to a fault are not possible
after it has been added to an operation. Calling any of the setter methods at
this time will result in IllegalStateExceptions being thrown.
| Constructor Summary | |
|---|---|
Fault(java.lang.String name)
Creates a fault with the given name, which must be unique
within the scope of the surrounding operation. |
|
Fault(java.lang.String name,
java.lang.String action)
Creates a fault with the given name (must be unique within
the scope of the surrounding operation). |
|
| Method Summary | |
|---|---|
ParameterValue |
createValue()
A shorthand method for creating a suitable data container for this fault's element. |
java.lang.String |
getAction()
Returns the wsa:Action associated to this fault. |
Element |
getElement()
Returns the element of this fault, which defines the type and structure of any user-defined data the fault may contain. |
java.lang.String |
getName()
Returns the name of this Fault. |
void |
setAction(java.lang.String action)
Sets the wsa:Action of this fault. |
void |
setElement(Element element)
Sets the element of this Fault. |
java.lang.String |
toString()
|
| Methods inherited from class org.ws4d.java.types.AttributableSupport |
|---|
equals, getAttribute, getAttributes, hasAttributes, hashCode, serializeAttributes, setAttribute, setAttribute, setAttributes |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Fault(java.lang.String name)
name, which must be unique
within the scope of the surrounding operation. The fault will be assigned
an auto-generated action when it is
added to an operation or event.
name - the name of this fault; unique within the scope of the
surrounding operation
public Fault(java.lang.String name,
java.lang.String action)
name (must be unique within
the scope of the surrounding operation). The action argument
should be a URI representing the wsa:Action associated to this
fault.
name - the name of the fault; unique within the scope of the
surrounding operationaction - the wsa:Action URI of this fault| Method Detail |
|---|
public java.lang.String toString()
toString in class AttributableSupportpublic java.lang.String getAction()
As Faults are always required to have an action URI
associated to them, one will be automatically generated when adding this
Fault to an operation or
event, if it was not specified explicitly.
public void setAction(java.lang.String action)
Fault is added to an
operation or event.
action - the action to set
WS4DIllegalStateException - if the fault is currently attached to
an operation or an eventpublic Element getElement()
create a suitable ParameterValue container
for the actual values when sending messages containing this fault.
setElement(Element)public void setElement(Element element)
Fault. The element describes the
type and contents of a user-defined data structure providing additional
information about the fault. Calling this method after having already
added this Fault to an operation or
event will result in an
IllegalStateException being thrown.
element - the element to set
WS4DIllegalStateException - if the fault is currently attached to
an operation or an eventpublic java.lang.String getName()
Fault. This name must be unique
within the scope of its surrounding operation or event.
public ParameterValue createValue()
ParameterValue.createElementValue(getElement()).
getElement()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||