Hi,

Good to know the validation mechanism is actually working

But it must be caught by the built in default WebApplicationExceptionMapper.

It was caught but replying with default 500 alone and with no logging was not helpful at all :-) so I added some logging, as well as updated the JAXBElementProvider to try to report some meaninful message - I'll work on making sure it happens not only in case of JAXBElementProvider...The logging is done at the fine level at the moment as I was not sure the higher level will be right as in some cases WebApplicationExceptions might work, perhaps, as part of the overall application flow...
Thanks, Sergey

----- Original Message ----- From: "Miller, David" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 20, 2008 9:29 PM
Subject: RE: restful service schema validation




I ended up writing a custom JAXBElementProvider to log what was going
on.

After fixing my schema's and data (which ended up not being valid), I
could see that validation was failing and the WebApplicationException
being thrown.

But it must be caught by the built in default
WebApplicationExceptionMapper.

Thanks for the response

David


-----Original Message-----
From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
Sent: Friday, 21 November 2008 2:53 AM
To: [email protected]
Subject: Re: restful service schema validation

Hi

apologies for a late response. I finally got a chance to write a system
test yesterday.
One the positive side, I can confirm that I can see valid messages
accepted and invalid ones rejected with the schema validation
being on.

Yes, it's happening for valid messages.

Is it still the case ? If it is, then can you please post either the
original schema or the sample one which is identical in
structure to the original one plus a message sample ?

On the other hand I can confirm that the default
WebApplicationExceptionMapper I added the other day is, by mistake, is
always used
even in the presense of custom WebApplicationExceptionMappers - so it's
been fixed and will be merged shortly. I also updated the
default mapper to do fine-level logging.

Finally I updated the jaxrs.xsd at apache so that one can use
<jaxrs:server>
<jaxrs:schemaLocations>
<jaxrs:schemaLocation>./some.xsd</jaxrs:schemaLocations>
</jaxrs:schemaLocations>
</jaxrs:server>

as opposed to having to explicitly configure a JAXB provider

Cheers, Sergey


----- Original Message ----- From: "Miller, David" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 13, 2008 10:19 PM
Subject: RE: restful service schema validation



Yes, it's happening for valid messages.

I tried the WebApplicationException mapper and it doesn't catch
anything.
When the mapper isn't there, no uncaught exception is logged.

I dont get any message relating to schema validations or JAXB when using
a log level DEBUG and logging interceptors.

So im not sure if it's a validation problem, or some other problem.



-----Original Message-----
From: Sergey Beryozkin [mailto:[EMAIL PROTECTED]
Sent: Thursday, 13 November 2008 8:52 PM
To: [email protected]
Subject: Re: restful service schema validation

Hi

Is it happening for valid messages too ?

I think in 2.1.3  JAXBProvider will now correctly throw
WebApplicationExceptions, wrapping the original exception,
so one option is to do MyExceptionMapper<WebApplicationException> and
register it as a provider in <jaxrs:providers>.

That said, I'll also update JAXBProvider to have a more useful message
and possibly a better HTTP status code when validation errors
occur.

Cheers, Sergey

----- Original Message ----- From: "Miller, David" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, November 13, 2008 12:59 AM
Subject: restful service schema validation


Hi



I'm trying to get schema validation in JAX-RS restful services.

Posting to the service without the schema validation works fine, the
service receives a jaxb unmarshalled object.

But If I add the schema info like below, posting to the services returns
http status 500 with no log messages being created on the server.



How do I see what is going wrong, or handle errors with a interceptor or
exception mapper ?





<jaxrs:server ...



           </jaxrs:providers>

                       <ref bean="jaxbProvider"/>

           </jaxrs:providers>

</jaxrs:server>



<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">

           <property name="schemas">

                       <list>


<value>classpath:/Service.xsd</value>

                       </list>

           </property>

</bean>


************************************************************************
***********************
This message and its attachments may contain legally privileged or
confidential information.
It is intended solely for the named addressee. If you are not the
addressee indicated in this
message or responsible for delivery of the message to the addressee, you
may not copy or deliver
this message or its attachments to anyone. Rather, you should
permanently delete this message
and its attachments and kindly notify the sender by reply e-mail. Any
content of this message
and its attachments which does not relate to the official business of
the sending company must
be taken not to have been sent or endorsed by that company or any of its
related entities. No
warranty is made that the e-mail or attachments are free from computer
virus or other defect.
************************************************************************
***********************





Reply via email to