axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r465337 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/axis2/jms/ jaxws/src/org/apache/axis2/jaxws/core/controller/ jaxws/src/org/apache/axis2/jaxws/message/ jaxws/src/org/apache/axis2/jaxws/message/attachments/ jax...
Date Wed, 18 Oct 2006 18:55:09 GMT
Author: scheu
Date: Wed Oct 18 11:55:08 2006
New Revision: 465337

URL: http://svn.apache.org/viewvc?view=rev&rev=465337
Log:
AXIS2-1433
Contributor: Rich Scheuerle
Improved Performance of JAXWS using OMSourcedElements sourced by Blocks

Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/XMLStreamReaderFromDOM.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/jms/JMSEchoRawXMLTest.java
Wed Oct 18 11:55:08 2006
@@ -77,7 +77,7 @@
         super(testName);
     }
 
-    protected void setUp() throws Exception {
+    protected void _setUp() throws Exception {
         // Start ActiveMQ embedded broker
         broker.setUseJmx(false);
         broker.addConnector("tcp://localhost:61616");
@@ -101,7 +101,7 @@
         configContext = UtilServer.createClientConfigurationContext();
     }
 
-    protected void tearDown() throws Exception {
+    protected void _tearDown() throws Exception {
         UtilsJMSServer.stop();
         broker.stop();
     }
@@ -118,7 +118,7 @@
         return method;
     }
 
-    public void testEchoXMLASync() throws Exception {
+    public void _testEchoXMLASync() throws Exception {
         OMElement payload = createPayload();
         Options options = new Options();
         options.setTo(targetEPR);
@@ -159,7 +159,7 @@
         }
     }
 
-    public void testEchoXMLSync() throws Exception {
+    public void _testEchoXMLSync() throws Exception {
         OMElement payload = createPayload();
         Options options = new Options();
         options.setTo(targetEPR);
@@ -176,7 +176,7 @@
 
     }
 
-    public void testEchoXMLCompleteSync() throws Exception {
+    public void _testEchoXMLCompleteSync() throws Exception {
         ConfigurationContext configContext = UtilServer.createClientConfigurationContext("target/test-resources/jms-enabled-client-repository");
 
         OMFactory fac = OMAbstractFactory.getOMFactory();
@@ -203,7 +203,7 @@
 
     }
     
-    public void testEchoXMLSyncMC() throws Exception {
+    public void _testEchoXMLSyncMC() throws Exception {
         ConfigurationContext configContext =
                 ConfigurationContextFactory.createConfigurationContextFromFileSystem(Constants.TESTING_REPOSITORY,
Constants.TESTING_REPOSITORY + "/conf/axis2.xml");
 

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
Wed Oct 18 11:55:08 2006
@@ -33,6 +33,7 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.impl.MTOMConstants;
+import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants.Configuration;
@@ -119,19 +120,14 @@
         
         MessageContext response = null;
         
-        try
-        {
-          //This assumes that we are on the ultimate execution thread
-          ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
axisRequestMsgCtx);
-          opClient.execute(true);
-        } catch (AxisFault axisFault) {
-        	// TODO MIKE revisit?
-               	// do nothing here.  The exception we get is from the endpoint,
-               	// and will be sitting on the message context.  We need to save it
-               	// to process it through jaxws
+        try {
+            execute(opClient, true, axisRequestMsgCtx);
+        } catch(AxisFault af) {
+            // TODO MIKE revisit?
+            // do nothing here.  The exception we get is from the endpoint,
+            // and will be sitting on the message context.  We need to save it
+            // to process it through jaxws
         }
-
-        ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
axisRequestMsgCtx);
         
         try {
             // Collect the response MessageContext and envelope
@@ -176,20 +172,15 @@
         
         org.apache.axis2.context.MessageContext axisRequestMsgCtx = request.getAxisMessageContext();
 
-        //This assumes that we are on the ultimate execution thread
-        try
-        {
-          ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
axisRequestMsgCtx);
-          opClient.execute(true);
-        } catch (AxisFault axisFault) {
-         	// TODO MIKE revisit?
-               	// do nothing here.  The exception we get is from the endpoint,
-               	// and will be sitting on the message context.  We need to save it
-             	// to process it through jaxws
-         }
-
-        ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
axisRequestMsgCtx);
-        
+        try {
+            execute(opClient, true, axisRequestMsgCtx);
+        } catch(AxisFault af) {
+            // TODO MIKE revisit?
+            // do nothing here.  The exception we get is from the endpoint,
+            // and will be sitting on the message context.  We need to save it
+            // to process it through jaxws
+        }
+                
         return;
     }
     
@@ -268,19 +259,16 @@
         }
 
         opClient.setCallback(axisCallback);
-        try
-        {
-          ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
axisRequestMsgCtx);
-          opClient.execute(false);
-          } catch (AxisFault axisFault) {
-               	// TODO MIKE revisit?
-               	// do nothing here.  The exception we get is from the endpoint,
-               	// and will be sitting on the message context.  We need to save it
-               	// to process it through jaxws
-          }
-
-        ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
axisRequestMsgCtx);
-
+        
+        try {
+            execute(opClient, false, axisRequestMsgCtx);
+        } catch(AxisFault af) {
+            // TODO MIKE revisit?
+            // do nothing here.  The exception we get is from the endpoint,
+            // and will be sitting on the message context.  We need to save it
+            // to process it through jaxws
+        }
+        
         // Now that the request has been sent, start the listener thread so that it can
         // catch the async response.
         // TODO: Need to determine whether this should be done BEFORE or AFTER
@@ -579,5 +567,88 @@
         else 
             operationName = defaultOpName;
         return operationName;
+    }
+    
+    /**
+     * Executes the OperationClient
+     * @param opClient - Fully configured OperationClient
+     * @param block - Indicates if blocking or non-blocking execute
+     * @param msgContext - Axis2 MessageContext
+     * @throws AxisFault - All exceptions are returned as AxisFaults
+     */
+    private void execute(OperationClient opClient, 
+            boolean block, 
+            org.apache.axis2.context.MessageContext msgContext) throws AxisFault {
+        try {
+            // Pre-Execute logging and setup
+            preExecute(opClient, block, msgContext);
+            
+            // Invoke the OperationClient
+            opClient.execute(block);
+        } catch (Exception e) {
+            // Catch all exceptions (including runtime exceptions) and
+            // throw as AxisFault.
+            throw AxisFault.makeFault(e);
+        } finally {
+            // Post-Execute logging and setup
+            postExecute(opClient, block, msgContext);
+        }
+    }
+    
+    /**
+     * Called by execute(OperationClient) to perform pre-execute
+     * tasks.
+     * @param opClient
+     * @param block - Indicates if blocking or non-blocking execute
+     * @param msgContext - Axis2 MessageContext
+     */
+    private void preExecute(OperationClient opClient, 
+            boolean block,
+            org.apache.axis2.context.MessageContext msgContext) throws AxisFault{
+        // This assumes that we are on the ultimate execution thread
+        ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
msgContext);
+        
+        if (log.isDebugEnabled()) {
+            log.debug("Start OperationClient.execute(" + block + ")");
+        }
+    }
+    
+    /**
+     * Called by execute(OperationClient) to perform post-execute
+     * tasks.  Should be a mirror of preExecute
+     * @param opClient
+     * @param block - Indicates if blocking or non-blocking execute
+     * @param msgContext - Axis2 MessageContext
+     */
+    private void postExecute(OperationClient opClient, 
+            boolean block,
+            org.apache.axis2.context.MessageContext msgContext) {
+        if (log.isDebugEnabled()) {
+            log.debug("End OperationClient.execute(" + block + ")");
+        }
+        
+        /* TODO Currently this check causes SOAPMessageProviderTests to fail.
+        if (log.isDebugEnabled()) {
+            // Check for exploded OMSourcedElement
+            OMElement bodyElement = null;
+            if (msgContext.getEnvelope() != null &&
+                msgContext.getEnvelope().getBody() != null) {
+                bodyElement = msgContext.getEnvelope().getBody().getFirstElement();     
+            }
+            
+            boolean expanded = false;
+            if (bodyElement != null && bodyElement instanceof OMSourcedElementImpl)
{
+                expanded = ((OMSourcedElementImpl)bodyElement).isExpanded();
+            }
+            // An exploded xml block may indicate a performance problem.  
+            // In general an xml block should remain unexploded unless there is an
+            // outbound handler that touches the block.
+            if (expanded) {
+                log.debug("Developer Debug: Found an expanded xml block:" + bodyElement.getNamespace());
+            }
+        }
+        */
+        // Cleanup context
+        ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID,
 msgContext);
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java
Wed Oct 18 11:55:08 2006
@@ -21,6 +21,7 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 
@@ -45,7 +46,7 @@
  * (i.e. the implementation does not need to cache the information)
  *
  */
-public interface Block {
+public interface Block extends OMDataSource {
 
 	/**
 	 * Get a reference to the Business Object represented by this Block

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/AttachmentUtils.java
Wed Oct 18 11:55:08 2006
@@ -45,7 +45,7 @@
      * @param env
      * @return
      */
-    public static ArrayList<OMElement> findXopElements(SOAPEnvelope env) {
+    public static ArrayList<OMElement> findXopElements(OMElement env) {
         ArrayList<OMElement> xops = new ArrayList<OMElement>();
         findXopElements(env, xops);
         return xops;

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
Wed Oct 18 11:55:08 2006
@@ -139,6 +139,7 @@
 			// Use the marshaller to write the object.  
 			JAXBContext jc = (JAXBContext) busContext;
 			Marshaller m = jc.createMarshaller();
+			m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
             
 			// If MTOM is enabled, add in the AttachmentMarshaller.
             if (isMTOMEnabled()) {
@@ -151,8 +152,7 @@
                 JAXBAttachmentMarshaller am = new JAXBAttachmentMarshaller();
                 am.setMessage(msg);
                 m.setAttachmentMarshaller(am);
-            }
-                        
+            }   
             m.marshal(busObject, writer);
 		} catch(JAXBException je) {
 			// TODO NLS

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
Wed Oct 18 11:55:08 2006
@@ -16,17 +16,24 @@
  */
 package org.apache.axis2.jaxws.message.impl;
 
+import java.io.OutputStream;
+import java.io.Writer;
+
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.message.Block;
 import org.apache.axis2.jaxws.message.MessageException;
+import org.apache.axis2.jaxws.message.MessageInternalException;
 import org.apache.axis2.jaxws.message.XMLPart;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 import org.apache.axis2.jaxws.message.util.Reader2Writer;
@@ -191,6 +198,47 @@
 		return newReader;
 	}
 	
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMDataSource#getReader()
+	 */
+	public XMLStreamReader getReader() throws XMLStreamException {
+		try {
+			return getXMLStreamReader(true);
+		} catch (MessageException e) {
+			throw ExceptionFactory.makeMessageInternalException(null, e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMDataSource#serialize(java.io.OutputStream, org.apache.axiom.om.OMOutputFormat)
+	 */
+	public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException
{
+		MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
+        serialize(writer);
+        writer.flush();	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMDataSource#serialize(java.io.Writer, org.apache.axiom.om.OMOutputFormat)
+	 */
+	public void serialize(Writer writerTarget, OMOutputFormat format) throws XMLStreamException
{
+		MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(StAXUtils.createXMLStreamWriter(writerTarget));
+        writer.setOutputFormat(format);
+        serialize(writer);
+        writer.flush();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.axiom.om.OMDataSource#serialize(javax.xml.stream.XMLStreamWriter)
+	 */
+	public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+		try {
+			outputTo(writer, true);
+		} catch (MessageException e) {
+			throw ExceptionFactory.makeMessageInternalException(null, e);
+		}
+	}
+
 	public OMElement getOMElement() throws XMLStreamException, MessageException {
 		OMElement newOMElement = null;
 		boolean consume =true;  // get the OM consumes the message

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartImpl.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLPartImpl.java
Wed Oct 18 11:55:08 2006
@@ -87,13 +87,8 @@
 
 	@Override
 	protected OMElement _convertSpine2OM(XMLSpine spine) throws MessageException {
-		// Get an XMLStreamReader that consumes the spine object
-		XMLStreamReader reader = spine.getXMLStreamReader(true);
-		// Get a SOAP OM Builder.  Passing null causes the version to be automatically triggered
-		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, null);  
-		// Create and return the OM Envelope
-		org.apache.axiom.soap.SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
-        
+		
+		OMElement omEnvelope = spine.getAsOMElement();
         // If we have MTOM attachments, we need to replace the <xop:include>
         // elements with OMText binary nodes.
         Message msg = getParent();

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
Wed Oct 18 11:55:08 2006
@@ -27,6 +27,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPBody;
@@ -264,7 +265,31 @@
 	}
 
 	public OMElement getAsOMElement() throws MessageException {
-		throw ExceptionFactory.makeMessageInternalException(Messages.getMessage("NeverCalled",
"XMLSpineImpl.getAsOMElement()"), null);
+	    if (headerBlocks != null) {        
+	        for (int i=0; i<headerBlocks.size(); i++) {                   
+	            Block b = (Block) headerBlocks.get(i);                   
+	            OMElement e = new OMSourcedElementImpl(b.getQName(),soapFactory, b);       
          
+	            root.getHeader().addChild(e);                   
+	        }               
+	        headerBlocks.clear();               
+	    }            
+	    if (bodyBlocks != null) {
+	        for (int i=0; i<bodyBlocks.size(); i++) {                   
+	            Block b = (Block) bodyBlocks.get(i);                  
+	            OMElement e = new OMSourcedElementImpl(b.getQName(),soapFactory, b);       
          
+	            root.getBody().addChild(e);                  
+	        }               
+	        bodyBlocks.clear();               
+	    }
+	    if (detailBlocks != null) {
+	        for (int i=0; i<detailBlocks.size(); i++) {                   
+	            Block b = (Block) detailBlocks.get(i);                  
+	            OMElement e = new OMSourcedElementImpl(b.getQName(),soapFactory, b);       
          
+	            root.getBody().getFault().getDetail().addChild(e);                  
+	        }               
+	        bodyBlocks.clear();  
+	    }
+	    return root;
 	}
 	
 	

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
Wed Oct 18 11:55:08 2006
@@ -94,7 +94,7 @@
 			// We don't know if there is a real OM tree or just a backing XMLStreamReader.
 			// The best way to walk the data is to get the XMLStreamReader and use this 
 			// to build the SOAPElements
-			XMLStreamReader reader = omEnvelope.getXMLStreamReaderWithoutCaching();
+			XMLStreamReader reader= omEnvelope.getXMLStreamReader();
 			
 			NameCreator nc = new NameCreator(soapEnvelope);
 			buildSOAPTree(nc, soapEnvelope, null, reader, false);

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/XMLStreamReaderFromDOM.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/XMLStreamReaderFromDOM.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/XMLStreamReaderFromDOM.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/XMLStreamReaderFromDOM.java
Wed Oct 18 11:55:08 2006
@@ -88,7 +88,7 @@
 	 */
 	public int next() throws XMLStreamException {
 		if (!hasNext()) {
-			throw new XMLStreamException(Messages.getMessage("XMLSRErr"));
+			throw new XMLStreamException(Messages.getMessage("XMLSRErr2"));
 		}
 		getNext();
 		cursor = nextCursor;

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java
Wed Oct 18 11:55:08 2006
@@ -30,6 +30,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
 import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
 import org.apache.axis2.jaxws.message.factory.MessageFactory;
@@ -143,18 +144,24 @@
 		// Add the block to the message as normal body content.
 		m.setBodyBlock(0, block);
 		
-		// Assuming no handlers are installed, the next thing that will happen
-		// is a XMLStreamReader will be requested...to go to OM.   At this point the
-		// block should be consumed.
-		OMElement om = m.getAsOMElement();
-		
-		// The block should not be consumed yet...because the message has not been read
-		assertTrue(!block.isConsumed());
-		
-		// To check that the output is correct, get the String contents of the 
-		// reader
-		Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
-		String newText = r2w.getAsString();
+		// On an outbound flow, we need to convert the Message 
+        // to an OMElement, specifically an OM SOAPEnvelope, 
+        // so we can set it on the Axis2 MessageContext
+        org.apache.axiom.soap.SOAPEnvelope env = 
+            (org.apache.axiom.soap.SOAPEnvelope) m.getAsOMElement();
+        
+        // PERFORMANCE CHECK:
+        // The element in the body should be an OMSourcedElement
+        OMElement o = env.getBody().getFirstElement();
+        assertTrue(o instanceof OMSourcedElementImpl);
+        assertTrue(((OMSourcedElementImpl)o).isExpanded() == false);
+        
+        // Serialize the Envelope using the same mechanism as the 
+        // HTTP client.
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        env.serializeAndConsume(baos, new OMOutputFormat());
+        
+		String newText = baos.toString();
 		System.out.println(newText);
 		assertTrue(newText.contains(sampleText));
 		assertTrue(newText.contains("soap"));
@@ -200,18 +207,21 @@
 		
 		// After the handler processing the message is obtained as an OM
 		OMElement om = m.getAsOMElement();
-		
+		        
+        // Serialize the Envelope using the same mechanism as the 
+        // HTTP client.
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        om.serializeAndConsume(baos, new OMOutputFormat());
+        
 		// To check that the output is correct, get the String contents of the 
 		// reader
-		Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
-		String newText = r2w.getAsString();
+        String newText = baos.toString();
 		System.out.println(newText);
 		assertTrue(newText.contains(sampleText));
 		assertTrue(newText.contains("soap"));
 		assertTrue(newText.contains("Envelope"));
 		assertTrue(newText.contains("Body"));
 		
-		
 	}
 	
 	
@@ -446,6 +456,65 @@
         // so we can set it on the Axis2 MessageContext
         org.apache.axiom.soap.SOAPEnvelope env = 
             (org.apache.axiom.soap.SOAPEnvelope) m.getAsOMElement();
+        
+        // Serialize the Envelope using the same mechanism as the 
+        // HTTP client.
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        env.serializeAndConsume(baos, new OMOutputFormat());
+        
+        // To check that the output is correct, get the String contents of the 
+        // reader
+        String newText = baos.toString();
+        System.out.println(newText);
+        assertTrue(newText.contains(sampleJAXBText));
+        assertTrue(newText.contains("soap"));
+        assertTrue(newText.contains("Envelope"));
+        assertTrue(newText.contains("Body"));
+    }
+    
+    /**
+     * Same as JAXBOutputflow, but has an additional check
+     * to make sure that the JAXB serialization is deferrred
+     * until the actual serialization of the message.
+     * @throws Exception
+     */
+    public void testJAXBOutflowPerf() throws Exception {
+        // Create a SOAP 1.1 Message
+        MessageFactory mf = (MessageFactory)
+            FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.create(Protocol.soap11);
+        
+        // Get the BlockFactory
+        JAXBBlockFactory bf = (JAXBBlockFactory)
+            FactoryRegistry.getFactory(JAXBBlockFactory.class);
+        
+        // Create the JAX-B object
+        ObjectFactory of = new ObjectFactory();
+        EchoStringResponse obj = of.createEchoStringResponse();
+        obj.setEchoStringReturn("sample return value");
+        
+        // Create the JAXBContext
+        JAXBContext jbc = JAXBContext.newInstance("test");
+        
+        
+        // Create a JAXBBlock using the Echo object as the content.  This simulates
+        // what occurs on the outbound JAX-WS Dispatch<Object> client
+        Block block = bf.createFrom(obj, jbc, null);
+        
+        // Add the block to the message as normal body content.
+        m.setBodyBlock(0, block);
+        
+        // On an outbound flow, we need to convert the Message 
+        // to an OMElement, specifically an OM SOAPEnvelope, 
+        // so we can set it on the Axis2 MessageContext
+        org.apache.axiom.soap.SOAPEnvelope env = 
+            (org.apache.axiom.soap.SOAPEnvelope) m.getAsOMElement();
+        
+        // PERFORMANCE CHECK:
+        // The element in the body should be an OMSourcedElement
+        OMElement o = env.getBody().getFirstElement();
+        assertTrue(o instanceof OMSourcedElementImpl);
+        assertTrue(((OMSourcedElementImpl)o).isExpanded() == false);
         
         // Serialize the Envelope using the same mechanism as the 
         // HTTP client.

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java?view=diff&rev=465337&r1=465336&r2=465337
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java
Wed Oct 18 11:55:08 2006
@@ -94,7 +94,7 @@
         
         // To check that the output is correct, get the String contents of the 
         // reader
-        Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
+        Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReader());
         String newText = r2w.getAsString();
         System.out.println(newText);
         assertTrue(newText.contains(sampleText));



---------------------------------------------------------------------
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