Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1.12
-
None
-
Unknown
Description
When SOAPFaultException is thrown in an application with SOAP 1.1, the WebFaultOutInterceptor calls getFaultSubcodes method relevant for SOAP 1.2 only and that leads to an error message logged in a server log in case of SOAP 1.1.
Code snippet:
cxf-3.1.10/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/WebFaultOutInterceptor.java
88 public void handleMessage(Message message) throws Fault { 89 Fault f = (Fault)message.getContent(Exception.class); 90 if (f == null) { 91 return; 92 } 93 try { 94 Throwable thr = f.getCause(); 95 SOAPFaultException sf = null; 96 if (thr instanceof SOAPFaultException) { 97 sf = (SOAPFaultException)thr; 98 } else if (thr.getCause() instanceof SOAPFaultException) { 99 sf = (SOAPFaultException)thr.getCause(); 100 } 101 if (sf != null) { 102 if (f instanceof SoapFault) { 103 for (Iterator<QName> it = CastUtils.cast(sf.getFault().getFaultSubcodes()); it.hasNext();) { // <-- here 104 ((SoapFault) f).addSubCode(it.next()); 105 } 106 } 107 if (sf.getFault().getFaultReasonLocales().hasNext()) { 108 Locale lang = (Locale) sf.getFault() 109 .getFaultReasonLocales().next(); 110 String convertedLang = lang.getLanguage(); 111 String country = lang.getCountry(); 112 if (country.length() > 0) { 113 convertedLang = convertedLang + '-' + country; 114 } 115 f.setLang(convertedLang); 116 } 117 message.setContent(Exception.class, f); 118 } 119 } catch (Exception e) { 120 // do nothing; // <- UnsupportedOperationException is swallowed here. 121 } 122 Throwable cause = f.getCause(); 123 WebFault fault = null; 124 if (cause != null) { 125 fault = getWebFaultAnnotation(cause.getClass()); 126 } :
Both SOAP1.1 and 1.2 the "getFaultSubcodes()" is called, but SOAP 1.1 does not have an attribute "faultsubcoded" which leads to the message logged in the log.
The "getFaultSubcodes()" should be called only in case of SOAP1.2 usage.
Attachments
Issue Links
- links to