Announcement Announcement Module
Collapse
No announcement yet.
Locale support for faults? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Locale support for faults?

    Hi,

    if i use this method to create a fault, i can add a locale element.
    Code:
    soapBody().addClientOrSenderFault(myFault.getMessage(), Locale.ENGLISH);
    But if i look into Soap1.2 spec, they support multiple reason strings with different languages:
    Code:
    <env:Reason>
      <env:Text xml:lang="en-US">Processing error</env:Text>
      <env:Text xml:lang="cs">Chyba zpracování</env:Text>
    </env:Reason>
    <env:Detail>...
    But the javadoc of "addClientOrSenderFault" says:
    Adding a fault removes the current content of the body.
    This would mean, i can't add fault reasons in different languages.

    Cheers,

    Ingo

  • #2
    Adding a fault removes the content, but adding fault strings doesn't. So, you can add multiple message to an existing SoapFault. To do this, you must keep a reference to the SoapFault instance returned by addClientOrSenderFault. Then, you can cast this to either Soap11Fault, or Soap12Fault, and add localized messages there.

    Comment


    • #3
      Ah,

      that's good to know.
      You are a great help.
      I creating a product which will support (nearly) all european languages. Do you suggest to use the SOAP1.2 feature of lang attributes at fault reasons?
      Or should i convert the error message in my application fault handler to the correct language(the preferred language of a user is stores in my database)?

      Cheers,

      Ingo

      Comment

      Working...
      X