Description
401 and 407 exceptions can be cumbersome to fix due to unclear message like "java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode". The most difficult trick is to figure out whether the conduit you configured is actually used or if is a default one due to a naming mistake.
The ideas of this enhancement are to add the url, http response code & message and the username that was used. When username is not defined, give the conduit name to ease fixing conduit naming mistakes.
401 : authentication exception
Current exception message for 401 with invalid login/password
javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy69.sayHi(Unknown Source) ... Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1134) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373) ...
New exception message for 401 with invalid login/password
javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy69.sayHi(Unknown Source) ... Caused by: java.io.IOException: HTTP response '401: Unauthorized' invoking http://example.com/services/myService with authorization username 'john' at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2027) ... Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1134) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373) ...
New exception message for 401 with missing login/password
javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy69.sayHi(Unknown Source) ... Caused by: java.io.IOException: HTTP response '401: Unauthorized' invoking http://example.com/services/myService with NO authorization username configured in conduit {http://ws.example.com/}MyServicePort.http-conduit at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2027) ... Caused by: java.net.HttpRetryException: cannot retry due to server authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1134) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373) ...
407 : proxy authentication exception
Current exception message for 407 with invalid login/password
javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy69.sayHi(Unknown Source) ... Caused by: java.net.HttpRetryException: cannot retry due to proxy authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1082) ...
Current exception message for 407 with invalid login/password
javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy69.sayHi(Unknown Source) ... Caused by: java.io.IOException: HTTP response '407: Proxy Authentication Required' invoking http://localhost:8080/jmx-demo/exception/407 with proxy authorization username 'john' using HTTP proxy localhost:8888 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2028) ... Caused by: java.net.HttpRetryException: cannot retry due to proxy authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1082) ...
Current exception message for 407 with missing login/password
javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) at $Proxy69.sayHi(Unknown Source) ... Caused by: java.io.IOException: HTTP response '407: Proxy Authentication Required' invoking http://localhost:8080/jmx-demo/exception/407 with NO proxy authorization configured in conduit {http://ws.example.com/}MyServicePort.http-conduit using HTTP proxy localhost:8888 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2028) ... Caused by: java.net.HttpRetryException: cannot retry due to proxy authentication, in streaming mode at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1082) ...