axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis SOAPPart.java
Date Fri, 05 Mar 2004 05:26:18 GMT
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()));
           }
  
  
  

Mime
View raw message