Bernie,
Looks like a useful change...can you please open a JIRA enhancement request?
thanks,
dims
On Tue, 23 Nov 2004 13:55:32 -0500, Bernie Bernstein
<[EMAIL PROTECTED]> wrote:
> I found a much easier way to do this by making only a minor
> modification to org.apache.axis.client.Call.java.
>
> 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));
> }
>
> Here's the 'diff -u' for Call.java (for 1.2RC2):
>
> --- Call.java Tue Nov 16 13:04:43 2004
> +++
> /Users/bernard/src/jiveall/liveforum/WEB-INF/classes/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 ([EMAIL PROTECTED])
> @@ -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 );
>
> I'm new to the Axis project group. Is there an appropriate way to
> submit this for insertion into the project? Perhaps there is a better
> way to do this that I haven't heard of yet, but I haven't found one
> yet. This code will make it possible to set the Character encoding to
> anything when making the Call.
>
> 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");
>
> Bernie
>
>
>
>
> On Nov 17, 2004, at 4:21 PM, Bernie Bernstein wrote:
> > I managed to do it by copy/pasting some code from
> > org.apache.axis.client.Call.
> >
> > It wasn't easy, but it involved creating a new Message object, setting
> > it's char encoding to "ISO-8859-1", and then assembling the envelope
> > to send to Call.
> >
> >
> > On Nov 17, 2004, at 12:39 PM, Peuclid wrote:
> >> So, just to start, I'm trying to get my test client to request the
> >> data in ISO-8859-1 just to see what happens when I change the global
> >> "axis.xmlEncoding" to ISO-8859-1. So far, that doesn't seem to be
> >> changing the default anywhere. Looking at the AxisServlet code, I see
> >> that the encoding is set by the request.
> >>
> >> So, now I need to figure out how to set the encoding of the request.
> >
>
>
--
Davanum Srinivas - http://webservices.apache.org/~dims/