axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r519316 - /webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
Date Sat, 17 Mar 2007 13:58:31 GMT
Author: dims
Date: Sat Mar 17 06:58:30 2007
New Revision: 519316

URL: http://svn.apache.org/viewvc?view=rev&rev=519316
Log:
vastly simplify setContent, Ruchith - please verify, earlier code was wrong too as it was
assuming that the incoming source was the whole soap envelope which was wrong

Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?view=diff&rev=519316&r1=519315&r2=519316
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
Sat Mar 17 06:58:30 2007
@@ -37,6 +37,7 @@
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.TransformerFactoryConfigurationError;
 import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
@@ -44,6 +45,7 @@
 import org.apache.axiom.attachments.utils.IOUtils;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.om.impl.MTOMConstants;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
@@ -388,35 +390,9 @@
     public void setContent(Source source) throws SOAPException {
         this.source = source;
 		try {
-	        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-            InputStream is;
-            if (source instanceof StreamSource) {
-                is = ((StreamSource) source).getInputStream();
-            } else {
-                Result result = new StreamResult(baos);
-                Transformer xformer = TransformerFactory.newInstance().newTransformer();
-                xformer.transform(source, result);
-                is = new ByteArrayInputStream(baos.toByteArray());
-            }
-
-            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-			XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-			
-			StAXSOAPModelBuilder builder1 = null;
-			if(this.envelope.element.getOMFactory() instanceof SOAP11Factory){
-				builder1 = new StAXSOAPModelBuilder(reader,
-						(SOAP11Factory)this.envelope.element.getOMFactory(),null);
-			}else if(this.envelope.element.getOMFactory() instanceof SOAP12Factory){
-				builder1 = new StAXSOAPModelBuilder(reader,
-						(SOAP12Factory)this.envelope.element.getOMFactory(),null);
-			}
-
-            org.apache.axiom.soap.SOAPEnvelope soapEnvelope = builder1.getSOAPEnvelope();
-            envelope = new SOAPEnvelopeImpl(
-            		(org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)soapEnvelope);
-            envelope.element.build();
-            this.document = envelope.getOwnerDocument();
+            Result result = new DOMResult(this.envelope.element);
+            Transformer xformer = TransformerFactory.newInstance().newTransformer();
+            xformer.transform(source, result);
         } catch (TransformerFactoryConfigurationError e) {
             log.error(e);
             throw new SOAPException(e);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message