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

iris ding commented on CXF-5711:
--------------------------------

Hi Aki,

Thanks for looking at this issue.  From my understanding SOAP should follow XML 
standard no matter it is on JDK6 or JDK7. So we need to change in CXF to use 
"-" as connector.
The work flow for this is:
1. In Server's OUT Flow, WebFaultOutInterceptor will be called, and we set the 
language as "en-US" format via:
            if (sf.getFault().getFaultReasonLocales().hasNext()) {
                          Locale lang = (Locale) sf.getFault()
                               .getFaultReasonLocales().next();
                          String convertedLang = lang.getLanguage();
                          String country = lang.getCountry();
                          if (country.length() > 0) {
                                convertedLang = convertedLang + '-' + country;
                          }
                          f.setLang(convertedLang);
                    }

2. In Server's OUT Flow, Soap12FaultOutInterceptor is called to marshal the 
fault as "en-US" format: 
               String lang = f.getLang();
                if (lang == null || lang.equalsIgnoreCase("")) {
                    lang = getLangCode();
                }
                writer.writeAttribute("xml", 
"http://www.w3.org/XML/1998/namespace";, "lang", lang);

3. In Client's IN Flow, Soap12FaultInInterceptor is called to unmarshal the 
fault following "en-US" format:
                               lang = (String) 
xu.getValue("//s:Fault/s:Reason/s:Text/@xml:lang", 
                                             fault,
                                             XPathConstants.STRING);
                               fault.setLang(lang);

4. IN JaxWsClientProxy.invoke, call stringToLocale() to create a new Locale 
Object:
 private static Locale stringToLocale(String locale) {
        String parts[] = locale.split("-", -1);
        if (parts.length == 1) {
            return new Locale(parts[0]);
        } else if (parts.length == 2) {
            return new Locale(parts[0], parts[1]);
        } else {
            return new Locale(parts[0], parts[1], parts[2]);
        }
    }

So the patch should work well for both JDK6 and JDK7.

Thanks & Best Regards,
Iris Ding


> SOAP 1.2 fault reason xml:lang attribute  should follow XML standard
> --------------------------------------------------------------------
>
>                 Key: CXF-5711
>                 URL: https://issues.apache.org/jira/browse/CXF-5711
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 3.0.0-milestone1, 2.7.10, 2.6.14
>            Reporter: iris ding
>            Assignee: Aki Yoshida
>             Fix For: 3.0.0
>
>         Attachments: 5711.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to