You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2005/04/28 07:02:19 UTC

svn commit: r165099 - in /webservices/axis/trunk/java/modules: samples/src/encoding/sample1/EchoProvider.java samples/test/org/apache/axis/engine/EchoRawXMLTest.java xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java

Author: hemapani
Date: Wed Apr 27 22:02:18 2005
New Revision: 165099

URL: http://svn.apache.org/viewcvs?rev=165099&view=rev
Log:
get the test cases up and working

Modified:
    webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java

Modified: webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java?rev=165099&r1=165098&r2=165099&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/encoding/sample1/EchoProvider.java Wed Apr 27 22:02:18 2005
@@ -164,9 +164,10 @@
                 "http://axis.apache.org",
                 "s");
 
-			msgContext.setEnvelope(responseEnvelope);
+            MessageContext resMessageContext = new MessageContext(msgContext);
+            resMessageContext.setEnvelope(responseEnvelope);
 
-			return msgContext;
+			return resMessageContext;
 		} catch (SecurityException e) {
 			throw AxisFault.makeFault(e);
 		} catch (IllegalArgumentException e) {

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java?rev=165099&r1=165098&r2=165099&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java Wed Apr 27 22:02:18 2005
@@ -24,6 +24,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.axis.Constants;
 import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.clientapi.AsyncResult;
@@ -35,6 +36,7 @@
 import org.apache.axis.om.OMElement;
 import org.apache.axis.om.OMFactory;
 import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
 import org.apache.axis.om.SOAPEnvelope;
 import org.apache.axis.transport.http.SimpleHTTPServer;
 import org.apache.axis.util.Utils;
@@ -78,22 +80,22 @@
     }
 
 
-//    public void testEchoXMLSync() throws Exception {
-//        OMFactory fac = OMFactory.newInstance();
-//
-//        SOAPEnvelope reqEnv = createEnvelope(fac);
-//
-//        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
-//        
-//        call.setTransport(Constants.TRANSPORT_HTTP);
-//        call.setTo(targetEPR);
-//        call.setAction(operationName.getLocalPart());
-//        SOAPEnvelope resEnv = call.sendReceiveSync(reqEnv);
-//
-//        resEnv.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
-//        OMNode omNode = resEnv.getBody().getFirstChild();
-//        assertNotNull(omNode);
-//    }
+    public void testEchoXMLSync() throws Exception {
+        OMFactory fac = OMFactory.newInstance();
+
+        SOAPEnvelope reqEnv = createEnvelope(fac);
+
+        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
+        
+        call.setTransport(Constants.TRANSPORT_HTTP);
+        call.setTo(targetEPR);
+        call.setAction(operationName.getLocalPart());
+        SOAPEnvelope resEnv = call.sendReceiveSync(reqEnv);
+
+        resEnv.serializeWithCache(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out));
+        OMNode omNode = resEnv.getBody().getFirstChild();
+        assertNotNull(omNode);
+    }
 
     private SOAPEnvelope createEnvelope(OMFactory fac) {
         SOAPEnvelope reqEnv = fac.getDefaultEnvelope();
@@ -106,42 +108,42 @@
         return reqEnv;
     }
 
-//    public void testEchoXMLASync() throws Exception {
-//        OMFactory fac = OMFactory.newInstance();
-//
-//        SOAPEnvelope reqEnv = createEnvelope(fac);
-//
-//        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
-//
-//        call.setTo(targetEPR);
-//        call.setListenerTransport("http", false);
-//
-//        Callback callback = new Callback() {
-//            public void onComplete(AsyncResult result) {
-//                try {
-//                    result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance()
-//                            .createXMLStreamWriter(System.out));
-//                } catch (XMLStreamException e) {
-//                    reportError(e);
-//                } finally {
-//                    finish = true;
-//                }
-//            }
-//
-//            public void reportError(Exception e) {
-//                e.printStackTrace();
-//                finish = true;
-//            }
-//        };
-//
-//        call.sendReceiveAsync(reqEnv, callback);
-//        while (!finish) {
-//            Thread.sleep(1000);
-//        }
-//
-//        log.info("send the reqest");
-//    }
-//    
+    public void testEchoXMLASync() throws Exception {
+        OMFactory fac = OMFactory.newInstance();
+
+        SOAPEnvelope reqEnv = createEnvelope(fac);
+
+        org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
+
+        call.setTo(targetEPR);
+        call.setListenerTransport("http", false);
+
+        Callback callback = new Callback() {
+            public void onComplete(AsyncResult result) {
+                try {
+                    result.getResponseEnvelope().serializeWithCache(XMLOutputFactory.newInstance()
+                            .createXMLStreamWriter(System.out));
+                } catch (XMLStreamException e) {
+                    reportError(e);
+                } finally {
+                    finish = true;
+                }
+            }
+
+            public void reportError(Exception e) {
+                e.printStackTrace();
+                finish = true;
+            }
+        };
+
+        call.sendReceiveAsync(reqEnv, callback);
+        while (!finish) {
+            Thread.sleep(1000);
+        }
+
+        log.info("send the reqest");
+    }
+    
  
 
     public void testEchoXMLCompleteASync() throws Exception {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java?rev=165099&r1=165098&r2=165099&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMElementImpl.java Wed Apr 27 22:02:18 2005
@@ -223,9 +223,12 @@
         OMNode omNode = null;
         if (omChildrenQNameIterator.hasNext()) {
             omNode = (OMNode) omChildrenQNameIterator.next();
+            return (OMNode.ELEMENT_NODE == omNode.getType()) ? (OMElement) omNode : null;
+        }else{
+            return null;
         }
 
-        return OMNode.ELEMENT_NODE == omNode.getType() ? (OMElement) omNode : null;
+        
 
     }