You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org> on 2004/11/24 21:47:31 UTC

[jira] Commented: (AXIS-1682) setting CHARACTER_SET_ENCODING in org.apache.axis.client.Call

     [ http://nagoya.apache.org/jira/browse/AXIS-1682?page=comments#action_55834 ]
     
Davanum Srinivas commented on AXIS-1682:
----------------------------------------

Steve, AFAIK, that's the recommendation from WS-I Basic Profile not the soap spec.

> setting CHARACTER_SET_ENCODING in org.apache.axis.client.Call
> -------------------------------------------------------------
>
>          Key: AXIS-1682
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1682
>      Project: Axis
>         Type: Improvement
>     Versions: 1.2
>  Environment: Mac OS X 10.3.6, Axis 1.2RC2, Resin 2.1.12
>     Reporter: Bernard Bernstein

>
> I wanted to be able to call my Axis server through an ISO-8859-1 encoding, but there was no easy way to set that from the client end of things. I noticed that the server will respond appropriately when the request came that way, but I was not able to test it.
> This feature is very easy to add to org.apache.axis.client.Call
> Here is my patch for version 1.2RC2:
> I added a new property:
>     public static final String CHARACTER_SET_ENCODING    = SOAPMessage.CHARACTER_SET_ENCODING;
> and made the appropriate changes in the property checking code.
> Then in invoke(SOAPEnvelope), it sets the message CHARACTER_SET_ENCODING to the one set in the Call.
>             if (getProperty(CHARACTER_SET_ENCODING) != null) {
>                 msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, getProperty(CHARACTER_SET_ENCODING));
>             }
> To use it, you'd just use the setProperty() method to set the Call.CHARACTER_SET_ENCODING property to whatever character encoding you want before invoking the call.
> eg:
> call.setProperty(Call.CHARACTER_SET_ENCODING, "ISO-8859-1");
> Here's the complete diff -u for my change from the distributed version of Call.java in 1.2RC2 (hope the wrapping works out, I'm new here):
> --- Call.java   Tue Nov 16 13:04:43 2004
> +++ /org/apache/axis/client/Call.java       Fri Nov 19 09:24:19 2004
> @@ -113,6 +113,8 @@
>   *     TIMEOUT        - Timeout used by transport sender in milliseconds
>   *     TRANSPORT_NAME - Name of transport handler to use
>   *     ATTACHMENT_ENCAPSULATION_FORMAT- Send attachments as MIME the default, or DIME.
> + *     CHARACTER_SET_ENCODING - Character set encoding to use for request
> + *
>   * </pre>
>   *
>   * @author Doug Davis (dug@us.ibm.com)
> @@ -183,6 +185,13 @@
>      public static final String TRANSPORT_NAME    = "transport_name" ;
>      /**
> +     * This is the character set encoding to use for the message
> +     *
> +     * @see #setProperty
> +     */
> +    public static final String CHARACTER_SET_ENCODING    = SOAPMessage.CHARACTER_SET_ENCODING;
> +
> +    /**
>       * This is not the name of a property that can be set with
>       * setProperty, despite its name.
>       */
> @@ -440,6 +449,9 @@
>              verifyBooleanProperty(name, value);
>              setStreaming(((Boolean) value).booleanValue());
>          }
> +        else if (name.equals(CHARACTER_SET_ENCODING)) {
> +            verifyStringProperty(name, value);
> +        }
>          else if (name.startsWith("java.") || name.startsWith("javax.")) {
>              throw new JAXRPCException(
>                      Messages.getMessage("badProp05", name));
> @@ -544,6 +556,7 @@
>          propertyNames.add(TRANSPORT_NAME);
>          propertyNames.add(ATTACHMENT_ENCAPSULATION_FORMAT);
>          propertyNames.add(CONNECTION_TIMEOUT_PROPERTY);
> +        propertyNames.add(CHARACTER_SET_ENCODING);
>      }
>      public Iterator getPropertyNames() {
> @@ -1849,7 +1862,10 @@
>              Message msg = null ;
>              msg = new Message( env );
> -            if (msgContext.getProperty(SOAPMessage.CHARACTER_SET_ENCODING) != null) {
> +            if (getProperty(CHARACTER_SET_ENCODING) != null) {
> +                msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, getProperty(CHARACTER_SET_ENCODING));
> +            }
> +            else if (msgContext.getProperty(SOAPMessage.CHARACTER_SET_ENCODING) != null) {
>                  msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, msgContext.getProperty(SOAPMessage.CHARACTER_SET_ENCODING));
>               }
>              setRequestMessage( msg );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira