You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by akkij <ak...@coreobjects.com> on 2008/11/23 20:35:16 UTC

Error Codes & Error Message handling using CXF

Hi,

For my application (using RESTful web services) we have a requirement for
error cases to respond to user with proper error codes & user friendly
messages. CXF user guide mentiones a small section for Exception handling by
either throwing WebApplicationException or returning Response object with a
proper error code set. 

However i was wondering if CXF maintains messageResources or properties file
for reading error codes and error messages something similar to spring
framework way. If there is any example or sample to show the usage for this
then please point me to the link.

thanks,
Akash
-- 
View this message in context: http://www.nabble.com/Error-Codes---Error-Message-handling-using-CXF-tp20649919p20649919.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAXRS: Error Codes & Error Message handling using CXF

Posted by Sergey Beryozkin <se...@progress.com>.
Hi Akash

CXF does mantains message resources but for its own internal use to make sure error messages can be properly localized,

Can you explain how would you like CXF JAXRS to help, as far as ensuring that WebApplicationExceptions which are thrown contain the 
correct error codes and user-defined messages ?

WebApplicationException can accept a Response which can be built at a time when a new exception is being thrown. Response can take 
status codes and entities and headers. So if it's a user code which throws the exception then some external resource can be checked 
to retrieve a message and thus an approriate Response can be built and supplied to a WebApplicationException instance.

Or do you have something else in mind ?

Cheers, Sergey


>
> Hi,
>
> For my application (using RESTful web services) we have a requirement for
> error cases to respond to user with proper error codes & user friendly
> messages. CXF user guide mentiones a small section for Exception handling by
> either throwing WebApplicationException or returning Response object with a
> proper error code set.
>
> However i was wondering if CXF maintains messageResources or properties file
> for reading error codes and error messages something similar to spring
> framework way. If there is any example or sample to show the usage for this
> then please point me to the link.
>
> thanks,
> Akash
> -- 
> View this message in context: http://www.nabble.com/Error-Codes---Error-Message-handling-using-CXF-tp20649919p20649919.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
> 



Re: Error Codes & Error Message handling using CXF

Posted by Benson Margulies <bi...@gmail.com>.
I have a feeling that this is really a question for the JAX-RS
experts. CXF does use a message catalog system for its own messages,
and you are welcome to use it, too, but I don't see how that will help
you get polite messages into your HTML.

With a protocol like REST, it seems to me that you either need to map
from fault conditions to user-presentable messages in Javascript in
the client, or you need to avoid the protocol's concept of an error --
always 'succeed', but return an error indication and whatever sort of
user-presentable message that you need along with success.

However, caveat, the JAX-RS experts may well arrive and explain that
this is a JAX-RS core capability and I'm confused.


On Sun, Nov 23, 2008 at 2:35 PM, akkij <ak...@coreobjects.com> wrote:
>
> Hi,
>
> For my application (using RESTful web services) we have a requirement for
> error cases to respond to user with proper error codes & user friendly
> messages. CXF user guide mentiones a small section for Exception handling by
> either throwing WebApplicationException or returning Response object with a
> proper error code set.
>
> However i was wondering if CXF maintains messageResources or properties file
> for reading error codes and error messages something similar to spring
> framework way. If there is any example or sample to show the usage for this
> then please point me to the link.
>
> thanks,
> Akash
> --
> View this message in context: http://www.nabble.com/Error-Codes---Error-Message-handling-using-CXF-tp20649919p20649919.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

RE: Error Codes & Error Message handling using CXF

Posted by "CHAKRAVARTHULA, RANGABABU [AG-Contractor/1000]" <ra...@monsanto.com>.
I am not sure if you found a solution for this but did you try writing
your own checked exception and annotating it with
@javax.xml.ws.WebFault?

-----Original Message-----
From: akkij [mailto:akash.jain@coreobjects.com] 
Sent: Sunday, November 23, 2008 1:35 PM
To: users@cxf.apache.org
Subject: Error Codes & Error Message handling using CXF


Hi,

For my application (using RESTful web services) we have a requirement
for
error cases to respond to user with proper error codes & user friendly
messages. CXF user guide mentiones a small section for Exception
handling by
either throwing WebApplicationException or returning Response object
with a
proper error code set. 

However i was wondering if CXF maintains messageResources or properties
file
for reading error codes and error messages something similar to spring
framework way. If there is any example or sample to show the usage for
this
then please point me to the link.

thanks,
Akash
-- 
View this message in context:
http://www.nabble.com/Error-Codes---Error-Message-handling-using-CXF-tp2
0649919p20649919.html
Sent from the cxf-user mailing list archive at Nabble.com.



---------------------------------------------------------------------------------------------------------
This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited.


All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto, including its subsidiaries. The recipient of this e-mail is solely responsible for checking for the presence of "Viruses" or other "Malware". Monsanto, along with its subsidiaries, accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment.
---------------------------------------------------------------------------------------------------------