You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/07/25 14:10:00 UTC

[jira] [Commented] (CXF-7453) WebFaultOutInterceptor calls getFaultSubcodes() even in case of SOAP1.1 faults

    [ https://issues.apache.org/jira/browse/CXF-7453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16100083#comment-16100083 ] 

ASF GitHub Bot commented on CXF-7453:
-------------------------------------

GitHub user istudens opened a pull request:

    https://github.com/apache/cxf/pull/296

    CXF-7453 check subCodes only in case of SOAP 1.2

    Restricts handling SOAPFaultException subCodes  and reasonLocales only for SOAP 1.2 and skipping those in case of SOAP 1.1.
    
    https://issues.apache.org/jira/browse/CXF-7453

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/istudens/cxf CXF-7453

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cxf/pull/296.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #296
    
----
commit 4381941b64afaebf2fde86152f383adb5a9c420f
Author: Ivo Studensky <is...@redhat.com>
Date:   2017-07-25T14:04:34Z

    CXF-7453 check subCodes only in case of SOAP 1.2

----


> WebFaultOutInterceptor calls getFaultSubcodes() even in case of SOAP1.1 faults
> ------------------------------------------------------------------------------
>
>                 Key: CXF-7453
>                 URL: https://issues.apache.org/jira/browse/CXF-7453
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 3.1.12
>            Reporter: Ivo Studensky
>
> 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:
> {code:java|title=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         }
>  :
> {code}
> 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. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)