mrayandutta
asked on
Spring Rest Template exception handling
Hi ,
I am using Spring Rest Template for invoking a web service .
I want to handle all types of exceptions returned by Rest Template .
Any body has some proper links/sample code describing the exception handling scenario using Spring Rest Template ?
Regards,
Ayan
I am using Spring Rest Template for invoking a web service .
I want to handle all types of exceptions returned by Rest Template .
Any body has some proper links/sample code describing the exception handling scenario using Spring Rest Template ?
Regards,
Ayan
Hi Mrayandutta
here you go ...
http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch18s02.html
and
http://www.ibm.com/developerworks/webservices/library/wa-spring3webserv/
hope this will help you ...
here you go ...
http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch18s02.html
and
http://www.ibm.com/developerworks/webservices/library/wa-spring3webserv/
hope this will help you ...
ASKER
Hi ,
Thanks to both you for your replies .
@mccarl
In my application there is an Ajax call to a spring controller .
This controller calls RestTemplate and in turn returns the output received from the ResTemplate as the Ajax response .
For any exception occurring at the REST Template end, the controller needs to pass the response code only as the Ajax response .
So if there is any exception in the RestTemplate invocation ,I need to get the response code of the rest template (say 404 or 500 ) and the controller would return the error code to its invoker .
But as the exceptions of Rest Template seems to be unchecked ,this task seems bit complicated .
I hope that explains my scenario a bit .
Regards,
Ayan
Thanks to both you for your replies .
@mccarl
In my application there is an Ajax call to a spring controller .
This controller calls RestTemplate and in turn returns the output received from the ResTemplate as the Ajax response .
For any exception occurring at the REST Template end, the controller needs to pass the response code only as the Ajax response .
So if there is any exception in the RestTemplate invocation ,I need to get the response code of the rest template (say 404 or 500 ) and the controller would return the error code to its invoker .
But as the exceptions of Rest Template seems to be unchecked ,this task seems bit complicated .
I hope that explains my scenario a bit .
Regards,
Ayan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help
No worries!
If the above doesn't help, can you please elaborate more on what you are trying to do, any issues that you are coming across, etc something more specific for us to provide help on?