Author: chinthaka
Date: Tue Apr 25 23:38:42 2006
New Revision: 397108

URL: http://svn.apache.org/viewcvs?rev=397108&view=rev
Log:
Applying patch in http://issues.apache.org/jira/browse/WSCOMMONS-13. Thanks 
Mike Rheinheimer.


Modified:
    
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java

Modified: 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
URL: 
http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java?rev=397108&r1=397107&r2=397108&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
 Tue Apr 25 23:38:42 2006
@@ -87,6 +87,8 @@
     private String receiverfaultCode;
     private boolean processingMandatoryFaultElements;
 
+    private String charEncoding = null;
+    private String parserVersion = null;
 
     /**
      * Constructor StAXSOAPModelBuilder
@@ -100,6 +102,8 @@
      */
     public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {
         super(parser);
+        charEncoding = parser.getCharacterEncodingScheme();
+        parserVersion = parser.getVersion();
         identifySOAPVersion(soapVersion);
     }
 
@@ -115,6 +119,8 @@
     public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, 
String soapVersion) {
         super(factory, parser);
         soapFactory = factory;
+        charEncoding = parser.getCharacterEncodingScheme();
+        parserVersion = parser.getVersion();
         identifySOAPVersion(soapVersion);
     }
 
@@ -186,8 +192,8 @@
 
     protected void setSOAPEnvelope(OMElement node) {
         soapMessage.setSOAPEnvelope((SOAPEnvelope) node);
-        soapMessage.setXMLVersion(parser.getVersion());
-        soapMessage.setCharsetEncoding(parser.getCharacterEncodingScheme());
+        soapMessage.setXMLVersion(parserVersion);
+        soapMessage.setCharsetEncoding(charEncoding);
     }
 
     /**
@@ -199,7 +205,7 @@
      */
     protected OMElement constructNode(OMElement parent, String elementName,
                                       boolean isEnvelope) {
-        OMElement element = null;
+        OMElement element;
         if (parent == null) {
 
             // Now I've found a SOAP Envelope, now create SOAPDocument and 
SOAPEnvelope here.
@@ -227,9 +233,9 @@
             // create a SOAPMessage to hold the SOAP envelope and assign the 
SOAP envelope in that.
             soapMessage = soapFactory.createSOAPMessage(this);
             this.document = soapMessage;
-            if (parser.getCharacterEncodingScheme() != null) {
-                
document.setCharsetEncoding(parser.getCharacterEncodingScheme());
-            }
+            if (charEncoding != null) {
+               document.setCharsetEncoding(charEncoding);
+             }
 
             envelope = soapFactory.createSOAPEnvelope(this);
             element = envelope;
@@ -419,7 +425,7 @@
     }
 
     public OMDocument getDocument() {
-        return (OMDocument) this.soapMessage;
+        return this.soapMessage;
     }
 
     /**


Reply via email to