Re: Improving user error messages for failed webservice connection?
2008/12/11 Daniel Kulp dk...@apache.org I THINK with CXF 2.0.9/2.1.3 (might be the latest SNAPSHOTS, don't remember exactly when I fixed this), when you catch the WebServiceException from the call, the cause will be the real cause (like the IOException) that could be examined for more information. Yes it does, but the only way to differentiate between a 403 (eg invalid authorization), invalid URL, etc is to PARSE the message for the IO exception, not exactly elegant... ;-) (but I do that now) Would be a reasonable future change to send some more specific exceptions? For instance including the HTTP error as a separate field etc? or even create some more specific exceptions for the most interesting ones?
Re: Improving user error messages for failed webservice connection?
? I would like to catch at least the following situations and give an application generated error message: - Incorrect authorization - Server unavailable/wrong address etc I THINK with CXF 2.0.9/2.1.3 (might be the latest SNAPSHOTS, don't remember exactly when I fixed this), when you catch the WebServiceException from the call, the cause will be the real cause (like the IOException) that could be examined for more information. -- Daniel Kulp dk...@apache.org http://dankulp.com/blog -- View this message in context: http://www.nabble.com/Improving-user-error-messages-for-failed-webservice-connection--tp20951772p21018900.html Sent from the cxf-user mailing list archive at Nabble.com.
Improving user error messages for failed webservice connection?
We have several application that are configured to connect to a webservice interface for our server. Naturally, it happens that this connection is sometimes configured incorrectly or maybe the server is down etc Unfortunately, this gives very bad and hard to read errors in the logs! For instance, if the wrong http authorization has been set, the following exception will typically be generated: org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221) ... Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: ... at sun.reflect.GeneratedConstructorAccessor43.newInstance(Unknown Source) ... Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: ... at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1170) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:367) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1904) ... 33 more (furthermore this is logged inside the MessageSenderInterceptor, is there any way to turn this off?) How can we make this a bit more user friendly? I would like to catch at least the following situations and give an application generated error message: - Incorrect authorization - Server unavailable/wrong address etc Also, is there any nice and reliable way to ping a webservice server via CXF, without having to call a proper webservice function? Thanks for any help! -- Kent Närling System Architect SEAMLESS Dalagatan 100, 8 tr, 113 43 Stockholm, Sweden Phone: +46 8 5648 7800, fax: +46 8 5648 7823 Mobile: +46 70 836 9925 Mail: [EMAIL PROTECTED] www.seamless.se
Re: Improving user error messages for failed webservice connection?
2008/12/11 Kent Närling [EMAIL PROTECTED]: Also, is there any nice and reliable way to ping a webservice server via CXF, without having to call a proper webservice function? Well, you can request the WSDL: http://example.org:8080/my-web-app-war/services/MyService?wsdl This ensures that the webserver is alive, the war file has deployed to it successfully, and the servlet is responding to incoming HTTP requests without throwing an exception. So I guess it fills the role of a basic ping pretty well. Andrew.
Re: Improving user error messages for failed webservice connection?
2008/12/11 Andrew Clegg [EMAIL PROTECTED] 2008/12/11 Kent Närling [EMAIL PROTECTED]: Also, is there any nice and reliable way to ping a webservice server via CXF, without having to call a proper webservice function? Well, you can request the WSDL: http://example.org:8080/my-web-app-war/services/MyService?wsdl Good idea! Is there any easy way of triggering this through CXF? Or do I have to make my own http connection etc? http://example.org:8080/my-web-app-war/services/MyService?wsdl This ensures that the webserver is alive, the war file has deployed to it successfully, and the servlet is responding to incoming HTTP requests without throwing an exception. So I guess it fills the role of a basic ping pretty well. Andrew.
Re: Improving user error messages for failed webservice connection?
2008/12/11 Kent Närling [EMAIL PROTECTED]: 2008/12/11 Andrew Clegg [EMAIL PROTECTED] Well, you can request the WSDL: http://example.org:8080/my-web-app-war/services/MyService?wsdl Good idea! Is there any easy way of triggering this through CXF? Or do I have to make my own http connection etc? Do you mean CXF on the server side or the client side? I thought you meant the server but maybe not. But in either case, I'm not sure but I don't think so. Since it's not actually a WS call you'd probably have to use a raw HTTP connection, not too tricky though :-) Andrew.
Re: Improving user error messages for failed webservice connection?
2008/12/11 Andrew Clegg [EMAIL PROTECTED] 2008/12/11 Kent Närling [EMAIL PROTECTED]: 2008/12/11 Andrew Clegg [EMAIL PROTECTED] Well, you can request the WSDL: http://example.org:8080/my-web-app-war/services/MyService?wsdl Good idea! Is there any easy way of triggering this through CXF? Or do I have to make my own http connection etc? Do you mean CXF on the server side or the client side? I thought you meant the server but maybe not. Client side But in either case, I'm not sure but I don't think so. Since it's not actually a WS call you'd probably have to use a raw HTTP connection, not too tricky though :-) Ok, no problem Do you have any feedback on my other question regarding logging and error handling?
Re: Improving user error messages for failed webservice connection?
2008/12/11 Kent Närling [EMAIL PROTECTED]: Do you have any feedback on my other question regarding logging and error handling? Unfortunately not, I'm sure someone else here will have a suggestion though. Andrew.
Re: Improving user error messages for failed webservice connection?
On Thursday 11 December 2008 3:57:24 am Kent Närling wrote: We have several application that are configured to connect to a webservice interface for our server. Naturally, it happens that this connection is sometimes configured incorrectly or maybe the server is down etc Unfortunately, this gives very bad and hard to read errors in the logs! ... (furthermore this is logged inside the MessageSenderInterceptor, is there any way to turn this off?) Actually, it's not logged there. There isn't any log statements in the MessageSenderInterceptor. It's PROBABLY logged in the PhaseInterceptorChain.In anycase, you can use the standard java.util.logging configs to to reduce the logging level for the PhaseInterceptorChain or similar which should solve that. How can we make this a bit more user friendly? I would like to catch at least the following situations and give an application generated error message: - Incorrect authorization - Server unavailable/wrong address etc I THINK with CXF 2.0.9/2.1.3 (might be the latest SNAPSHOTS, don't remember exactly when I fixed this), when you catch the WebServiceException from the call, the cause will be the real cause (like the IOException) that could be examined for more information. -- Daniel Kulp [EMAIL PROTECTED] http://dankulp.com/blog