You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by ja...@external.t-mobile.at on 2008/06/05 21:39:23 UTC
schema validation [Virus checked]
Hello,
1)
is it somehow possible to get marshaled xml, which was not valid when
schema validation was turned on and fault was generated because of this?
In fact i want to log this incorrect XML somehow, because from validation
error message it's sometimes (in very complex schemas) quite hard or
impossible to say what exactly was wrong.
I'm nearly sure that it wasn't possible in 2.1, because validation was
done on the fly as request was serialized. But maybe after Dans fix it's
possible now. .... ok I checked the change, and IMHO also now it's not
simply possible. If i want to do it, i have to hack
AbstractOutDatabindingInterceptor and in case of validation error to write
message once again without validation to temporary XmlStreamWriter and
then store it somewhere, so i can access it later.
2)
it it possible to programatically disable/enable schema validation
individually for each endpoint?
best regards
jano
Re: schema validation [Virus checked]
Posted by Daniel Kulp <dk...@apache.org>.
Yea, I don't think (1) is possible. The validation is still on the
fly (that's the way JAXB works), we just store the xml events and
replay them if successfull.
For 2, there are a bunch of options (I've read your reply already).
You set the property (as a boolean or "true" string in a variety of
places. It's just a matter of getting it there.
Couple thoughts:
1) You could create a ServerLifeCycleListener and register it with the
manager. Then, you'll get notices when a server starts up. You can
record them and wire them into your page or into JMX or something.
You're "check box" could just set the validation flag directly on the
Server object that is passed in.
2) You could put an Interceptor that runs before the databinding stuff
that looks up any custom object or interface or something and calls
message.set(Message.SCHEMA_VALIDATION_ENABLED, en.isDoValidation())
The databinding interceptors would get that information without
needing to change them. One interesting thing about this:
depending on where you stick this in the interceptor chain, you COULD
do validation on a per-operation level. The BindingOperationInfo
object (stored in the exchange once it's known) could hold your
validation object. Your interceptor could also do something like
look it up in a JMX control or something.
Dan
On Jun 5, 2008, at 3:39 PM, jan.minaroviech@external.t-mobile.at wrote:
> Hello,
>
> 1)
> is it somehow possible to get marshaled xml, which was not valid when
> schema validation was turned on and fault was generated because of
> this?
> In fact i want to log this incorrect XML somehow, because from
> validation
> error message it's sometimes (in very complex schemas) quite hard or
> impossible to say what exactly was wrong.
> I'm nearly sure that it wasn't possible in 2.1, because validation was
> done on the fly as request was serialized. But maybe after Dans fix
> it's
> possible now. .... ok I checked the change, and IMHO also now it's not
> simply possible. If i want to do it, i have to hack
> AbstractOutDatabindingInterceptor and in case of validation error to
> write
> message once again without validation to temporary XmlStreamWriter and
> then store it somewhere, so i can access it later.
>
> 2)
> it it possible to programatically disable/enable schema validation
> individually for each endpoint?
>
> best regards
> jano
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Antwort: schema validation & service list [Virus checked]
Posted by ja...@external.t-mobile.at.
Hi again,
it there will be problem with 1) i'm thinking about creating a web page
(maybe extension of service list page) with possibility to simply switch
validation on and off per service (but also for client stubs)
my answer to 2) is yes ... if i can get the corresponding object.
e.g. in ServletController it's like
for (ServletDestination sd : destinations) {
((org.apache.cxf.transport.ChainInitiationObserver)sd.getMessageObserver()).getEndpoint()
and on this one i can call get / put
of course some NPE and classcast has to be avoided by some conditions, and
also it's not general solution.
but hopefully there is somewhere a list of all endpoints and conduits on
single place .. so i'm not dependent on transport etc. and i can configure
properties for endpoints and also for transports.
Is there?
another idea ...
checking if schema validation is enabled is done using code like this one:
Object en = message.getContextualProperty(Message.
SCHEMA_VALIDATION_ENABLED);
if (Boolean.TRUE.equals(en) || "true".equals(en)) {
... do something
}
my idea is to change this check to use e.g.
if (Boolean.TRUE.equals(en) || "true".equals(en) || ((en instanceOf !=
newXyzIntf) && (en.isDoValidation()))) {
then i can configure client and also provider endpoints with custom
objects (which could be registered somewhere on centralized place, and
from this place i can turn validation on and off).
maybe all of this is too custom and not good for cxf in general ... in
this case, just stop me.
best regards
jano
jan.minaroviech@external.t-mobile.at
06/05/2008 21:39
Bitte antworten an
users@cxf.apache.org
An
users@cxf.apache.org
Kopie
Thema
schema validation [Virus checked]
Hello,
1)
is it somehow possible to get marshaled xml, which was not valid when
schema validation was turned on and fault was generated because of this?
In fact i want to log this incorrect XML somehow, because from validation
error message it's sometimes (in very complex schemas) quite hard or
impossible to say what exactly was wrong.
I'm nearly sure that it wasn't possible in 2.1, because validation was
done on the fly as request was serialized. But maybe after Dans fix it's
possible now. .... ok I checked the change, and IMHO also now it's not
simply possible. If i want to do it, i have to hack
AbstractOutDatabindingInterceptor and in case of validation error to write
message once again without validation to temporary XmlStreamWriter and
then store it somewhere, so i can access it later.
2)
it it possible to programatically disable/enable schema validation
individually for each endpoint?
best regards
jano