Results 1 to 3 of 3

Thread: Locale support for faults?

  1. #1
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default 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. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    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.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Mar 2006
    Location
    Germany, Karlsruhe
    Posts
    157

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •