Internationalization and Character Sets

The default character sets installed with WebLogic, and its default handling, are sufficient in most cases. If a client interacts with a web service specifying its preferred character set, WebLogic will respond using that character set requested by the client. This section looks at how you can take more control over which character set should be used for a web service.

Configuring Web Services

You can explicitly configure the character set to be used by a web service. In effect, this determines the value of the HTTP Content-Type header embedded in the responses sent back to clients of the web service. You can specify the character set in two ways:

  • Modify the web-services.xml descriptor file by adding a charset attribute. Once deployed, the web service will be forced to always use the specified character set:

    <web-service protocol="http" useSOAP12="false" 
                 targetNamespace="http://www.oreilly.com/webservices/Simple"
                 name="Simple" style="rpc" uri="/Simple"
                 charset="Shift_JIS">
    <!-- ... -->
    </web-service>
  • Set the -Dweblogic.webservice.i18n.charset system property in WebLogic’s startup script. However, this character set then will apply to all web services deployed to the server, and you must set this property on each server that hosts the web service.

The character set used for any web service is determined by the following precedence rules. If the charset attribute is set for a web service, it is used. Otherwise, if the client explicitly requests ...

Get WebLogic: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.