You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2007/09/04 19:11:34 UTC

svn commit: r572740 [3/5] - in /webservices/axis2/branches/java/jaxws21: ./ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/schema/writer/ modules/adb/src/org/apache/axis2/databinding/typemapping/ modu...

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/AsyncResponse.java Tue Sep  4 10:11:13 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.axis2.jaxws.client.async;
 
+import org.apache.axis2.java.security.AccessController;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.EndpointDescription;
@@ -32,7 +33,9 @@
 import org.apache.commons.logging.LogFactory;
 
 import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
 
+import java.security.PrivilegedAction;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.CancellationException;
@@ -60,15 +63,44 @@
     private EndpointDescription endpointDescription;
     private Map<String, Object> responseContext;
 
+    /* 
+     * CountDownLatch is used to track whether we've received and
+     * processed the async response.  For example, the client app
+     * could be polling on 30 second intervals, and we don't receive
+     * the async response until the 1:15 mark.  In that case, the
+     * first few polls calling the .get() would hit the latch.await()
+     * which blocks the thread if the latch count > 0
+     */
     private CountDownLatch latch;
     private boolean cacheValid = false;
     private Object cachedObject = null;
 
+    // we need to ensure the classloader used under onComplete (where the response object is unmarshalled) is
+    // the same classloader as the one used by the client app, otherwise we'll get a strange ClassCastException
+    // This object is just a cache object.
+    private ClassLoader classLoader = null;
+    
+    // the object to be returned
+    private Object obj = null;
+    // we need to save an exception if processResponse fails
+    private ExecutionException savedException = null;
+    
     protected AsyncResponse(EndpointDescription ed) {
         endpointDescription = ed;
         latch = new CountDownLatch(1);
     }
 
+    protected void onError(Throwable flt, MessageContext mc, ClassLoader cl) {
+        setThreadClassLoader(cl);
+        onError(flt, mc);
+        ClassLoader origClassLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
+        });
+        setThreadClassLoader(origClassLoader);
+    }
+    
     protected void onError(Throwable flt, MessageContext faultCtx) {
         if (log.isDebugEnabled()) {
             log.debug("AsyncResponse received a fault.  Counting down latch.");
@@ -82,10 +114,48 @@
         cacheValid = false;
         cachedObject = null;
 
-        latch.countDown();
+        Throwable t = processFaultResponse();
+        
         if (log.isDebugEnabled()) {
             log.debug("New latch count = [" + latch.getCount() + "]");
         }
+        
+        // JAXWS 4.3.3 conformance bullet says to throw an ExecutionException from here
+        savedException = new ExecutionException(t);
+    }
+    
+    private void setThreadClassLoader(final ClassLoader cl) {
+        if (this.classLoader != null) {
+            if (!this.classLoader.getClass().equals(cl.getClass())) {
+                throw ExceptionFactory.makeWebServiceException("Attemping to use ClassLoader of type " + cl.getClass().toString() +
+                                                               ", which is incompatible with current ClassLoader of type " +
+                                                               this.classLoader.getClass().toString());
+            }
+        }
+        else {
+            if (log.isDebugEnabled()) {
+                log.debug("Setting up the thread's ClassLoader");
+                log.debug(cl.toString());
+            }
+            this.classLoader = cl;
+            AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    Thread.currentThread().setContextClassLoader(cl);
+                    return null;
+                }
+            });
+        }
+    }
+    
+    protected void onComplete(MessageContext mc, ClassLoader cl) {
+        setThreadClassLoader(cl);
+        onComplete(mc);
+        ClassLoader origClassLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
+        });
+        setThreadClassLoader(origClassLoader);
     }
 
     protected void onComplete(MessageContext mc) {
@@ -108,7 +178,21 @@
         	AttachmentUtils.findCachedAttachment(response.getAxisMessageContext().getAttachmentMap());
         }
         
-        latch.countDown();
+        /*
+         * TODO: review?
+         * We need to process the response right when we get it, instead of
+         * caching it away for processing when the client poller calls .get().
+         * Reason for this is that some platforms (or web containers) will close
+         * down their threads immediately after "dropping off" the async response.
+         * If those threads disappear, the underlying input stream object may also
+         * disappear, thus causing a NullPointerException later when we try to .get().
+         * The NPE would manifest itself way down in the parser.
+         */
+        try {
+            obj = processResponse();
+        } catch (ExecutionException e) {
+            savedException = e;
+        }
 
         if (log.isDebugEnabled()) {
             log.debug("New latch count = [" + latch.getCount() + "]");
@@ -142,9 +226,16 @@
         if (log.isDebugEnabled()) {
             log.debug("Waiting for async response delivery.");
         }
+        
+        // If latch count > 0, it means we have not yet received
+        // and processed the async response, and must block the
+        // thread.
         latch.await();
 
-        Object obj = processResponse();
+        if (savedException != null) {
+            throw savedException;
+        }
+        
         return obj;
     }
 
@@ -160,8 +251,14 @@
             log.debug("timeout = " + timeout);
             log.debug("units   = " + unit);
         }
+        
+        // latch.await will only block if its count is > 0
         latch.await(timeout, unit);
 
+        if (savedException != null) {
+            throw savedException;
+        }
+        
         // If the response still hasn't been returned, then we've timed out
         // and must throw a TimeoutException
         if (latch.getCount() > 0) {
@@ -169,7 +266,6 @@
                     "The client timed out while waiting for an asynchronous response");
         }
 
-        Object obj = processResponse();
         return obj;
     }
 
@@ -186,19 +282,15 @@
     }
 
     private Object processResponse() throws ExecutionException {
-        // If the fault object is not null, then we've received a fault message and 
-        // we need to process it in one of a number of forms.
-        if (fault != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("A fault was found.  Starting to process fault response.");
-            }
-            Throwable t = processFaultResponse();
-            // JAXWS 4.3.3 conformance bullet says to throw an ExecutionException from here
-            throw new ExecutionException(t);
-        }
-
+        /*
+         * note the latch.countDown() here.  We have to make sure the countdown
+         * occurs everywhere we might leave the method, which could be a return
+         * or throw.
+         */
+    	
         // If we don't have a fault, then we have to have a MessageContext for the response.
         if (response == null) {
+        	latch.countDown();
             throw new ExecutionException(ExceptionFactory.makeWebServiceException("null response"));
         }
 
@@ -208,50 +300,53 @@
             if (log.isDebugEnabled()) {
                 log.debug("Return object cached from last get()");
             }
+            latch.countDown();
             return cachedObject;
         }
 
-        // TODO: IMPORTANT: this is the right call here, but beware that the messagecontext may be turned into
-        // a fault context with a fault message.  We need to check for this and, if necessary, make an exception and throw it.
-        // Invoke inbound handlers.
-        TransportHeadersAdapter.install(response);
-        AttachmentsAdapter.install(response);
-        HandlerInvokerUtils.invokeInboundHandlers(response.getMEPContext(),
-                                                  response.getInvocationContext().getHandlers(),
-                                                  HandlerChainProcessor.MEP.RESPONSE,
-                                                  false);
-
-        // TODO: Check the type of the object to make sure it corresponds with
-        // the parameterized generic type.
         Object obj = null;
         try {
+            // TODO: IMPORTANT: this is the right call here, but beware that the messagecontext may be turned into
+            // a fault context with a fault message.  We need to check for this and, if necessary, make an exception and throw it.
+            // Invoke inbound handlers.
+            TransportHeadersAdapter.install(response);
+            AttachmentsAdapter.install(response);
+            HandlerInvokerUtils.invokeInboundHandlers(response.getMEPContext(),
+                                                      response.getInvocationContext().getHandlers(),
+                                                      HandlerChainProcessor.MEP.RESPONSE,
+                                                      false);
+
+            // TODO: Check the type of the object to make sure it corresponds with
+            // the parameterized generic type.
             if (log.isDebugEnabled()) {
                 log.debug("Unmarshalling the async response message.");
             }
+            
             obj = getResponseValueObject(response);
             // Cache the object in case it is required again
             cacheValid = true;
             cachedObject = obj;
-        }
-        catch (Throwable t) {
+            
+            if (log.isDebugEnabled() && obj != null) {
+                log.debug("Unmarshalled response object of type: " + obj.getClass());
+            }
+
+            responseContext = new HashMap<String, Object>();
+
+            // Migrate the properties from the response MessageContext back
+            // to the client response context bag.
+            ApplicationContextMigratorUtil.performMigrationFromMessageContext(Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
+                                                                              responseContext,
+                                                                              response);
+            latch.countDown();
+        } catch (Throwable t) {
             if (log.isDebugEnabled()) {
                 log.debug("An error occurred while processing the response");
             }
+            latch.countDown();
             throw new ExecutionException(ExceptionFactory.makeWebServiceException(t));
         }
 
-        if (log.isDebugEnabled() && obj != null) {
-            log.debug("Unmarshalled response object of type: " + obj.getClass());
-        }
-
-        responseContext = new HashMap<String, Object>();
-
-        // Migrate the properties from the response MessageContext back
-        // to the client response context bag.
-        ApplicationContextMigratorUtil.performMigrationFromMessageContext(
-                Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
-                responseContext, response);
-
         return obj;
     }
 
@@ -259,25 +354,35 @@
         // A faultMessageContext means that there could possibly be a SOAPFault
         // on the MessageContext that we need to unmarshall.
         if (faultMessageContext != null) {
+        	Throwable throwable = null;
             // it is possible the message could be null.  For example, if we gave the proxy a bad endpoint address.
             // If it is the case that the message is null, there's no sense running through the handlers.
-            if (faultMessageContext.getMessage() != null)
-                // Invoke inbound handlers.
+            if (faultMessageContext.getMessage() != null) {
                 // The adapters are intentionally NOT installed here.  They cause unit test failures
                 // TransportHeadersAdapter.install(faultMessageContext);
                 // AttachmentsAdapter.install(faultMessageContext);
-                HandlerInvokerUtils.invokeInboundHandlers(faultMessageContext.getMEPContext(),
+            	try {
+                    // Invoke inbound handlers.
+                    HandlerInvokerUtils.invokeInboundHandlers(faultMessageContext.getMEPContext(),
                                                           faultMessageContext.getInvocationContext()
                                                                              .getHandlers(),
                                                           HandlerChainProcessor.MEP.RESPONSE,
                                                           false);
-            Throwable t = getFaultResponse(faultMessageContext);
-            if (t != null) {
-                return t;
+            	} catch (Throwable t) {
+            		throwable = t;
+            	}
+            }
+            if (throwable == null) {
+                throwable = getFaultResponse(faultMessageContext);
+            }
+            latch.countDown();
+            if (throwable != null) {
+                return throwable;
             } else {
                 return ExceptionFactory.makeWebServiceException(fault);
             }
         } else {
+        	latch.countDown();
             return ExceptionFactory.makeWebServiceException(fault);
         }
     }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java Tue Sep  4 10:11:13 2007
@@ -29,7 +29,9 @@
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.WebServiceException;
 
+import java.security.PrivilegedAction;
 import java.util.concurrent.Callable;
+import org.apache.axis2.java.security.AccessController;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Future;
 import java.util.concurrent.FutureTask;
@@ -220,12 +222,17 @@
     MessageContext msgCtx;
     AsyncHandler handler;
     Exception error;
+    boolean done = false;
 
     CallbackFutureTask(AsyncResponse r, AsyncHandler h) {
         response = r;
         handler = h;
     }
-
+    
+    protected AsyncHandler getHandler() {
+        return handler;
+    }
+    
     void setMessageContext(MessageContext mc) {
         msgCtx = mc;
     }
@@ -236,37 +243,43 @@
 
     @SuppressWarnings("unchecked")
     public Object call() throws Exception {
-        // Set the response or fault content on the AsyncResponse object
-        // so that it can be collected inside the Executor thread and processed.
-        if (error != null) {
-            response.onError(error, msgCtx);
-        } else {
-            response.onComplete(msgCtx);
-        }
-
-        // Now that the content is available, call the JAX-WS AsyncHandler class
-        // to deliver the response to the user.
-        try {
+    	try {
+            ClassLoader classLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
+                public Object run() {
+                    return handler.getClass().getClassLoader();
+                }
+            });
+            
+            // Set the response or fault content on the AsyncResponse object
+            // so that it can be collected inside the Executor thread and processed.
+            if (error != null) {
+                response.onError(error, msgCtx, classLoader);
+            } else {
+                response.onComplete(msgCtx, classLoader);
+            }
+            
+            // Now that the content is available, call the JAX-WS AsyncHandler class
+            // to deliver the response to the user.
             ClassLoader cl = handler.getClass().getClassLoader();
         	if (log.isDebugEnabled()) {
         		log.debug("Setting up the thread's ClassLoader");
         		log.debug(cl.toString());
         	}
         	Thread.currentThread().setContextClassLoader(cl);
-            
-            if (debug) {
+        	
+        	if (debug) {
                 log.debug("Calling JAX-WS AsyncHandler with the Response object");
                 log.debug("AyncHandler class: " + handler.getClass());
             }
             handler.handleResponse(response);
-        }
-        catch (Throwable t) {
+    	} catch (Throwable t) {
             if (debug) {
                 log.debug("An error occured while invoking the callback object.");
                 log.debug("Error: " + t.getMessage());
             }
-        } finally {
+    	} finally {
             synchronized(this) {
+                done = true;
                 this.notifyAll();
             }
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Block.java Tue Sep  4 10:11:13 2007
@@ -18,7 +18,7 @@
  */
 package org.apache.axis2.jaxws.message;
 
-import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMDataSourceExt;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 
@@ -43,7 +43,7 @@
  * longer valid after the message is called. (i.e. the implementation does not need to cache the
  * information)
  */
-public interface Block extends OMDataSource {
+public interface Block extends OMDataSourceExt {
 
     /**
      * Get a reference to the Business Object represented by this Block

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java Tue Sep  4 10:11:13 2007
@@ -110,17 +110,21 @@
      * @return cid with translated characters
      */
     private String getNewCID(String cid) {
-        // TODO This method only converts : and /
-        // A more complete fix is needed.
         String cid2 = cid;
-        cid2 = JavaUtils.replace(cid2, "%3A", ":");
-        cid2 = JavaUtils.replace(cid2, "%2F", "/");
+
+        try {
+            cid2 = java.net.URLDecoder.decode(cid, "UTF-8");
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug("getNewCID decoding " + cid + " as UTF-8 decoding error: " + e);
+            }
+        }
         return cid2;
     }
 
     /**
      * Read the bytes from the DataHandler
-     *
+     * 
      * @param dh
      * @return byte[]
      * @throws IOException

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/JAXBBlockImpl.java Tue Sep  4 10:11:13 2007
@@ -50,7 +50,9 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.security.PrivilegedAction;
@@ -181,7 +183,6 @@
         return StAXUtils.createXMLStreamReader(baos, "utf-8");
     }
 
-    @Override
     protected void _outputFromBO(Object busObject, Object busContext, XMLStreamWriter writer)
         throws XMLStreamException, WebServiceException {
         JAXBBlockContext ctx = (JAXBBlockContext) busContext;
@@ -249,31 +250,35 @@
      * @param m Marshaller
      * @param writer XMLStreamWriter
      */
-    private static void marshalByElement(Object b, Marshaller m, XMLStreamWriter writer,
-                                         boolean optimize) throws WebServiceException {
-        // Marshalling directly to the output stream is faster than marshalling through the
-        // XMLStreamWriter. Take advantage of this optimization if there is an output stream.
-        try {
-            OutputStream os = (optimize) ? getOutputStream(writer) : null;
-            if (os != null) {
-                if (DEBUG_ENABLED) {
-                    log.debug("Invoking marshalByElement.  Marshaling to an OutputStream. " +
-                                "Object is "
-                            + getDebugName(b));
-                }
-                writer.flush();
-                m.marshal(b, os);
-            } else {
-                if (DEBUG_ENABLED) {
-                    log.debug("Invoking marshalByElement.  Marshaling to an XMLStreamWriter. " +
-                                "Object is "
-                            + getDebugName(b));
+    private static void marshalByElement(final Object b, final Marshaller m, final XMLStreamWriter writer,
+                                         final boolean optimize) throws WebServiceException {
+        AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                // Marshalling directly to the output stream is faster than marshalling through the
+                // XMLStreamWriter. Take advantage of this optimization if there is an output stream.
+                try {
+                    OutputStream os = (optimize) ? getOutputStream(writer) : null;
+                    if (os != null) {
+                        if (DEBUG_ENABLED) {
+                            log.debug("Invoking marshalByElement.  Marshaling to an OutputStream. " +
+                                      "Object is "
+                                      + getDebugName(b));
+                        }
+                        writer.flush();
+                        m.marshal(b, os);
+                    } else {
+                        if (DEBUG_ENABLED) {
+                            log.debug("Invoking marshalByElement.  Marshaling to an XMLStreamWriter. " +
+                                      "Object is "
+                                      + getDebugName(b));
+                        }
+                        m.marshal(b, writer);
+                    }
+                } catch (Exception e) {
+                    throw ExceptionFactory.makeWebServiceException(e);
                 }
-                m.marshal(b, writer);
-            }
-        } catch (Exception e) {
-            throw ExceptionFactory.makeWebServiceException(e);
-        }
+                return null;
+            }});
     }
 
     /**
@@ -561,6 +566,48 @@
 
     public boolean isElementData() {
         return true;
+    }
+    
+    public void close() {
+        return; // Nothing to close
+    }
+
+    public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException {
+        try {
+            byte[] bytes= _getBytesFromBO(
+                                          getBusinessObject(false), 
+                                          busContext, 
+                                          encoding);
+            return new ByteArrayInputStream(bytes);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public Object getObject() {
+        try {
+            return getBusinessObject(false);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public boolean isDestructiveRead() {
+        return false;
+    }
+
+    public boolean isDestructiveWrite() {
+        return false;
+    }
+
+    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+        try {
+            return _getBytesFromBO(getBusinessObject(false), 
+                                   busContext, 
+                                   encoding);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
     }
 
     /**

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/OMBlockImpl.java Tue Sep  4 10:11:13 2007
@@ -19,6 +19,8 @@
 package org.apache.axis2.jaxws.message.databinding.impl;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.message.databinding.OMBlock;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 import org.apache.axis2.jaxws.message.impl.BlockImpl;
@@ -28,6 +30,12 @@
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.ws.WebServiceException;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
 /** OMBlockImpl Block with a business object that is an OMElement */
 public class OMBlockImpl extends BlockImpl implements OMBlock {
 
@@ -68,5 +76,44 @@
 
     public boolean isElementData() {
         return true;
+    }
+    public void close() {
+        return; // Nothing to close
+    }
+
+    public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException {
+        byte[] bytes = getXMLBytes(encoding);
+        return new ByteArrayInputStream(bytes);
+    }
+
+    public Object getObject() {
+        try {
+            return getBusinessObject(false);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public boolean isDestructiveRead() {
+        return false;
+    }
+
+    public boolean isDestructiveWrite() {
+        return false;
+    }
+
+    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setCharSetEncoding(encoding);
+        try {
+            serialize(baos, format);
+            baos.flush();
+            return baos.toByteArray();
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        } catch (IOException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SOAPEnvelopeBlockImpl.java Tue Sep  4 10:11:13 2007
@@ -23,6 +23,8 @@
 package org.apache.axis2.jaxws.message.databinding.impl;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.message.Message;
 import org.apache.axis2.jaxws.message.databinding.SOAPEnvelopeBlock;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
@@ -39,6 +41,12 @@
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.ws.WebServiceException;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
 /**
  * 
  *
@@ -119,5 +127,45 @@
 
     public boolean isElementData() {
         return true;
+    }
+    
+    public void close() {
+        return; // Nothing to close
+    }
+
+    public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException {
+        byte[] bytes = getXMLBytes(encoding);
+        return new ByteArrayInputStream(bytes);
+    }
+
+    public Object getObject() {
+        try {
+            return getBusinessObject(false);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public boolean isDestructiveRead() {
+        return false;
+    }
+
+    public boolean isDestructiveWrite() {
+        return false;
+    }
+
+    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        OMOutputFormat format = new OMOutputFormat();
+        format.setCharSetEncoding(encoding);
+        try {
+            serialize(baos, format);
+            baos.flush();
+            return baos.toByteArray();
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        } catch (IOException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java Tue Sep  4 10:11:13 2007
@@ -46,7 +46,9 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Constructor;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
@@ -303,5 +305,45 @@
         Object newBusObject = busObject;
         setConsumed(consume);
         return newBusObject;
+    }
+    
+    public void close() {
+        return; // Nothing to close
+    }
+
+    public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException {
+        try {
+            byte[] bytes = (byte[]) 
+                ConvertUtils.convert(getBusinessObject(false), byte[].class);
+            return new ByteArrayInputStream(bytes);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public Object getObject() {
+        try {
+            return getBusinessObject(false);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public boolean isDestructiveRead() {
+        return true;
+    }
+
+    public boolean isDestructiveWrite() {
+        return true;
+    }
+
+
+    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+        try {
+            return (byte[]) 
+                ConvertUtils.convert(getBusinessObject(false), byte[].class);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java Tue Sep  4 10:11:13 2007
@@ -20,6 +20,7 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.message.databinding.XMLStringBlock;
 import org.apache.axis2.jaxws.message.factory.BlockFactory;
 import org.apache.axis2.jaxws.message.impl.BlockImpl;
@@ -29,7 +30,11 @@
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 
 /**
  * XMLStringBlock
@@ -90,5 +95,43 @@
 
     public boolean isElementData() {
         return false;  // The text could be element or text or something else
+    }
+    
+    public void close() {
+        return; // Nothing to close
+    }
+
+    public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException {
+        try {
+            byte[] bytes = ((String) getBusinessObject(false)).getBytes(encoding);
+            return new ByteArrayInputStream(bytes);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public Object getObject() {
+        try {
+            return getBusinessObject(false);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
+    }
+
+    public boolean isDestructiveRead() {
+        return false;
+    }
+
+    public boolean isDestructiveWrite() {
+        return false;
+    }
+
+
+    public byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException {
+        try {
+            return ((String) getBusinessObject(false)).getBytes(encoding);
+        } catch (XMLStreamException e) {
+            throw ExceptionFactory.makeWebServiceException(e);
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/BlockImpl.java Tue Sep  4 10:11:13 2007
@@ -18,8 +18,11 @@
  */
 package org.apache.axis2.jaxws.message.impl;
 
+import org.apache.axiom.om.OMDataSourceExt;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.ds.ByteArrayDataSource;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.util.StAXUtils;
@@ -41,6 +44,7 @@
 import javax.xml.ws.WebServiceException;
 import java.io.OutputStream;
 import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
 import java.io.Writer;
 
 /**
@@ -232,6 +236,16 @@
         MTOMXMLStreamWriter writer = new MTOMXMLStreamWriter(output, format);
         serialize(writer);
         writer.flush();
+        try {
+            writer.close();
+        } catch (XMLStreamException e) {
+            // An exception can occur if nothing is written to the 
+            // writer.  This is possible if the underlying data source
+            // writers to the output stream directly.
+            if (log.isDebugEnabled()) {
+                log.debug("Catching and swallowing exception " + e);
+            }
+        }
     }
 
     /* (non-Javadoc)
@@ -243,13 +257,14 @@
         writer.setOutputFormat(format);
         serialize(writer);
         writer.flush();
+        writer.close();
     }
 
     /* (non-Javadoc)
       * @see org.apache.axiom.om.OMDataSource#serialize(javax.xml.stream.XMLStreamWriter)
       */
     public void serialize(XMLStreamWriter writer) throws XMLStreamException {
-        outputTo(writer, true);
+        outputTo(writer, isDestructiveWrite());
     }
 
     public OMElement getOMElement() throws XMLStreamException, WebServiceException {
@@ -433,6 +448,21 @@
             throws XMLStreamException {
         Reader2Writer r2w = new Reader2Writer(reader);
         r2w.outputTo(writer);
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.axiom.om.OMDataSourceExt#copy()
+     */
+    public OMDataSourceExt copy() throws OMException {
+        // TODO: This is a default implementation.  Much
+        // more refactoring needs to occur to account for attachments.
+        try {
+            String encoding = "utf-8"; // Choose a common encoding
+            byte[] bytes = this.getXMLBytes(encoding);
+            return new ByteArrayDataSource(bytes, encoding);
+        } catch (UnsupportedEncodingException e) {
+            throw new OMException(e);
+        }
     }
 
     /**

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ProviderDispatcher.java Tue Sep  4 10:11:13 2007
@@ -352,9 +352,8 @@
             try {
                 paramType = (ParameterizedType)giType;
             } catch (ClassCastException e) {
-                //TODO NLS
-                throw new Exception(
-                        "Provider based SEI Class has to implement javax.xml.ws.Provider as javax.xml.ws.Provider<String>, javax.xml.ws.Provider<SOAPMessage>, javax.xml.ws.Provider<Source> or javax.xml.ws.Provider<JAXBContext>");
+                // this may not be a parameterized interface
+                continue;
             }
             Class interfaceName = (Class)paramType.getRawType();
 
@@ -365,7 +364,14 @@
                             "Provider cannot have more than one Generic Types defined as Per JAX-WS Specification");
                 }
                 providerType = (Class)paramType.getActualTypeArguments()[0];
+                break;
             }
+        }
+        if(providerType == null) {
+            throw new Exception("Provider based SEI Class has to implement javax.xml.ws." +
+                        "Provider as javax.xml.ws.Provider<String>, javax.xml.ws." +
+                        "Provider<SOAPMessage>, javax.xml.ws.Provider<Source> or " +
+                        "javax.xml.ws.Provider<JAXBContext>");
         }
         return providerType;
     }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/framework/JAXWSTest.java Tue Sep  4 10:11:13 2007
@@ -50,6 +50,7 @@
 import org.apache.axis2.jaxws.lifecycle.EndpointLifecycleTests;
 import org.apache.axis2.jaxws.message.BlockTests;
 import org.apache.axis2.jaxws.message.FaultTests;
+import org.apache.axis2.jaxws.message.MessagePersistanceTests;
 import org.apache.axis2.jaxws.message.MessageTests;
 import org.apache.axis2.jaxws.message.SAAJConverterTests;
 import org.apache.axis2.jaxws.message.SOAP12Tests;
@@ -126,6 +127,7 @@
         
         suite.addTestSuite(BlockTests.class);
         suite.addTestSuite(MessageTests.class);
+        suite.addTestSuite(MessagePersistanceTests.class);
         suite.addTestSuite(MessageContextTests.class);
         suite.addTestSuite(FaultTests.class);
         suite.addTestSuite(SAAJConverterTests.class);

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/message/MessageTests.java Tue Sep  4 10:11:13 2007
@@ -46,8 +46,8 @@
 /**
  * MessageTests
  * Tests to create and validate Message processing
- * These are not client/server tests.  Instead the tests simulate the processing of a Message during
- * client/server processing.
+ * These are not client/server tests.  
+ * Instead the tests simulate the processing of a Message during client/server processing.
  */
 public class MessageTests extends TestCase {
 
@@ -119,144 +119,140 @@
         "</soapenv:Body></soapenv:Envelope>";
     
     
-    
-	private static final QName sampleQName = new QName("urn://sample", "a");
-	
-	private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-	
-	public MessageTests() {
-		super();
-	}
+    private static final QName sampleQName = new QName("urn://sample", "a");
 
-	public MessageTests(String arg0) {
-		super(arg0);
-	}
-	
-	/**
-	 * Create a Block representing an XMLString and simulate a 
-	 * normal Dispatch<String> flow.
-     * In addition the test makes sure that the XMLString block is not
-     * expanded during this process.  (Expanding the block degrades performance).
-	 * @throws Exception
-	 */
-	public void testStringOutflow() throws Exception {
-		
-		// Create a SOAP 1.1 Message
-		MessageFactory mf = (MessageFactory)
-			FactoryRegistry.getFactory(MessageFactory.class);
-		Message m = mf.create(Protocol.soap11);
-		
-		// Get the BlockFactory
-		XMLStringBlockFactory f = (XMLStringBlockFactory)
-			FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-		
-		// Create a Block using the sample string as the content.  This simulates
-		// what occurs on the outbound JAX-WS dispatch<String> client
-		Block block = f.createFrom(sampleText, null, null);
-		
-		// Add the block to the message as normal body content.
-		m.setBodyBlock(block);
-		
-		// Check to see if the message is a fault.  The client/server will always call this method.
+    private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+
+    public MessageTests() {
+        super();
+    }
+
+    public MessageTests(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Create a Block representing an XMLString and simulate a normal Dispatch<String> flow. In
+     * addition the test makes sure that the XMLString block is not expanded during this process.
+     * (Expanding the block degrades performance).
+     * 
+     * @throws Exception
+     */
+    public void testStringOutflow() throws Exception {
+
+        // Create a SOAP 1.1 Message
+        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.create(Protocol.soap11);
+
+        // Get the BlockFactory
+        XMLStringBlockFactory f =
+                (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+
+        // Create a Block using the sample string as the content. This simulates
+        // what occurs on the outbound JAX-WS dispatch<String> client
+        Block block = f.createFrom(sampleText, null, null);
+
+        // Add the block to the message as normal body content.
+        m.setBodyBlock(block);
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         boolean isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "SPINE".equals(m.getXMLPartContentType()));
-        
-		// On an outbound flow, we need to convert the Message 
-        // to an OMElement, specifically an OM SOAPEnvelope, 
+                   "SPINE".equals(m.getXMLPartContentType()));
+
+        // 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();
-        
-        // Check to see if the message is a fault.  The client/server will always call this method.
+        org.apache.axiom.soap.SOAPEnvelope env =
+                (org.apache.axiom.soap.SOAPEnvelope) m.getAsOMElement();
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "OM".equals(m.getXMLPartContentType()));
-        
+                   "OM".equals(m.getXMLPartContentType()));
+
         // 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 
+        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();
+
+        String newText = baos.toString();
         TestLogger.logger.debug(newText);
-		assertTrue(newText.contains(sampleText));
-		assertTrue(newText.contains("soap"));
-		assertTrue(newText.contains("Envelope"));
-		assertTrue(newText.contains("Body"));
-		
-		// The block should be consumed at this point
-		assertTrue(block.isConsumed());
-	}
+        assertTrue(newText.contains(sampleText));
+        assertTrue(newText.contains("soap"));
+        assertTrue(newText.contains("Envelope"));
+        assertTrue(newText.contains("Body"));
+    }
 
-	/**
-	 * Create a Block representing an XMLString and simulate a 
-	 * normal Dispatch<String> flow with an application handler.
-	 * @throws Exception
-	 */
-	public void testStringOutflow2() throws Exception {
-		
-		// Create a SOAP 1.1 Message
-		MessageFactory mf = (MessageFactory)
-			FactoryRegistry.getFactory(MessageFactory.class);
-		Message m = mf.create(Protocol.soap11);
-		
-		// Get the BlockFactory
-		XMLStringBlockFactory f = (XMLStringBlockFactory)
-			FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-		
-		// Create a Block using the sample string as the content.  This simulates
-		// what occurs on the outbound JAX-WS dispatch<String> client
-		Block block = f.createFrom(sampleText, null, null);
-		
-		// Add the block to the message as normal body content.
-		m.setBodyBlock(block);
-		
-		// If there is a JAX-WS handler, the Message is converted into a SOAPEnvelope
-		SOAPEnvelope soapEnvelope = m.getAsSOAPEnvelope();
-        
-		// Check to see if the message is a fault.  The client/server will always call this method.
+    /**
+     * Create a Block representing an XMLString and simulate a normal Dispatch<String> flow with an
+     * application handler.
+     * 
+     * @throws Exception
+     */
+    public void testStringOutflow2() throws Exception {
+
+        // Create a SOAP 1.1 Message
+        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.create(Protocol.soap11);
+
+        // Get the BlockFactory
+        XMLStringBlockFactory f =
+                (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+
+        // Create a Block using the sample string as the content. This simulates
+        // what occurs on the outbound JAX-WS dispatch<String> client
+        Block block = f.createFrom(sampleText, null, null);
+
+        // Add the block to the message as normal body content.
+        m.setBodyBlock(block);
+
+        // If there is a JAX-WS handler, the Message is converted into a SOAPEnvelope
+        SOAPEnvelope soapEnvelope = m.getAsSOAPEnvelope();
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         boolean isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "SOAPENVELOPE".equals(m.getXMLPartContentType()));
-		
-		// Normally the handler would not touch the body...but for our scenario, assume that it does.
-		String name = soapEnvelope.getBody().getFirstChild().getLocalName();
-		assertTrue("a".equals(name));
-		
-		// The block should be consumed at this point
-		assertTrue(block.isConsumed());
-		
-		// After the handler processing the message is obtained as an OM
-		OMElement om = m.getAsOMElement();
-		        
-        // Serialize the Envelope using the same mechanism as the 
+                   "SOAPENVELOPE".equals(m.getXMLPartContentType()));
+
+        // Normally the handler would not touch the body...but for our scenario, assume that it
+        // does.
+        String name = soapEnvelope.getBody().getFirstChild().getLocalName();
+        assertTrue("a".equals(name));
+
+        // The block should be consumed at this point
+        assertTrue(block.isConsumed());
+
+        // 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
+
+        // To check that the output is correct, get the String contents of the
+        // reader
         String newText = baos.toString();
         TestLogger.logger.debug(newText);
-		assertTrue(newText.contains(sampleText));
-		assertTrue(newText.contains("soap"));
-		assertTrue(newText.contains("Envelope"));
-		assertTrue(newText.contains("Body"));
-		
-	}
+        assertTrue(newText.contains(sampleText));
+        assertTrue(newText.contains("soap"));
+        assertTrue(newText.contains("Envelope"));
+        assertTrue(newText.contains("Body"));
+
+    }
     
     /**
      * Create a Block representing an empty XMLString and simulate a 
@@ -297,7 +293,8 @@
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
                     "SOAPENVELOPE".equals(m.getXMLPartContentType()));
         
-        // Normally the handler would not touch the body...but for our scenario, assume that it does.
+        // Normally the handler would not touch the body...but for our scenario, 
+        // assume that it does.
         // The whitespace is not preserved, so there should be no first child in the body
         assertTrue(soapEnvelope.getBody().getFirstChild() == null);
         
@@ -359,7 +356,8 @@
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
                     "SOAPENVELOPE".equals(m.getXMLPartContentType()));
         
-        // Normally the handler would not touch the body...but for our scenario, assume that it does.
+        // Normally the handler would not touch the body...but for our scenario, 
+        // assume that it does.
         String name = soapEnvelope.getBody().getFirstChild().getLocalName();
         assertTrue("a".equals(name));
         name = soapEnvelope.getBody().getLastChild().getLocalName();
@@ -388,193 +386,202 @@
     }
     
 	/**
-	 * Create a Block representing an XMLString and simulate a 
-	 * normal Dispatch<String> input flow
-	 * @throws Exception
-	 */
-	public void testStringInflow_soap11() throws Exception {
-		_testStringInflow(sampleEnvelope11);
-	}
-	public void testStringInflow_soap12() throws Exception {
-		_testStringInflow(sampleEnvelope12);
-	}
-	public void _testStringInflow(String sampleEnvelope) throws Exception {
-		
-		// On inbound, there will already be an OM
-		// which represents the message.  The following code simulates the input
-		// OM
-		StringReader sr = new StringReader(sampleEnvelope);
-		XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
-		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
-		OMElement omElement = builder.getSOAPEnvelope();
-		
-		// The JAX-WS layer creates a Message from the OM
-		MessageFactory mf = (MessageFactory)
-			FactoryRegistry.getFactory(MessageFactory.class);
-		Message m = mf.createFrom(omElement,null);
-		
-		// Check to see if the message is a fault.  The client/server will always call this method.
+     * Create a Block representing an XMLString and simulate a normal Dispatch<String> input flow
+     * 
+     * @throws Exception
+     */
+    public void testStringInflow_soap11() throws Exception {
+        _testStringInflow(sampleEnvelope11);
+    }
+
+    public void testStringInflow_soap12() throws Exception {
+        _testStringInflow(sampleEnvelope12);
+    }
+
+    public void _testStringInflow(String sampleEnvelope) throws Exception {
+
+        // On inbound, there will already be an OM
+        // which represents the message. The following code simulates the input
+        // OM
+        StringReader sr = new StringReader(sampleEnvelope);
+        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
+        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
+        OMElement omElement = builder.getSOAPEnvelope();
+
+        // The JAX-WS layer creates a Message from the OM
+        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.createFrom(omElement, null);
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         boolean isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "OM".equals(m.getXMLPartContentType()));
-        
-		// Assuming no handlers are installed, the next thing that will happen
-		// is the proxy code will ask for the business object (String).
-		XMLStringBlockFactory blockFactory = 
-			(XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-		Block block = m.getBodyBlock(null, blockFactory);
-		Object bo = block.getBusinessObject(true);
-		assertTrue(bo instanceof String);
-		
-		// The block should be consumed
-		assertTrue(block.isConsumed());
-		
-		// Check the String for accuracy
-		assertTrue(sampleText.equals(bo.toString()));
-		
-	}
-	
-	/**
-	 * Create a Block representing an XMLString and simulate a 
-	 * normal Dispatch<String> input flow with a JAX-WS Handler
-	 * @throws Exception
-	 */
-	public void testStringInflow2_soap11() throws Exception {
-		_testStringInflow2(sampleEnvelope11);
-	}
-	public void testStringInflow2_soap12() throws Exception {
-		// Only run test if an SAAJ 1.3 MessageFactory is available
-		javax.xml.soap.MessageFactory mf = null;
-		try {
-			mf = getSAAJConverter().createMessageFactory(soap12env);
-		} catch (Exception e) {}
-		if (mf != null) {
-			_testStringInflow2(sampleEnvelope12);
-		}
-	}
-	public void _testStringInflow2(String sampleEnvelope) throws Exception {
-		
-		// On inbound, there will already be an OM
-		// which represents the message.  The following code simulates the input
-		// OM
-		StringReader sr = new StringReader(sampleEnvelope);
-		XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
-		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
-		OMElement omElement = builder.getSOAPEnvelope();
-		
-		// The JAX-WS layer creates a Message from the OM
-		MessageFactory mf = (MessageFactory)
-			FactoryRegistry.getFactory(MessageFactory.class);
-		Message m = mf.createFrom(omElement, null);
-		
-		// Check to see if the message is a fault.  The client/server will always call this method.
+                   "OM".equals(m.getXMLPartContentType()));
+
+        // Assuming no handlers are installed, the next thing that will happen
+        // is the proxy code will ask for the business object (String).
+        XMLStringBlockFactory blockFactory =
+                (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+        Block block = m.getBodyBlock(null, blockFactory);
+        Object bo = block.getBusinessObject(true);
+        assertTrue(bo instanceof String);
+
+        // The block should be consumed
+        assertTrue(block.isConsumed());
+
+        // Check the String for accuracy
+        assertTrue(sampleText.equals(bo.toString()));
+
+    }
+
+    /**
+     * Create a Block representing an XMLString and simulate a normal Dispatch<String> input flow
+     * with a JAX-WS Handler
+     * 
+     * @throws Exception
+     */
+    public void testStringInflow2_soap11() throws Exception {
+        _testStringInflow2(sampleEnvelope11);
+    }
+
+    public void testStringInflow2_soap12() throws Exception {
+        // Only run test if an SAAJ 1.3 MessageFactory is available
+        javax.xml.soap.MessageFactory mf = null;
+        try {
+            mf = getSAAJConverter().createMessageFactory(soap12env);
+        } catch (Exception e) {
+        }
+        if (mf != null) {
+            _testStringInflow2(sampleEnvelope12);
+        }
+    }
+
+    public void _testStringInflow2(String sampleEnvelope) throws Exception {
+
+        // On inbound, there will already be an OM
+        // which represents the message. The following code simulates the input
+        // OM
+        StringReader sr = new StringReader(sampleEnvelope);
+        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
+        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
+        OMElement omElement = builder.getSOAPEnvelope();
+
+        // The JAX-WS layer creates a Message from the OM
+        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.createFrom(omElement, null);
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         boolean isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "OM".equals(m.getXMLPartContentType()));
-            
-		// If there is a JAX-WS handler, the Message is converted into a SOAPEnvelope
-		SOAPEnvelope soapEnvelope = m.getAsSOAPEnvelope();
-		
-        // Check to see if the message is a fault.  The client/server will always call this method.
+                   "OM".equals(m.getXMLPartContentType()));
+
+        // If there is a JAX-WS handler, the Message is converted into a SOAPEnvelope
+        SOAPEnvelope soapEnvelope = m.getAsSOAPEnvelope();
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "SOAPENVELOPE".equals(m.getXMLPartContentType()));
-        
-		// Normally the handler would not touch the body...but for our scenario, assume that it does.
-		String name = soapEnvelope.getBody().getFirstChild().getLocalName();
-		assertTrue("a".equals(name));
-		
-		// The next thing that will happen
-		// is the proxy code will ask for the business object (String).
-		XMLStringBlockFactory blockFactory = 
-			(XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-		Block block = m.getBodyBlock(null, blockFactory);
-		Object bo = block.getBusinessObject(true);
-		assertTrue(bo instanceof String);
-		
-		// The block should be consumed
-		assertTrue(block.isConsumed());
-		
-		// Check the String for accuracy
-		assertTrue(sampleText.equals(bo.toString()));
-		
-	}
-	
-	/**
-	 * Create a Block representing an XMLString and simulate a 
-	 * normal Dispatch<String> input flow with a JAX-WS Handler that needs the whole Message
-	 * @throws Exception
-	 */
-	public void testStringInflow3_soap11() throws Exception {
-		_testStringInflow3(sampleEnvelope11);
-	}
-	public void testStringInflow3_soap12() throws Exception {
-		//Only run test if an SAAJ 1.3 MessageFactory is available
-		javax.xml.soap.MessageFactory mf = null;
-		try {
-			mf = getSAAJConverter().createMessageFactory(soap12env);
-		} catch (Exception e) {}
-		if (mf != null) {
-			_testStringInflow3(sampleEnvelope12);
-		}
-	}
-	public void _testStringInflow3(String sampleEnvelope) throws Exception {
-		
-		// On inbound, there will already be an OM
-		// which represents the message.  The following code simulates the input
-		// OM
-		StringReader sr = new StringReader(sampleEnvelope);
-		XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
-		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
-		OMElement omElement = builder.getSOAPEnvelope();
-		
-		// The JAX-WS layer creates a Message from the OM
-		MessageFactory mf = (MessageFactory)
-			FactoryRegistry.getFactory(MessageFactory.class);
-		Message m = mf.createFrom(omElement, null);
-		
-        // Check to see if the message is a fault.  The client/server will always call this method.
+                   "SOAPENVELOPE".equals(m.getXMLPartContentType()));
+
+        // Normally the handler would not touch the body...but for our scenario, assume that it
+        // does.
+        String name = soapEnvelope.getBody().getFirstChild().getLocalName();
+        assertTrue("a".equals(name));
+
+        // The next thing that will happen
+        // is the proxy code will ask for the business object (String).
+        XMLStringBlockFactory blockFactory =
+                (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+        Block block = m.getBodyBlock(null, blockFactory);
+        Object bo = block.getBusinessObject(true);
+        assertTrue(bo instanceof String);
+
+        // The block should be consumed
+        assertTrue(block.isConsumed());
+
+        // Check the String for accuracy
+        assertTrue(sampleText.equals(bo.toString()));
+
+    }
+
+    /**
+     * Create a Block representing an XMLString and simulate a normal Dispatch<String> input flow
+     * with a JAX-WS Handler that needs the whole Message
+     * 
+     * @throws Exception
+     */
+    public void testStringInflow3_soap11() throws Exception {
+        _testStringInflow3(sampleEnvelope11);
+    }
+
+    public void testStringInflow3_soap12() throws Exception {
+        // Only run test if an SAAJ 1.3 MessageFactory is available
+        javax.xml.soap.MessageFactory mf = null;
+        try {
+            mf = getSAAJConverter().createMessageFactory(soap12env);
+        } catch (Exception e) {
+        }
+        if (mf != null) {
+            _testStringInflow3(sampleEnvelope12);
+        }
+    }
+
+    public void _testStringInflow3(String sampleEnvelope) throws Exception {
+
+        // On inbound, there will already be an OM
+        // which represents the message. The following code simulates the input
+        // OM
+        StringReader sr = new StringReader(sampleEnvelope);
+        XMLStreamReader inflow = inputFactory.createXMLStreamReader(sr);
+        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow, null);
+        OMElement omElement = builder.getSOAPEnvelope();
+
+        // The JAX-WS layer creates a Message from the OM
+        MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+        Message m = mf.createFrom(omElement, null);
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         boolean isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "OM".equals(m.getXMLPartContentType()));
-        
-		// If there is a JAX-WS handler, the Message is converted into a SOAPEnvelope
-		SOAPMessage sm = m.getAsSOAPMessage();
-		
-        // Check to see if the message is a fault.  The client/server will always call this method.
+                   "OM".equals(m.getXMLPartContentType()));
+
+        // If there is a JAX-WS handler, the Message is converted into a SOAPEnvelope
+        SOAPMessage sm = m.getAsSOAPMessage();
+
+        // Check to see if the message is a fault. The client/server will always call this method.
         // The Message must respond appropriately without doing a conversion.
         isFault = m.isFault();
         assertTrue(!isFault);
         assertTrue("XMLPart Representation is " + m.getXMLPartContentType(),
-                    "SOAPENVELOPE".equals(m.getXMLPartContentType()));
-        
-		// Normally the handler would not touch the body...but for our scenario, assume that it does.
-		String name = sm.getSOAPBody().getFirstChild().getLocalName();
-		assertTrue("a".equals(name));
-		
-		// The next thing that will happen
-		// is the proxy code will ask for the business object (String).
-		XMLStringBlockFactory blockFactory = 
-			(XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
-		Block block = m.getBodyBlock(null, blockFactory);
-		Object bo = block.getBusinessObject(true);
-		assertTrue(bo instanceof String);
-		
-		// The block should be consumed
-		assertTrue(block.isConsumed());
-		
-		// Check the String for accuracy
-		assertTrue(sampleText.equals(bo.toString()));
-		
-	}
+                   "SOAPENVELOPE".equals(m.getXMLPartContentType()));
+
+        // Normally the handler would not touch the body...but for our scenario, assume that it
+        // does.
+        String name = sm.getSOAPBody().getFirstChild().getLocalName();
+        assertTrue("a".equals(name));
+
+        // The next thing that will happen
+        // is the proxy code will ask for the business object (String).
+        XMLStringBlockFactory blockFactory =
+                (XMLStringBlockFactory) FactoryRegistry.getFactory(XMLStringBlockFactory.class);
+        Block block = m.getBodyBlock(null, blockFactory);
+        Object bo = block.getBusinessObject(true);
+        assertTrue(bo instanceof String);
+
+        // The block should be consumed
+        assertTrue(block.isConsumed());
+
+        // Check the String for accuracy
+        assertTrue(sampleText.equals(bo.toString()));
+
+    }
     
     /**
      * Create a Block representing an XMLString, but this time use one that
@@ -645,7 +652,8 @@
         obj.setEchoStringReturn("sample return value");
         
         // Create the JAXBContext
-        JAXBBlockContext context = new JAXBBlockContext(EchoStringResponse.class.getPackage().getName());
+        JAXBBlockContext context = 
+            new JAXBBlockContext(EchoStringResponse.class.getPackage().getName());
         
         // Create a JAXBBlock using the Echo object as the content.  This simulates
         // what occurs on the outbound JAX-WS Dispatch<Object> client
@@ -711,7 +719,8 @@
         obj.setEchoStringReturn("sample return value");
         
         // Create the JAXBContext
-        JAXBBlockContext context = new JAXBBlockContext(EchoStringResponse.class.getPackage().getName());
+        JAXBBlockContext context = 
+            new JAXBBlockContext(EchoStringResponse.class.getPackage().getName());
        
         // Create a JAXBBlock using the Echo object as the content.  This simulates
         // what occurs on the outbound JAX-WS Dispatch<Object> client
@@ -814,7 +823,8 @@
         
         // Create the JAXBContext instance that will be used
         // to deserialize the JAX-B object content in the message.
-        JAXBBlockContext context = new JAXBBlockContext(EchoStringResponse.class.getPackage().getName());
+        JAXBBlockContext context = 
+            new JAXBBlockContext(EchoStringResponse.class.getPackage().getName());
         
         // Get the JAXBBlock that wraps the content
         Block b = m.getBodyBlock(context, bf);
@@ -828,7 +838,7 @@
         
         // Get the business object from the block, which should be a 
         // JAX-B object
-        Object bo = b.getBusinessObject(true);
+        Object bo = b.getBusinessObject(false);
         m.setPostPivot();
         
         // Simulate restoring the message
@@ -853,14 +863,16 @@
         // Simulate outbound
         if (persist == PERSIST) {
             String persistMsg = m.getAsOMElement().toString();
-            // We should be able to persist the message, but the persisted message WON'T contain the echoStringResponse contents
+            // We should be able to persist the message, 
+            // and the persisted message WILL contain the echoStringResponse contents
             assertTrue(persistMsg.contains("Body"));
             assertTrue(persistMsg.contains("echoStringResponse"));
-            assertTrue(!persistMsg.contains("sample return value"));
+            assertTrue(persistMsg.contains("sample return value"));
             
         } else if (persist == SAVE_AND_PERSIST) {
             String persistMsg = m.getAsOMElement().toString();
-            // We should be able to persist the message, and the persisted message WILL contain the echoStringResponse contents
+            // We should be able to persist the message, 
+            // and the persisted message WILL contain the echoStringResponse contents
             assertTrue(persistMsg.contains("Body"));
             assertTrue(persistMsg.contains("echoStringResponse"));
             assertTrue(persistMsg.contains("sample return value"));
@@ -871,15 +883,15 @@
         QName qName = new QName("uri://fake", "fake");
         env.getBody().getFirstChildWithName(qName);
     }
-    
-    
-	SAAJConverter converter = null;
-	private SAAJConverter getSAAJConverter() {
-		if (converter == null) {
-			SAAJConverterFactory factory = (
-						SAAJConverterFactory)FactoryRegistry.getFactory(SAAJConverterFactory.class);
-			converter = factory.getSAAJConverter();
-		}
-		return converter;
-	}
+
+    SAAJConverter converter = null;
+
+    private SAAJConverter getSAAJConverter() {
+        if (converter == null) {
+            SAAJConverterFactory factory =
+                    (SAAJConverterFactory) FactoryRegistry.getFactory(SAAJConverterFactory.class);
+            converter = factory.getSAAJConverter();
+        }
+        return converter;
+    }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java Tue Sep  4 10:11:13 2007
@@ -16,20 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-//
-// IBM Confidential OCO Source Material
-// (C) COPYRIGHT International Business Machines Corp. 2006
-// The source code for this program is not published or otherwise divested
-// of its trade secrets, irrespective of what has been deposited with the
-// U.S. Copyright Office.
-//
-// Change History:
-// Date        UserId         Defect            Description
-// ----------------------------------------------------------------------------
-// 08/28/2006  mzheng         LIDB3296-46.01    New File
-//
-
 package org.apache.axis2.jaxws.sample.faultsservice;
 
 import javax.annotation.PostConstruct;

Modified: webservices/axis2/branches/java/jaxws21/modules/json/test/org/apache/axis2/json/Echo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/json/test/org/apache/axis2/json/Echo.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/json/test/org/apache/axis2/json/Echo.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/json/test/org/apache/axis2/json/Echo.java Tue Sep  4 10:11:13 2007
@@ -18,17 +18,16 @@
  */
 package org.apache.axis2.json;
 
+import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.context.MessageContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
 
 public class Echo {
-    private static final Log log = LogFactory.getLog(Echo.class);
 
     public Echo() {
     }
@@ -45,6 +44,9 @@
         } else if (messageType.indexOf("json") < 0) {
             throw new AxisFault("Type of the Received Message is not JSON");
         }
+        OMDataSource omdataOSuce = ((OMSourcedElement) omEle).getDataSource();
+        OMElement newOmEle = (OMElement) omEle.detach();
+        ((OMSourcedElement) newOmEle).setDataSource(omdataOSuce);
         return omEle;
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/conf/axis2.xml Tue Sep  4 10:11:13 2007
@@ -75,6 +75,8 @@
 
     <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
     <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+    <deployer extension=".jsa" directory="rmiservices" class="org.apache.axis2.rmi.deploy.RMIServiceDeployer"/>
+    
 
     <!-- Following parameter will set the host name for the epr-->
     <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
@@ -267,6 +269,9 @@
         <parameter name="PROTOCOL">HTTP/1.1</parameter>
         <parameter name="Transfer-Encoding">chunked</parameter>
     </transportSender>
+    <transportSender name="java"
+                     class="org.apache.axis2.transport.java.JavaTransportSender"/>
+
     <!--<transportSender name="jms"-->
                      <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
 

Modified: webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?rev=572740&r1=572739&r2=572740&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/kernel/src/org/apache/axis2/client/ServiceClient.java Tue Sep  4 10:11:13 2007
@@ -37,13 +37,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.OutInAxisOperation;
-import org.apache.axis2.description.OutOnlyAxisOperation;
-import org.apache.axis2.description.RobustOutOnlyAxisOperation;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.ListenerManager;
 import org.apache.axis2.i18n.Messages;
@@ -216,6 +210,17 @@
                                                                                       wsdlServiceName,
                                                                                       portName,
                                                                                       options));
+        Parameter transportName = axisService.getParameter("TRANSPORT_NAME");
+        if(transportName != null ) {
+            TransportOutDescription transportOut = configContext.getAxisConfiguration().getTransportOut(
+                    transportName.getValue().toString());
+            if (transportOut == null) {
+                throw new AxisFault("Cannot load transport from binding, either defin in Axis2.config " +
+                        "or set it explicitely in ServiceClinet.Options");
+            } else {
+                options.setTransportOut(transportOut);
+            }
+        }
     }
 
     /**



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