Hi all,
I wonder if anyone might be able to give me some pointers about using
schema validation in JAX-RS services?
I've currently got spring config:
<bean id="aegisBean"
class="acme.services.ws.databinding.aegis.AegisDatabinding"
scope="singleton"/>
<jaxrs:server id="restServer" address="/rest">
<jaxrs:properties>
<entry key="schema-validation-enabled"><ref
bean="isValidateIncomingEAIMessages" /></entry>
</jaxrs:properties>
<jaxrs:serviceBeans>
<ref bean="bookstoreService" />
</jaxrs:serviceBeans>
<jaxrs:dataBinding><ref
bean="aegisBean"/></jaxrs:dataBinding>
</jaxrs:server>
This does successfully enable schema validation in
AegisSchemaValidationInInterceptor, but I get a null pointer exception:
java.lang.NullPointerException
at
org.apache.cxf.wstx_msv_validation.Stax2ValidationUtils.setupValidation(
Stax2ValidationUtils.java:71)
at
org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl.setupValidatio
n(WoodstoxValidationImpl.java:67)
at
org.apache.cxf.aegis.databinding.AegisSchemaValidationInInterceptor.setS
chemaInMessage(AegisSchemaValidationInInterceptor.java:68)
at
org.apache.cxf.aegis.databinding.AegisSchemaValidationInInterceptor.hand
leMessage(AegisSchemaValidationInInterceptor.java:56)
>From debugging, the XMLStreamReader is null. This is presumably because
somewhere along the way, the JAX-WS service/interceptors set a
XMLStreamReader in the message, but the JAX-RS ones don't.
My next step was going to be creating an interceptor that sets a
XMLStreamReader in the message for any message received whose content is
XML. Is this sensible? Is there something else I should be doing?
Thanks in advance,
James
PS - sorry for the auto-legal-waffle...
Information in this e-mail and any attachments is confidential, and may not be
copied or used by anyone other than the addressee, nor disclosed to any third
party without our permission. There is no intention to create any legally
binding contract or other binding commitment through the use of this electronic
communication unless it is issued in accordance with the Experian Limited
standard terms and conditions of purchase or other express written agreement
between Experian Limited and the recipient. Although Experian has taken
reasonable steps to ensure that this communication and any attachments are free
from computer virus, you are advised to take your own steps to ensure that they
are actually virus free.
Companies Act information: Registered name: Experian Limited. Registered
office: Landmark House, Experian Way, NG2 Business Park, Nottingham, NG80 1ZZ,
United Kingdom. Place of registration: England and Wales. Registered number:
653331