Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 83786 invoked from network); 5 Mar 2004 05:26:23 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 5 Mar 2004 05:26:23 -0000 Received: (qmail 10063 invoked by uid 500); 5 Mar 2004 05:25:59 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 9969 invoked by uid 500); 5 Mar 2004 05:25:59 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 9955 invoked from network); 5 Mar 2004 05:25:58 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 5 Mar 2004 05:25:58 -0000 Received: (qmail 83760 invoked by uid 1766); 5 Mar 2004 05:26:18 -0000 Date: 5 Mar 2004 05:26:18 -0000 Message-ID: <20040305052618.83759.qmail@minotaur.apache.org> From: ias@apache.org To: ws-axis-cvs@apache.org Subject: cvs commit: ws-axis/java/src/org/apache/axis SOAPPart.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ias 2004/03/04 21:26:18 Modified: java/src/org/apache/axis SOAPPart.java Log: Updated getAsBytes and getAsSOAPEnvelope to get character encoding from SOAP message property first. Revision Changes Path 1.63 +22 -2 ws-axis/java/src/org/apache/axis/SOAPPart.java Index: SOAPPart.java =================================================================== RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/SOAPPart.java,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- SOAPPart.java 25 Feb 2004 14:02:29 -0000 1.62 +++ SOAPPart.java 5 Mar 2004 05:26:18 -0000 1.63 @@ -48,6 +48,7 @@ import org.w3c.dom.NamedNodeMap; import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamSource; @@ -399,8 +400,19 @@ // Save this message in case it is requested later in getAsString currentMessageAsString = (String) currentMessage; try{ - setCurrentForm( ((String)currentMessage).getBytes("UTF-8"), - FORM_BYTES ); + // set encoding of string from message context. + String encoding = null; + if (msgObject != null) { + try { + encoding = (String) msgObject.getProperty(SOAPMessage.CHARACTER_SET_ENCODING); + } catch (SOAPException e) { + } + } + if (encoding == null) { + encoding = "UTF-8"; + } + setCurrentForm( ((String)currentMessage).getBytes(encoding), + FORM_BYTES ); }catch(UnsupportedEncodingException ue){ setCurrentForm( ((String)currentMessage).getBytes(), FORM_BYTES ); @@ -533,6 +545,14 @@ if ( currentForm == FORM_INPUTSTREAM ) { is = new InputSource( (InputStream) currentMessage ); + // set encoding of input source from message context. + if (getMessage().getMessageContext() != null) { + String encoding = + (String) getMessage().getMessageContext().getProperty(SOAPMessage.CHARACTER_SET_ENCODING); + if (encoding != null) { + is.setEncoding(encoding); + } + } } else { is = new InputSource(new StringReader(getAsString())); }