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.
19.10.1 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:
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 a character set, it is used instead. If neither of these values is set, the weblogic.webservice.i18n.charset system property is used (if it is set). If none of these conditions holds, WebLogic use the default character set for the JVM. If the JVM property user.language is set to en, the US-ASCII character set it used. If the property is set to anything else, UTF-8 is used instead.
Thus, if the Content-Type HTTP header of the SOAP request has been set, WebLogic will use the specified character set. If the Accept-Charset HTTP header has been set instead, WebLogic will use this preferred character set, provided you've not configured a charset attribute for the web service. SOAP 1.2 requests may have an encoding attribute in their XML declaration, such as . The character set specified by this attribute is used, provided there is no Content-Type header in the SOAP request. For SOAP 1.1 requests, the encoding attribute is ignored.
19.10.2 Configuring Client Applications
Clients can use the weblogic.webservice.binding.BindingInfo class to set the Content-Type or Accept-Charset HTTP headers. As we just learned, these headers don't guarantee that the same character set will be used for the response. Here is how to specify the preferred character set:
BindingInfo info = (BindingInfo)stub._getProperty("weblogic.webservice.bindinginfo" ); info.setCharset("UTF-8" ); // This sets the Content-Type info.setAcceptCharset("UTF-8"); // This sets the Accept-Charset port.makeUpper("Lang maande lê die reënboog in 'n miershoopgat gekrul");
Managing the Web Server
Using JNDI and RMI
Using CMP and EJB QL
Packaging and Deployment
Performance, Monitoring, and Tuning
Logging and Internationalization