|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Handlers
HeaderProcessors interface represents the chain of the header processors either for the service endpoint or for the client.
A payload of a SOAP message can be divided into two basic blocks: headers and body. The body carries the actual data; headers transfer meta-information. Some example of headers could be header containing username/password for authentication, header containing routing information or it can contain digital signature of the message body.
In WSO2 SOA Enablement Server, all header processors must implement the HeaderProcessor
interface. Header processors usually read data from the SOAP header and store it in a
CallContext
(which can be obtained via
Current.getCallContext()
). When serializing the SOAP message,
a header processor reads from the CallContext
and creates an
appropriate SOAP header.
The following code snippet shows how to insert a header processor at the client-side:
ServiceClient serviceClient = ServiceClient.create("http://localhost:6060/MyService", MyService.class); serviceClient.getHeaderProcessors().insert(new ClientHeaderProcessor(), HeaderProcessors.DIRECTION_OUT, null, false);
And the following code snippet shows how to insert a header processor at the server-side:
ServiceEndpoint endpoint = ServiceEndpoint.create("/MyService", new MyService()); QName[] understoodHeaders = new QName[]{new QName(HEADER_NAMESPACE, HEADER_LOCAL_PART)}; endpoint.getHeaderProcessors().insert(new ServerHeaderProcessor(), HeaderProcessors.DIRECTION_IN, understoodHeaders, false);
Field Summary | |
static int |
DIRECTION_IN
Deprecated. Constant value representing header processor is used for incoming message |
static int |
DIRECTION_IN_FAULT
Deprecated. Constant value representing header processor is used for incoming fault message |
static int |
DIRECTION_INOUT
Deprecated. Constant value representing header processor is used both for incoming and outgoing message. |
static int |
DIRECTION_OUT
Deprecated. Constant value representing header processor is used for outgoing message |
static int |
DIRECTION_OUT_FAULT
Deprecated. Constant value representing header processor is used for outgoing fault message |
static int |
POSITION_FIRST
Deprecated. Constant value representing the first position in the chain. |
static int |
POSITION_LAST
Deprecated. Constant value representing the last position in the chain. |
Method Summary | |
HeaderProcessor |
get(int position)
Deprecated. Returns header processor instance on given position in the chain. |
int |
getDirection(int position)
Deprecated. Returns direction of the header processor instance on given position in the chain. |
void |
insert(HeaderProcessor instance,
int directions,
boolean needsBody,
Header[] headers,
Schema[] schemata)
Deprecated. Inserts the header processor to the end of the chain with list of understood headers and schemata in use. |
void |
insert(HeaderProcessor instance,
int directions,
QName[] understoodHeaders,
boolean needsBody)
Deprecated. Inserts the header processor to the end of the chain. |
void |
insert(int position,
HeaderProcessor instance,
int directions,
boolean needsBody,
Header[] headers,
Schema[] schemata)
Deprecated. Inserts the header processor at the specified position to the chain with list of understood headers and schemata in use (moving everything on and beyond this position one place further). |
void |
insert(int position,
HeaderProcessor instance,
int directions,
QName[] understoodHeaders,
boolean needsBody)
Deprecated. Inserts the header processor at the specified position to the chain (moving everything on and beyond this position one place further). |
boolean |
needsBody(int position)
Deprecated. Returns true if the header processors in the chain is configured to need the body of the message. |
boolean |
remove(HeaderProcessor instance)
Deprecated. Removes all occurrences of the given header processor's instance from chain. |
void |
remove(int position)
Deprecated. Removes a header processor at the specified position. |
void |
setDirection(int position,
int newDirection)
Deprecated. Sets a new direction for the header processor instance at the given position in the chain. |
int |
size()
Deprecated. Returns the size (number of header processors) of the chain. |
Field Detail |
public static final int DIRECTION_IN
public static final int DIRECTION_OUT
public static final int DIRECTION_INOUT
DIRECTION_INOUT = DIRECTION_IN | DIRECTION_OUT
.
public static final int DIRECTION_IN_FAULT
public static final int DIRECTION_OUT_FAULT
public static final int POSITION_FIRST
public static final int POSITION_LAST
Method Detail |
public HeaderProcessor get(int position) throws java.lang.IndexOutOfBoundsException
position
- index of the header processor
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position => size())public int getDirection(int position) throws java.lang.IndexOutOfBoundsException
Returns direction of the header processor instance on given position in the chain.
The returned direction is bitwise combination of directions: DIRECTION_IN
, DIRECTION_OUT
,
DIRECTION_IN_FAULT
, DIRECTION_OUT_FAULT
).
These directions depend on which end of the service they are viewed from: a header processor that is "in" according to ServiceEndpoint is "out" according to ServiceClient, and vice-versa. The "fault" directions are used for an outgoing message in a service endpoint (the incoming message in a stub) that is a SOAP fault message.
position
- index of the header processor
DIRECTION_IN
, DIRECTION_OUT
,
DIRECTION_IN_FAULT
, DIRECTION_OUT_FAULT
)
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position => size())public void setDirection(int position, int newDirection) throws java.lang.IndexOutOfBoundsException
position
- index of the header processornewDirection
- direction (bitwise combination of directions: DIRECTION_IN
, DIRECTION_OUT
,
DIRECTION_IN_FAULT
, DIRECTION_OUT_FAULT
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position => size())public boolean needsBody(int position) throws java.lang.IndexOutOfBoundsException
position
- position in the header processors chain
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position => size())public void insert(int position, HeaderProcessor instance, int directions, QName[] understoodHeaders, boolean needsBody) throws java.lang.IndexOutOfBoundsException
directions
- directions could be one of DIRECTION_IN
, DIRECTION_OUT
,
DIRECTION_IN_FAULT
, DIRECTION_OUT_FAULT
or their bitwise combinationposition
- position in the header processors chaininstance
- header processor to be addedunderstoodHeaders
- understood headers of this header processor (used when the
header contains attribute mustUnderstands="1"
to determine whether the
header processor can handle this header)needsBody
- true if the header processors with specified position
in the chain needs access to the message body during processing.
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position > size())public void insert(HeaderProcessor instance, int directions, QName[] understoodHeaders, boolean needsBody)
instance
- header processor to be addeddirections
- directions could be one of DIRECTION_IN
, DIRECTION_OUT
,
DIRECTION_IN_FAULT
, DIRECTION_OUT_FAULT
or their bitwise combinationunderstoodHeaders
- understood headers of this header processor (used when the
header contains attribute mustUnderstands="1"
to determine whether the
header processor can handle this header)public void insert(HeaderProcessor instance, int directions, boolean needsBody, Header[] headers, Schema[] schemata)
instance
- header processor to be addeddirections
- bitwise combination of DIRECTION_IN
and DIRECTION_OUT
needsBody
- true if the header processors with specified position
in the chain needs access to the message body during processing.headers
- array of understood headers Header
schemata
- array of schemata it use Schema
. If
you don't want to specify any schema, you can supply null
for this parameter.public void insert(int position, HeaderProcessor instance, int directions, boolean needsBody, Header[] headers, Schema[] schemata) throws java.lang.IndexOutOfBoundsException
position
- position in the header processors chain,
constants POSITION_FIRST
, POSITION_LAST
can be usedinstance
- header processor to be addeddirections
- bitwise combination of DIRECTION_IN
and DIRECTION_OUT
needsBody
- true if the header processors with specified position
in the chain needs access to the message body during processing.headers
- array of understood headers Header
schemata
- array of schemata it use Schema
. If
you don't want to specify any schema, you can supply null
for this parameter.
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position > size())public void remove(int position) throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException
- if position is if out of range (position < 0 || position => size())public int size()
public boolean remove(HeaderProcessor instance)
instance
- instance of the header processor to be removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |