|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
This interface represents configuration for message validation. It is a crucial part of runtime API for configuring validations. Currently you can configure whether to validate input or output, and what kind of validation is performed - the only supported kind at this moment is simpletypes validation.
The common scenario on both client and server side is:
DIRECTION_IN - only validation of the incoming (deserialized) messages is performedDIRECTION_OUT - only validation of the outgoing (serialized) messages is performedDIRECTION_ALL - validation of both incoming and outgoing messages is performed
DIRECTION_NONE - no validation is performed
VT_SIMPLE_TYPES). This value must be set, otherwise no validation would be
performed (VT_SIMPLE_TYPES is not the default value).
...
// obtaining an instance of service endpoint
ServiceEndpoint serviceEndpoint = ServiceEndpoint.create(SERVICE_PATH, serviceClass);
// configuring server side validation against xml schema
ValidationConfig config = (ValidationConfig) Configurator.newRuntimeConfigurable().narrow(ValidationConfig.class);
// set the direction of validations
config.setDirection(ValidationConfig.DIRECTION_ALL);
// set the type of validation
config.setValidationType(ValidationConfig.VT_SIMPLE_TYPES);
// applying validation configuration to endpoint that will be published
serviceEndpoint.getContext().getContextData().put(ValidationConfig.CONTEXT_KEY, config);
...
...
// create instance of service client
ServiceClient client = ServiceClient.create(SERVICE_PATH + "/wsdl");
// set different parameters on the client
...
// create an instance of validation config
ValidationConfig config = (ValidationConfig) Configurator.newRuntimeConfigurable().narrow(ValidationConfig.class);
// set the direction of validations
config.setDirection(ValidationConfig.DIRECTION_IN);
// set the type of validation
config.setValidationType(ValidationConfig.VT_SIMPLE_TYPES);
// applying validation configuration for the client
client.getContext().getContextData().put(ValidationConfig.CONTEXT_KEY, config);
...
| Field Summary | |
static java.lang.String |
CONTEXT_KEY
under this key, there may be stored class implementing ValidationConfig in the context - on client side it is in ServiceClientContext
and on server side it is in
ServiceEndpointContext. |
static int |
DIRECTION_ALL
validation is performed in both directions |
static int |
DIRECTION_IN
validation is performed only during deserialization |
static int |
DIRECTION_NONE
no validation is performed |
static int |
DIRECTION_OUT
validation is performed only during serialization |
static int |
VT_MINOCCURS
validation of minOccurs attribute that is defined in XML Schema for elements;
e.g. |
static int |
VT_NILLABLE
validation of nillable attribute that is defined in XML Schema for elements;
e.g. |
static int |
VT_SIMPLE_TYPES
validation of simple types |
| Method Summary | |
int |
getDirection()
returns set direction |
int |
getValidationType()
sets type of the validation performed |
void |
setDirection(int direction)
sets direction in which validation should be performed |
void |
setValidationType(int validationType)
sets type of the validation performed |
| Field Detail |
public static final java.lang.String CONTEXT_KEY
ServiceClientContext
and on server side it is in
ServiceEndpointContext.
public static final int DIRECTION_NONE
public static final int DIRECTION_IN
public static final int DIRECTION_OUT
public static final int DIRECTION_ALL
public static final int VT_SIMPLE_TYPES
public static final int VT_NILLABLE
nillable attribute that is defined in XML Schema for elements;
e.g. it is not valid to deserialize element with attribute xsi:nil
if element definition in XML Schema forbids it
public static final int VT_MINOCCURS
minOccurs attribute that is defined in XML Schema for elements;
e.g. it is not valid to deserialize empty element as empty object (object
whose attributes are initialized to default values(nulls))
if element definition in XML Schema mandates non-empty content
| Method Detail |
public int getDirection()
DIRECTION_ALL, DIRECTION_IN, DIRECTION_NONE or
DIRECTION_OUTpublic void setDirection(int direction)
direction - see the static members (e.g. DIRECTION_ALL,
DIRECTION_IN, DIRECTION_NONE or DIRECTION_OUT).public int getValidationType()
VT_SIMPLE_TYPES)public void setValidationType(int validationType)
validationType - type of the validation to perform (e.g. VT_SIMPLE_TYPES)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||