axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject svn commit: r612147 [6/17] - in /webservices/axis2/branches/java/jaxws21: ./ modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/ modules/adb-codegen/src/org/apache/axis2/schema/template/ modules/adb-codegen/src/org/apache/axis2/schema...
Date Tue, 15 Jan 2008 16:22:27 GMT
Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesMembershipListener.java Tue Jan 15 08:21:22 2008
@@ -23,20 +23,28 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-/**
+/**                                                                          In
  * 
  */
 public class TribesMembershipListener implements MembershipListener {
 
     private static Log log = LogFactory.getLog(TribesMembershipListener.class);
+    private MembershipManager membershipManager;
+
+    public TribesMembershipListener(MembershipManager membershipManager) {
+        this.membershipManager = membershipManager;
+    }
 
     public void memberAdded(Member member) {
         log.info("New member " + TribesUtil.getHost(member) + " joined cluster.");
+        membershipManager.memberAdded(member);
        //        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());
     }
 
     public void memberDisappeared(Member member) {
         log.info("Member " + TribesUtil.getHost(member) + " left cluster");
+        membershipManager.memberDisappeared(member);
+
 //        System.err.println("++++++ IS COORD="+TribesClusterManager.nbc.isCoordinator());
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/src/org/apache/axis2/clustering/tribes/TribesUtil.java Tue Jan 15 08:21:22 2008
@@ -28,7 +28,8 @@
 
     private static Log log = LogFactory.getLog(TribesUtil.class);
 
-    public static void printMembers(Member[] members) {
+    public static void printMembers(MembershipManager membershipManager) {
+        Member[] members = membershipManager.getMembers();
         if (members != null) {
             int length = members.length;
             if (length > 0) {

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ClusterManagerTestCase.java Tue Jan 15 08:21:22 2008
@@ -20,17 +20,16 @@
 package org.apache.axis2.clustering;
 
 import junit.framework.TestCase;
-import org.apache.axis2.clustering.ClusterManager;
-import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.clustering.context.DefaultContextManagerListener;
-import org.apache.axis2.clustering.configuration.TestConfigurationManagerListener;
 import org.apache.axis2.clustering.configuration.ConfigurationManagerListener;
 import org.apache.axis2.clustering.configuration.DefaultConfigurationManagerListener;
+import org.apache.axis2.clustering.configuration.TestConfigurationManagerListener;
+import org.apache.axis2.clustering.context.DefaultContextManagerListener;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.http.server.HttpUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -64,7 +63,7 @@
 
         configurationContext1 = ConfigurationContextFactory.createDefaultConfigurationContext();
         configurationContext2 = ConfigurationContextFactory.createDefaultConfigurationContext();
-        
+
         clusterManager1 = getClusterManager(configurationContext1);
         clusterManager2 = getClusterManager(configurationContext2);
 
@@ -93,15 +92,17 @@
         axisConfiguration2.addServiceGroup(serviceGroup2);
 
         //Initiating ClusterManagers
+        System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, HttpUtils.getIpAddress());
         try {
             clusterManager1.init();
+            System.out.println("ClusterManager-1 successfully initialized");
+            System.out.println("*** PLEASE IGNORE THE java.net.ConnectException STACKTRACES. THIS IS EXPECTED ***");
             clusterManager2.init();
+            System.out.println("ClusterManager-2 successfully initialized");
         } catch (ClusteringFault e) {
-            String message = "Could not initialize ClusterManagers. Please check the network connection";
-            if (log.isErrorEnabled()) {
-                log.error(message);
-            }
-
+            String message =
+                    "Could not initialize ClusterManagers. Please check the network connection";
+            log.error(message, e);
             skipChannelTests = true;
         }
     }

Copied: webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java (from r610664, webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java?p2=webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java&p1=webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java&r1=610664&r2=612147&rev=612147&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/ContextReplicationTest.java Tue Jan 15 08:21:22 2008
@@ -27,34 +27,160 @@
 import org.apache.axis2.clustering.tribes.TribesClusterManager;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Parameter;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.transport.http.server.HttpUtils;
 
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MulticastSocket;
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
- *
+ * Tests the replication of properties placed the ConfigurationContext, ServiceGroupContext &
+ * ServiceContext
  */
 public class ContextReplicationTest extends TestCase {
 
     private static final String TEST_SERVICE_NAME = "testService";
 
+    private static final Parameter domainParam =
+            new Parameter(ClusteringConstants.DOMAIN, "axis2.domain." + UUIDGenerator.getUUID());
+
+    // --------------- Cluster-1 ------------------------------------------------------
     private ClusterManager clusterManager1;
     private ContextManager ctxMan1;
     private ConfigurationManager configMan1;
     private ConfigurationContext configurationContext1;
     private AxisServiceGroup serviceGroup1;
     private AxisService service1;
+    //---------------------------------------------------------------------------------
 
+    // --------------- Cluster-2 ------------------------------------------------------
     private ClusterManager clusterManager2;
     private ContextManager ctxMan2;
     private ConfigurationManager configMan2;
     private ConfigurationContext configurationContext2;
     private AxisServiceGroup serviceGroup2;
     private AxisService service2;
+    //---------------------------------------------------------------------------------
+
+    private static boolean canMulticast;
+
+    private int getPort(int portStart, int retries) throws IOException {
+        InetSocketAddress addr = null;
+        ServerSocket socket = new ServerSocket();
+        int port = -1;
+        while (retries > 0) {
+            try {
+                addr = new InetSocketAddress(InetAddress.getByName(InetAddress.getLocalHost().getHostAddress()),
+                                             portStart);
+                socket.bind(addr);
+                port = portStart;
+                System.out.println("Can bind Server Socket to:" + addr);
+                socket.close();
+                break;
+            } catch (IOException x) {
+                retries--;
+                if (retries <= 0) {
+                    System.out.println("Unable to bind server socket to:" + addr +
+                                       " throwing error.");
+                    throw x;
+                }
+                portStart++;
+            }
+        }
+        return port;
+    }
+
+    private void checkMulticast() {
+
+        // Which port should we listen to
+        final int port;
+        try {
+            port = getPort(4000, 1000);
+        } catch (IOException e) {
+            e.printStackTrace();
+            canMulticast = false;
+            return;
+        }
+
+        // Which address
+        final String group = "225.4.5.6";
+
+        Thread receiver = new Thread() {
+            public void run() {
+                try {
+                    MulticastSocket s = new MulticastSocket(port);
+                    s.joinGroup(InetAddress.getByName(group));
+
+                    // Create a DatagramPacket and do a receive
+                    byte buf[] = new byte[1024];
+                    DatagramPacket pack = new DatagramPacket(buf, buf.length);
+                    s.receive(pack);
+                    System.out.println("Received data from: " + pack.getAddress().toString() +
+                                       ":" + pack.getPort() + " with length: " +
+                                       pack.getLength());
+                    s.leaveGroup(InetAddress.getByName(group));
+                    s.close();
+                    canMulticast = true;
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    canMulticast = false;
+                }
+            }
+        };
+        receiver.start();
+
+        Thread sender = new Thread() {
+            public void run() {
+                try {
+                    MulticastSocket s = new MulticastSocket();
+                    byte buf[] = new byte[10];
+                    for (int i = 0; i < buf.length; i++) {
+                        buf[i] = (byte) i;
+                    }
+                    DatagramPacket pack = new DatagramPacket(buf, buf.length,
+                                                             InetAddress.getByName(group), port);
+                    s.setTimeToLive(2);
+                    s.send(pack);
+                    System.out.println("Sent test data");
+                    s.close();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    canMulticast = false;
+                }
+            }
+        };
+        sender.start();
+
+        // Join the receiver until we can verify whether multicasting can be done
+        try {
+            receiver.join(10000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        new ContextReplicationTest().checkMulticast();
+    }
 
     protected void setUp() throws Exception {
+        checkMulticast();
+        if (!canMulticast) {
+            System.out.println("[WARNING] Aborting clustering test since multicasting cannot be carried out");
+            return;
+        }
+
         System.setProperty(ClusteringConstants.LOCAL_IP_ADDRESS, HttpUtils.getIpAddress());
 
         // First cluster
@@ -65,8 +191,9 @@
         ctxMan1 = getContextManager();
         configMan1 = getConfigurationManager();
         clusterManager1 = getClusterManager(configurationContext1, ctxMan1, configMan1);
+        clusterManager1.addParameter(domainParam);
         clusterManager1.init();
-        System.out.println("ClusterManager-1 successfully initialized");
+        System.out.println("---------- ClusterManager-1 successfully initialized -----------");
 
         // Second cluster
         configurationContext2 =
@@ -76,8 +203,9 @@
         ctxMan2 = getContextManager();
         configMan2 = getConfigurationManager();
         clusterManager2 = getClusterManager(configurationContext2, ctxMan2, configMan2);
+        clusterManager2.addParameter(domainParam);
         clusterManager2.init();
-        System.out.println("ClusterManager-2 successfully initialized");
+        System.out.println("---------- ClusterManager-2 successfully initialized -----------");
     }
 
     protected ClusterManager getClusterManager(ConfigurationContext configCtx,
@@ -126,13 +254,15 @@
     }
 
     public void testSetPropertyInConfigurationContext() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
         {
             String key1 = "configCtxKey";
             String val1 = "configCtxVal1";
             configurationContext1.setProperty(key1, val1);
             ctxMan1.updateContext(configurationContext1);
-            Thread.sleep(1000); // Give some time for the replication to take place
-
             String value = (String) configurationContext2.getProperty(key1);
             assertEquals(val1, value);
         }
@@ -142,14 +272,17 @@
             String val2 = "configCtxVal1";
             configurationContext2.setProperty(key2, val2);
             ctxMan2.updateContext(configurationContext2);
-            Thread.sleep(1000); // Give some time for the replication to take place
-
+            Thread.sleep(1000);
             String value = (String) configurationContext1.getProperty(key2);
             assertEquals(val2, value);
         }
     }
 
     public void testRemovePropertyFromConfigurationContext() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
         String key1 = "configCtxKey";
         String val1 = "configCtxVal1";
 
@@ -157,8 +290,6 @@
         {
             configurationContext1.setProperty(key1, val1);
             ctxMan1.updateContext(configurationContext1);
-            Thread.sleep(1000); // Give some time for the replication to take place
-
             String value = (String) configurationContext2.getProperty(key1);
             assertEquals(val1, value);
         }
@@ -166,15 +297,15 @@
         // Next remove this property from cluster 2, replicate it, and check that it is unavailable in cluster 1
         configurationContext2.removeProperty(key1);
         ctxMan2.updateContext(configurationContext2);
-        Thread.sleep(1000); // Give some time for the replication to take place
-
         String value = (String) configurationContext1.getProperty(key1);
         assertNull(configurationContext2.getProperty(key1));
         assertNull(value);
     }
 
     public void testSetPropertyInServiceGroupContext() throws Exception {
-//        String sgcID = UUIDGenerator.getUUID();
+        if (!canMulticast) {
+            return;
+        }
 
         ServiceGroupContext serviceGroupContext1 =
                 configurationContext1.createServiceGroupContext(serviceGroup1);
@@ -192,12 +323,45 @@
         String val1 = "sgCtxVal1";
         serviceGroupContext1.setProperty(key1, val1);
         ctxMan1.updateContext(serviceGroupContext1);
+        assertEquals(val1, serviceGroupContext2.getProperty(key1));
+    }
 
-        Thread.sleep(1000);
+    public void testRemovePropertyFromServiceGroupContext() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        // Add the property
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(TEST_SERVICE_NAME);
+        configurationContext1.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(TEST_SERVICE_NAME);
+        configurationContext2.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceGroupContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceGroupContext1);
         assertEquals(val1, serviceGroupContext2.getProperty(key1));
+
+        // Remove the property
+        serviceGroupContext2.removeProperty(key1);
+        assertNull(serviceGroupContext2.getProperty(key1));
+        ctxMan2.updateContext(serviceGroupContext2);
+        assertNull(serviceGroupContext1.getProperty(key1));
     }
 
     public void testSetPropertyInServiceGroupContext2() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
         String sgcID = UUIDGenerator.getUUID();
 
         ServiceGroupContext serviceGroupContext1 =
@@ -217,16 +381,255 @@
         serviceGroupContext1.setProperty(key1, val1);
         ctxMan1.updateContext(serviceGroupContext1);
 
-        Thread.sleep(1000);
         assertEquals(val1, serviceGroupContext2.getProperty(key1));
     }
 
+    public void testRemovePropertyFromServiceGroupContext2() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        // Add the property
+        String sgcID = UUIDGenerator.getUUID();
+
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(sgcID);
+        configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(sgcID);
+        configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceGroupContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceGroupContext1);
+
+        assertEquals(val1, serviceGroupContext2.getProperty(key1));
+
+        // Remove the property
+        serviceGroupContext2.removeProperty(key1);
+        assertNull(serviceGroupContext2.getProperty(key1));
+        ctxMan2.updateContext(serviceGroupContext2);
+        assertNull(serviceGroupContext1.getProperty(key1));
+    }
+
+    public void testSetPropertyInServiceContext() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext1 = serviceGroupContext1.getServiceContext(service1);
+        configurationContext1.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+        assertNotNull(serviceContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext2 = serviceGroupContext2.getServiceContext(service2);
+        configurationContext2.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+        assertNotNull(serviceContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceContext1);
+
+        assertEquals(val1, serviceContext2.getProperty(key1));
+    }
+
+    public void testSetPropertyInServiceContext2() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext1 = serviceGroupContext1.getServiceContext(service1);
+        configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+        assertNotNull(serviceContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext2 = serviceGroupContext2.getServiceContext(service2);
+        configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+        assertNotNull(serviceContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceContext1);
+
+        assertEquals(val1, serviceContext2.getProperty(key1));
+    }
+
+    public void testRemovePropertyFromServiceContext() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        // Add the property
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext1 = serviceGroupContext1.getServiceContext(service1);
+        configurationContext1.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+        assertNotNull(serviceContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext2 = serviceGroupContext2.getServiceContext(service2);
+        configurationContext2.addServiceGroupContextIntoApplicationScopeTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+        assertNotNull(serviceContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceContext1);
+
+        assertEquals(val1, serviceContext2.getProperty(key1));
+
+        // Remove the property
+        serviceContext2.removeProperty(key1);
+        assertNull(serviceContext2.getProperty(key1));
+        ctxMan2.updateContext(serviceContext2);
+        assertNull(serviceContext1.getProperty(key1));
+    }
+
+    public void testRemovePropertyFromServiceContext2() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        // Add the property
+        ServiceGroupContext serviceGroupContext1 =
+                configurationContext1.createServiceGroupContext(serviceGroup1);
+        serviceGroupContext1.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext1 = serviceGroupContext1.getServiceContext(service1);
+        configurationContext1.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext1);
+        assertNotNull(serviceGroupContext1);
+        assertNotNull(serviceContext1);
+
+        ServiceGroupContext serviceGroupContext2 =
+                configurationContext2.createServiceGroupContext(serviceGroup2);
+        serviceGroupContext2.setId(TEST_SERVICE_NAME);
+        ServiceContext serviceContext2 = serviceGroupContext2.getServiceContext(service2);
+        configurationContext2.addServiceGroupContextIntoSoapSessionTable(serviceGroupContext2);
+        assertNotNull(serviceGroupContext2);
+        assertNotNull(serviceContext2);
+
+        String key1 = "sgCtxKey";
+        String val1 = "sgCtxVal1";
+        serviceContext1.setProperty(key1, val1);
+        ctxMan1.updateContext(serviceContext1);
+
+        assertEquals(val1, serviceContext2.getProperty(key1));
+
+        // Remove the property
+        serviceContext2.removeProperty(key1);
+        assertNull(serviceContext2.getProperty(key1));
+        ctxMan2.updateContext(serviceContext2);
+        assertNull(serviceContext1.getProperty(key1));
+    }
+
+    public void testReplicationExclusion1() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        String key1 = "local_configCtxKey";
+        String val1 = "configCtxVal1";
+        configurationContext1.setProperty(key1, val1);
+        List exclusionPatterns = new ArrayList();
+        exclusionPatterns.add("local_*");
+        ctxMan1.setReplicationExcludePatterns("defaults", exclusionPatterns);
+        ctxMan1.updateContext(configurationContext1);
+
+        String value = (String) configurationContext2.getProperty(key1);
+        assertNull(value); // The property should not have gotten replicated
+    }
+
+    public void testReplicationExclusion2() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        String key1 = "local_configCtxKey";
+        String val1 = "configCtxVal1";
+        configurationContext1.setProperty(key1, val1);
+        List exclusionPatterns = new ArrayList();
+        exclusionPatterns.add("local_*");
+        ctxMan1.setReplicationExcludePatterns("org.apache.axis2.context.ConfigurationContext",
+                                              exclusionPatterns);
+        ctxMan1.updateContext(configurationContext1);
+
+        String value = (String) configurationContext2.getProperty(key1);
+        assertNull(value); // The property should not have gotten replicated
+    }
+
+    public void testReplicationExclusion3() throws Exception {
+        if (!canMulticast) {
+            return;
+        }
+
+        String key1 = "local1_configCtxKey";
+        String val1 = "configCtxVal1";
+        configurationContext1.setProperty(key1, val1);
+
+        String key2 = "local2_configCtxKey";
+        String val2 = "configCtxVal2";
+        configurationContext1.setProperty(key2, val2);
+
+        String key3 = "local3_configCtxKey";
+        String val3 = "configCtxVal3";
+        configurationContext1.setProperty(key3, val3);
+
+        List exclusionPatterns1 = new ArrayList();
+        exclusionPatterns1.add("local1_*");
+        List exclusionPatterns2 = new ArrayList();
+        exclusionPatterns2.add("local2_*");
+        ctxMan1.setReplicationExcludePatterns("org.apache.axis2.context.ConfigurationContext",
+                                              exclusionPatterns1);
+        ctxMan1.setReplicationExcludePatterns("defaults",
+                                              exclusionPatterns2);
+        ctxMan1.updateContext(configurationContext1);
+
+        String value1 = (String) configurationContext2.getProperty(key1);
+        assertNull(value1); // The property should not have gotten replicated
+        String value2 = (String) configurationContext2.getProperty(key2);
+        assertNull(value2); // The property should not have gotten replicated
+        String value3 = (String) configurationContext2.getProperty(key3);
+        assertEquals(val3, value3); // The property should have gotten replicated
+
+    }
+
     protected void tearDown() throws Exception {
         super.tearDown();
-        clusterManager1.shutdown();
-        clusterManager2.shutdown();
+        if (clusterManager1 != null) {
+            clusterManager1.shutdown();
+            System.out.println("------ CLuster-1 shutdown complete ------");
+        }
+        if (clusterManager2 != null) {
+            clusterManager2.shutdown();
+            System.out.println("------ CLuster-2 shutdown complete ------");
+        }
+//        MembershipManager.removeAllMembers();
+        Thread.sleep(500);
     }
-    /*public void test2() {
-
-    }*/
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/clustering/test/org/apache/axis2/clustering/UpdateStateTestCase.java Tue Jan 15 08:21:22 2008
@@ -38,15 +38,12 @@
     String sgcID = null;
 
     String key1 = "key1";
-
-    String key2 = "key2";
-
-    String key3 = "key3";
-
     String val1 = "val1";
 
+    String key2 = "key2";
     String val2 = "val2";
 
+    String key3 = "key3";
     String val3 = "val3";
 
     public void setUp() throws Exception {

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Tue Jan 15 08:21:22 2008
@@ -40,7 +40,7 @@
 
         System.out.println(CodegenMessages.getMessage("wsdl2code.arg"));
         System.out.println(CodegenMessages.getMessage("wsdl2code.arg1"));
-        for (int i = 2; i <= 40; i++) {
+        for (int i = 2; i <= 42; i++) {
             System.out.println("  " + CodegenMessages.getMessage("wsdl2code.arg" + i));
         }
         System.exit(0);

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Tue Jan 15 08:21:22 2008
@@ -258,6 +258,17 @@
                     commandLineOption.getOptionValue());
         }
 
+        //setting http proxy host and http proxy port
+        commandLineOption = loadOption(null, WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG, optionMap);
+        if (commandLineOption != null) {
+            System.setProperty("http.proxyHost", commandLineOption.getOptionValue());
+        }
+
+        commandLineOption = loadOption(null, WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG, optionMap);
+        if (commandLineOption != null) {
+            System.setProperty("http.proxyPort", commandLineOption.getOptionValue());
+        }
+
         // setting the overrid and all ports options
         config.setAllPorts(loadOption(WSDL2JavaConstants.All_PORTS_OPTION,
                                       WSDL2JavaConstants.All_PORTS_OPTION_LONG,

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Tue Jan 15 08:21:22 2008
@@ -92,6 +92,8 @@
 import java.util.Map;
 import java.util.Set;
 
+
+
 public class AxisServiceBasedMultiLanguageEmitter implements Emitter {
 
     protected static final String CALL_BACK_HANDLER_SUFFIX = "CallbackHandler";
@@ -268,13 +270,13 @@
 
         return property;
     }
-    
+
     private Policy getBindingPolicyFromMessage(AxisBindingOperation axisBindingOperation,
                                                String key) {
         AxisBindingMessage axisBindingMessage = null;
-        
+
         if (axisBindingOperation != null) {
-        
+
             axisBindingMessage = (AxisBindingMessage) axisBindingOperation.getChild(key);
             if (axisBindingMessage != null) {
                 try {
@@ -1379,7 +1381,9 @@
         axisService.setCustomSchemaNameSuffix(".xsd");//suffix with .xsd - the file name extension
         //force the mappings to be reconstructed
         axisService.setSchemaLocationsAdjusted(false);
-        Map changedMap = axisService.populateSchemaMappings();
+        //when generating the code we should copy all the schemas to
+        // resource folder.
+        Map changedMap = axisService.populateSchemaMappings(true);
 
         // add these two attribute to use the user defined wsdl to use.
         try {
@@ -1775,7 +1779,8 @@
              operationsIterator.hasNext();) {
             AxisOperation axisOperation = (AxisOperation) operationsIterator.next();
             elt = doc.createElement("name");
-            elt.appendChild(doc.createTextNode(axisOperation.getName().getLocalPart()));
+            String localPart = axisOperation.getName().getLocalPart();
+            elt.appendChild(doc.createTextNode(JavaUtils.xmlNameToJava(localPart)));
 
             //what needs to be put here as the opertation namespace is actually the
             //traget namespace of the service
@@ -2171,7 +2176,7 @@
         addAttribute(doc, "comment", comment, methodElement);
 
         String messageExchangePattern = axisOperation.getMessageExchangePattern();
-        
+
         //Jaxws Specific
         if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){
             boolean wrapped = false;
@@ -2184,7 +2189,7 @@
             addAttribute(doc, "parameterstyle", (wrapped)?"WRAPPPED":"BARE", methodElement);
         }
 
-        
+
         addAttribute(doc, "dbsupportname",
                 endpointName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
                 methodElement);
@@ -2193,7 +2198,7 @@
         addAttribute(doc, "mepURI", messageExchangePattern, methodElement);
         Parameter wsdl2StyleParameter = axisOperation.getParameter(WSDL2Constants.OPERATION_STYLE);
         if (wsdl2StyleParameter != null) {
-        	// provide WSDL2 styles to allow templates to take advantage of them, if desired 
+            // provide WSDL2 styles to allow templates to take advantage of them, if desired
             addAttribute(doc, "wsdl2Styles", arrayToString((URI[])wsdl2StyleParameter.getValue()), methodElement);
         }
 
@@ -2214,7 +2219,7 @@
         addOutputAndFaultActions(doc, methodElement, axisOperation);
         addHeaderOperations(soapHeaderInputParameterList, bindingOperation, true);
 //        addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
-        
+
 
         if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) {
             if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){
@@ -2369,19 +2374,19 @@
      * or a comma-separated list when size > 1.
      */
     private String arrayToString(Object[] array) {
-    	if (array == null || array.length == 0) {
-    		return "";
-    	}
-    	int size = array.length;
-    	if (size == 1) {
-    		return String.valueOf(array[0]);
-    	}
-    	StringBuffer result = new StringBuffer(String.valueOf(array[0]));
-    	for (int i=1; i<size; i++) {
-    		result.append(",");
-    		result.append(String.valueOf(array[i]));
-    	}
-    	return result.toString();
+        if (array == null || array.length == 0) {
+            return "";
+        }
+        int size = array.length;
+        if (size == 1) {
+            return String.valueOf(array[0]);
+        }
+        StringBuffer result = new StringBuffer(String.valueOf(array[0]));
+        for (int i=1; i<size; i++) {
+            result.append(",");
+            result.append(String.valueOf(array[i]));
+        }
+        return result.toString();
     }
 
     /**
@@ -2687,10 +2692,10 @@
             for (int i = 0; i < parameterElementList.size(); i++) {
                 inputElt.appendChild((Element) parameterElementList.get(i));
             }
-            
+
             /*
-             * Setting the effective policy of input message
-             */
+            * Setting the effective policy of input message
+            */
             Policy policy = getBindingPolicyFromMessage(bindingOperation,
                     WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
 
@@ -2703,7 +2708,7 @@
                     throw new RuntimeException("can't serialize the policy ..");
                 }
             }
-            
+
         }
         return inputElt;
     }
@@ -2760,10 +2765,10 @@
             for (int i = 0; i < outputElementList.size(); i++) {
                 outputElt.appendChild((Element) outputElementList.get(i));
             }
-            
+
             /*
-             * Setting the effective policy for the output message.
-             */
+            * Setting the effective policy for the output message.
+            */
             Policy policy = getBindingPolicyFromMessage(bindingOperation,
                     WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
 
@@ -2820,6 +2825,13 @@
                 addAttribute(doc, "localname",
                         msg.getElementQName().getLocalPart(),
                         paramElement);
+
+                if (msg.getElementQName() != null) {
+                    Element qNameElement = doc.createElement("qname");
+                    addAttribute(doc, "nsuri", msg.getElementQName().getNamespaceURI(), qNameElement);
+                    addAttribute(doc, "localname", msg.getElementQName().getLocalPart(), qNameElement);
+                    paramElement.appendChild(qNameElement);
+                }
                 //the type represents the type that will be wrapped by this
                 //name
                 String typeMapping =
@@ -3021,7 +3033,7 @@
         if (codeGenConfiguration.getOutputLanguage().equals("jax-ws") && useHolderClass_jaxws) {
             Class primitive = JavaUtils.getWrapperClass(paramType);
             if(primitive != null){
-                paramType = primitive.getName();    
+                paramType = primitive.getName();
             }
         }
 
@@ -3042,7 +3054,8 @@
 
         //if the opName and partName are present , add them
         if (opName != null) {
-            addAttribute(doc, "opname", opName.getLocalPart(), paramElement);
+            String localPart = opName.getLocalPart();
+            addAttribute(doc, "opname", JavaUtils.xmlNameToJava(localPart), paramElement);
         }
 
         if (paramQName != null) {
@@ -3060,7 +3073,7 @@
                 if (codeGenConfiguration.getOutputLanguage().equals("jax-ws")) {
                     javaName = JavaUtils.xmlNameToJavaIdentifier(JavaUtils.xmlNameToJava(partName));
                 } else {
-                    javaName = JavaUtils.capitalizeFirstChar(JavaUtils.xmlNameToJava(partName));   
+                    javaName = JavaUtils.capitalizeFirstChar(JavaUtils.xmlNameToJava(partName));
                 }
             }
             addAttribute(doc, "partname", javaName, paramElement);
@@ -3114,7 +3127,8 @@
 
         // add this as a body parameter
         addAttribute(doc, "location", "body", paramElement);
-        addAttribute(doc, "opname", operation.getName().getLocalPart(), paramElement);
+        String localPart = operation.getName().getLocalPart();
+        addAttribute(doc, "opname", JavaUtils.xmlNameToJava(localPart), paramElement);
 
         //if the unwrapping or backWordCompatibility flag is on then we have to
         //put the element complex type if it exits
@@ -3131,7 +3145,7 @@
             if (JavaUtils.isJavaKeyword(partName)) {
                 javaName = JavaUtils.makeNonJavaKeyword(partName);
             } else {
-                javaName = JavaUtils.xmlNameToJavaIdentifier(JavaUtils.xmlNameToJava(partName));   
+                javaName = JavaUtils.xmlNameToJavaIdentifier(JavaUtils.xmlNameToJava(partName));
             }
             addAttribute(doc, "partname", javaName, paramElement);
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java Tue Jan 15 08:21:22 2008
@@ -555,20 +555,13 @@
             addAttribute(doc, "primitive", "yes", paramElement);
         }
 
-        // the following methods are moved from addOurs functioin
-        Map typeMap = CTypeInfo.getTypeMap();
-        Iterator it = typeMap.keySet().iterator();
+        // the new trick to identify adb types
         boolean isOurs = true;
-        while (it.hasNext()) {
-            if (it.next().equals(typeMappingStr)) {
-                isOurs = false;
-                break;
-            }
-        }
 
-        if (isOurs && typeMappingStr.length() != 0 && !typeMappingStr.equals("void") &&
+        if (typeMappingStr.length() != 0 && !typeMappingStr.equals("void") &&
                 !typeMappingStr.equals(C_DEFAULT_TYPE)) {
             addAttribute(doc, "ours", "yes", paramElement);
+            isOurs = true;
         } else {
             isOurs = false;
         }
@@ -591,8 +584,6 @@
     protected void addCSpecifcAttributes(Document doc, AxisOperation operation, Element param,
                                          String messageType) {
         String typeMappingStr;
-        Map typeMap = CTypeInfo.getTypeMap();
-        Iterator typeMapIterator = typeMap.keySet().iterator();
         AxisMessage message;
 
         if (messageType.equals(WSDLConstants.MESSAGE_LABEL_IN_VALUE))
@@ -617,15 +608,8 @@
         }
 
         addAttribute(doc, "caps-type", paramType.toUpperCase(), param);
-        boolean isOurs = true;
-        while (typeMapIterator.hasNext()) {
-            if (typeMapIterator.next().equals(typeMapping)) {
-                isOurs = false;
-                break;
-            }
-        }
 
-        if (isOurs && !paramType.equals("") && !paramType.equals("void") &&
+        if (!paramType.equals("") && !paramType.equals("void") &&
                 !paramType.equals("org.apache.axiom.om.OMElement") &&
                 !typeMappingStr.equals(C_DEFAULT_TYPE)) {
             addAttribute(doc, "ours", "yes", param);

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ServiceXMLWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ServiceXMLWriter.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ServiceXMLWriter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ServiceXMLWriter.java Tue Jan 15 08:21:22 2008
@@ -19,6 +19,8 @@
 
 package org.apache.axis2.wsdl.codegen.writer;
 
+import org.apache.axis2.i18n.Messages;
+
 import java.io.File;
 import java.io.FileOutputStream;
 
@@ -42,9 +44,10 @@
                                                      ".xml");
         //set the existing flag
         fileExists = outputFile.exists();
-        if (!fileExists) {
+        if (!fileExists || this.isOverride) {
             this.stream = new FileOutputStream(outputFile);
         }
+        
     }
 }
 

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/databinding/CTypeMapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/databinding/CTypeMapper.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/databinding/CTypeMapper.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/databinding/CTypeMapper.java Tue Jan 15 08:21:22 2008
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.wsdl.databinding;
 
-import org.apache.axis2.wsdl.codegen.emitter.CTypeInfo;
+import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.wsdl.i18n.CodegenMessages;
 
 import javax.xml.namespace.QName;
@@ -37,8 +37,8 @@
             Object o = qName2NameMap.get(qname);
             if (o != null) {
                 return (String)o;
-            } else if (CTypeInfo.XSD_ANYTYPE.equals(qname) ||
-                    CTypeInfo.XSD_ANY.equals(qname)) {
+            } else if (Constants.XSD_ANYTYPE.equals(qname) ||
+                    Constants.XSD_ANY.equals(qname)) {
                 return defaultStructName;
             } else {
                 throw new UnmatchedTypeException(
@@ -50,8 +50,6 @@
         } else {
             return null;
         }
-
-
     }
 
     public String getDefaultMappingName() {

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties Tue Jan 15 08:21:22 2008
@@ -74,6 +74,8 @@
 wsdl2code.arg38=  --noBuildXML             Don't generate the build.xml in the output directory
 wsdl2code.arg39=  --noWSDL                 Don't generate WSDL's in the resources directory
 wsdl2code.arg40=  --noMessageReceiver      Don't generate a MessageReceiver in the generated sources
+wsdl2code.arg41=  --http-proxy-host        Proxy host address if you are behind a firewall
+wsdl2code.arg42=  --http-proxy-port        Proxy prot address if you are behind a firewall
 
 ################## prop file loader #################################
 propfileload.frameworkMismatch=Number of frameworks and extension names do not match!

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl Tue Jan 15 08:21:22 2008
@@ -20,8 +20,8 @@
 
         #include "<xsl:value-of select="$svcop-prefix"/>.h"
         #include &lt;axis2_svc_skeleton.h&gt;
-        #include &lt;axutil_array_list.h&gt;
         #include &lt;stdio.h&gt;
+        #include &lt;axis2_svc.h&gt;
 
         /**
          * functions prototypes
@@ -75,7 +75,6 @@
 
         svc_skeleton->ops = &amp;<xsl:value-of select="$skeletonname"/>_svc_skeleton_ops_var;
 
-	    svc_skeleton->func_array = NULL;
 
 	    return svc_skeleton;
 	}
@@ -85,11 +84,6 @@
 	<xsl:value-of select="$method-prefix"/>_init(axis2_svc_skeleton_t *svc_skeleton,
 	                        const axutil_env_t *env)
 	{
-	    svc_skeleton->func_array = axutil_array_list_create(env, 10);
-        <xsl:for-each select="method">
-	      axutil_array_list_add(svc_skeleton->func_array, env, axutil_strdup(env, "<xsl:value-of select="@localpart"/>"));
-        </xsl:for-each>
-
 	    /* Any initialization stuff of <xsl:value-of select="$svcname"/> goes here */
 	    return AXIS2_SUCCESS;
 	}
@@ -98,12 +92,6 @@
 	<xsl:value-of select="$method-prefix"/>_free(axis2_svc_skeleton_t *svc_skeleton,
 				 const axutil_env_t *env)
 	{
-        /* Free the function array */
-        if (svc_skeleton->func_array)
-        {
-            axutil_array_list_free(svc_skeleton->func_array, env);
-            svc_skeleton->func_array = NULL;
-        }
 
         /* Free the service skeleton */
         if (svc_skeleton)
@@ -143,16 +131,17 @@
             <xsl:variable name="outputtype">
               <xsl:choose>
                 <xsl:when test="output/param/@ours">adb_<xsl:value-of select="output/param/@type"/>_t*</xsl:when>
+                <xsl:when test="not(output/param/@type)">axis2_status_t</xsl:when>
                 <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
               </xsl:choose>
             </xsl:variable>
             <xsl:value-of select="$outputtype"/> ret_val<xsl:value-of select="$position"/><xsl:if test="output/param/@ours"> = NULL</xsl:if>;
-            <xsl:for-each select="input/param[@type!='']">
+            <xsl:if test="input/param/@type!=''">
               <xsl:variable name="inputtype">
-                <xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
+                <xsl:if test="input/param/@ours">adb_</xsl:if><xsl:value-of select="input/param/@type"/><xsl:if test="input/param/@ours">_t*</xsl:if>
               </xsl:variable>
-              <xsl:value-of select="$inputtype"/> input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/><xsl:if test="input/param/@ours"> = NULL</xsl:if>;
-            </xsl:for-each>
+              <xsl:value-of select="$inputtype"/> input_val<xsl:value-of select="$position"/><xsl:if test="input/param/@ours"> = NULL</xsl:if>;
+            </xsl:if>
           </xsl:for-each>
 
           operation_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
@@ -172,40 +161,53 @@
 
                 if ( axutil_strcmp(op_name, "<xsl:value-of select="@localpart"/>") == 0 )
                 {
-                    <xsl:for-each select="input/param[@type!='']">
-                    input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/> = <xsl:choose>
-                        <xsl:when test="@ours">
-                        adb_<xsl:value-of select="@type"/>_create( env);
-                        if( AXIS2_FAILURE == adb_<xsl:value-of select="@type"/>_deserialize(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env, &amp;content_node ))
+                    <xsl:if test="input/param/@type!=''">
+                    input_val<xsl:value-of select="$position"/> = <xsl:choose>
+                        <xsl:when test="input/param/@ours">
+                        adb_<xsl:value-of select="input/param/@type"/>_create( env);
+                        if( AXIS2_FAILURE == adb_<xsl:value-of select="input/param/@type"/>_deserialize(input_val<xsl:value-of select="$position"/>, env, &amp;content_node, NULL, AXIS2_FALSE))
                         {
-                            adb_<xsl:value-of select="@type"/>_free(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env);
+                            adb_<xsl:value-of select="input/param/@type"/>_free(input_val<xsl:value-of select="$position"/>, env);
                       
                             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
-                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the <xsl:value-of select="@type"/>_deserialize: "
+                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the <xsl:value-of select="input/param/@type"/>_deserialize: "
                                         "This should be due to an invalid XML");
                             return NULL;      
                         }
                         </xsl:when>
                         <xsl:otherwise>content_node;</xsl:otherwise>
                         </xsl:choose>
-                    ret_val<xsl:value-of select="$position"/> =  <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/>(env,
-                                                input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/> );
-                    if ( NULL == ret_val<xsl:value-of select="$position"/> )
-                    {
-                        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
-                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from <xsl:value-of select="$method-name"/> ");
-                        return NULL; 
-                    }
-                    ret_node = <xsl:choose>
-                                   <xsl:when test="@ours">
-                               adb_<xsl:value-of select="$outputtype"/>_serialize(ret_val<xsl:value-of select="$position"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
-                               adb_<xsl:value-of select="$outputtype"/>_free(ret_val<xsl:value-of select="$position"/>, env);
-                               adb_<xsl:value-of select="@type"/>_free(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env);
-                                   </xsl:when>
-                                   <xsl:otherwise>ret_val<xsl:value-of select="$position"/>;</xsl:otherwise>
-                                </xsl:choose>
-                    return ret_node;
-                    </xsl:for-each>
+                    </xsl:if>
+                    ret_val<xsl:value-of select="$position"/> =  <xsl:value-of select="$svcop-prefix"/>_<xsl:value-of select="$method-name"/>(env <xsl:if test="input/param/@type!=''">,</xsl:if>
+                                                <xsl:if test="input/param/@type!=''">input_val<xsl:value-of select="$position"/></xsl:if> );
+                    <xsl:choose>
+                    <xsl:when test="output/param/@type">
+                        if ( NULL == ret_val<xsl:value-of select="$position"/> )
+                        {
+                            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DATA_ELEMENT_IS_NULL, AXIS2_FAILURE);
+                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from <xsl:value-of select="$method-name"/> ");
+                            return NULL; 
+                        }
+                        ret_node = <xsl:choose>
+                                       <xsl:when test="output/param/@ours">
+                                   adb_<xsl:value-of select="$outputtype"/>_serialize(ret_val<xsl:value-of select="$position"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
+                                   adb_<xsl:value-of select="$outputtype"/>_free(ret_val<xsl:value-of select="$position"/>, env);
+                                   <xsl:if test="input/param/@type!=''">
+                                    adb_<xsl:value-of select="input/param/@type"/>_free(input_val<xsl:value-of select="$position"/>, env);
+                                   </xsl:if>
+                                       </xsl:when>
+                                       <xsl:otherwise>ret_val<xsl:value-of select="$position"/>;</xsl:otherwise>
+                                    </xsl:choose>
+                        return ret_node;
+                    </xsl:when>
+                    <xsl:otherwise>
+                        if( AXIS2_FAILURE == ret_val<xsl:value-of select="$position"/> )
+                        {
+                            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "NULL returnted from the business logic from <xsl:value-of select="$method-name"/> ");
+                        }
+                        return NULL;
+                    </xsl:otherwise>
+                    </xsl:choose>
 
                     <!-- below was  prior to the databinding -->
                     <!-- <xsl:if test="$outputtype!=''">return </xsl:if>
@@ -218,7 +220,7 @@
              </xsl:for-each>
              }
           printf("<xsl:value-of select="$skeletonname"/> service ERROR: invalid OM parameters in request\n");
-          return content_node;
+          return NULL;
     }
 
     axiom_node_t* AXIS2_CALL

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -38,7 +38,7 @@
             </description>
 			<xsl:for-each select="method">
 				<operation>
-					<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+					<xsl:attribute name="name"><xsl:value-of select="@localpart"/></xsl:attribute>
             <xsl:if test="@soapaction">
               <parameter>
                 <xsl:attribute name="name"><xsl:text>wsamapping</xsl:text></xsl:attribute>

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubHeaderTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -100,10 +100,8 @@
             </xsl:choose>
             <xsl:text> </xsl:text>
             axis2_stub_op_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each select="input/param[@type!='']">,
-                                                        <xsl:variable name="inputtype">
-                                                            <xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
-                                                        </xsl:variable>
-                                                        <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
+                                                        <xsl:variable name="inputtype"><xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
+                                                        <xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
                                                     </xsl:for-each>);
           </xsl:if>
         </xsl:for-each>
@@ -119,20 +117,34 @@
          * @param env environment ( mandatory)
          <!--  select only the body parameters  -->
          <xsl:for-each select="input/param[@type!='']">* @param _<xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+         * @param user_data user data to be accessed by the callbacks
          * @param on_complete callback to handle on complete
          * @param on_error callback to handle on error
          */
 
         <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
+
+        <xsl:variable name="outputtype">
+          <xsl:choose>
+            <xsl:when test="output/param/@ours">
+                <xsl:choose>
+                        <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">adb_<xsl:value-of select="output/param/@type"/>_t*</xsl:when>
+                        <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
+                        <xsl:otherwise>axis2_<xsl:value-of select="output/param/@type"/>_t*</xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
+          </xsl:choose>
+        </xsl:variable>
         <xsl:if test="$mep='12'">
-        void axis2_stub_start_op_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_start( axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each select="input/param[@type!='']">,
-                                                        <xsl:variable name="inputtype">
-                                                            <xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
-                                                        </xsl:variable>
-                                                        <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
-                                                    </xsl:for-each>,
-                                                        axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axutil_env_t* ) ,
-                                                        axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axutil_env_t*, int ) );
+
+        void axis2_stub_start_op_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each select="input/param[@type!='']">,
+                                                    <xsl:variable name="inputtype"><xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
+                                                    <xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
+                                                  </xsl:for-each>,
+                                                  void *user_data,
+                                                  axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, <xsl:value-of select="$outputtype"/><xsl:text> _</xsl:text><xsl:value-of select="output/param/@name"/>, void *data) ,
+                                                  axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data) );
 
         </xsl:if>  <!--close for  test="$mep='http://www.w3.org/2004/08/wsdl/in-out'"-->
         </xsl:for-each>

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/StubSourceTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -143,14 +143,11 @@
       <xsl:choose>
         <xsl:when test="output/param/@ours">
             <xsl:choose>
-                    <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">
-                    adb_<xsl:value-of select="output/param/@type"/>_t*</xsl:when>
+                    <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">adb_<xsl:value-of select="output/param/@type"/>_t*</xsl:when>
                     <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
-                    <xsl:otherwise>
-                    axis2_<xsl:value-of select="output/param/@type"/>_t*</xsl:otherwise>
-                </xsl:choose>
-            
-                </xsl:when>
+                    <xsl:otherwise>axis2_<xsl:value-of select="output/param/@type"/>_t*</xsl:otherwise>
+            </xsl:choose>
+        </xsl:when>
         <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
@@ -168,7 +165,8 @@
          /**
           * auto generated method signature
           * for "<xsl:value-of select="@qname"/>" operation.
-          <xsl:for-each select="input/param[@type!='']">* @param _<xsl:value-of select="@name"/></xsl:for-each>
+          *<xsl:for-each select="input/param[@type!='']"><xsl:text>
+          </xsl:text>* @param _<xsl:value-of select="@name"/></xsl:for-each>
           * @return
           */
          <xsl:choose>
@@ -177,10 +175,8 @@
          </xsl:choose>
          <xsl:text> </xsl:text>
          axis2_stub_op_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each select="input/param[@type!='']">,
-                                              <xsl:variable name="inputtype">
-                                                  <xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
-                                              </xsl:variable>
-                                              <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
+                                              <xsl:variable name="inputtype"><xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
+                                              <xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
                                               </xsl:for-each>)
          {
             axis2_svc_client_t *svc_client = NULL;
@@ -201,18 +197,17 @@
 
 
             <!-- for service client currently suppported only 1 input param -->
-            <xsl:for-each select="input/param[@type!='']">
-                <xsl:if test="position()=1">
-                    <xsl:choose>
-                        <xsl:when test="@ours">
-                            payload = adb_<xsl:value-of select="@type"/>_serialize(_<xsl:value-of select="@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
-                        </xsl:when>
-                        <xsl:otherwise>
-                            payload = _<xsl:value-of select="@name"/>;
-                        </xsl:otherwise>
-                    </xsl:choose>
-                </xsl:if>
-            </xsl:for-each>
+            <xsl:variable name="firstParam" select="input/param[1]"/>
+            <xsl:if test="$firstParam/@type!=''">
+               <xsl:choose>
+                   <xsl:when test="$firstParam/@ours">
+                       payload = adb_<xsl:value-of select="$firstParam/@type"/>_serialize(_<xsl:value-of select="$firstParam/@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
+                   </xsl:when>
+                   <xsl:otherwise>
+                       payload = _<xsl:value-of select="$firstParam/@name"/>;
+                   </xsl:otherwise>
+               </xsl:choose>
+            </xsl:if>
 
             options = axis2_stub_get_options( stub, env);
             if ( NULL == options )
@@ -264,7 +259,17 @@
                     }
                     ret_val = adb_<xsl:value-of select="output/param/@type"/>_create(env);
 
-                    adb_<xsl:value-of select="output/param/@type"/>_deserialize(ret_val, env, &amp;ret_node );
+                    if(adb_<xsl:value-of select="output/param/@type"/>_deserialize(ret_val, env, &amp;ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE)
+                    {
+                        if(ret_val != NULL)
+                        {
+                            adb_<xsl:value-of select="output/param/@type"/>_free(ret_val, env);
+                        }
+
+                        AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the <xsl:value-of select="output/param/@type"/>_deserialize: "
+                                                                "This should be due to an invalid XML");
+                        return NULL;
+                    }
                     return ret_val;
                 </xsl:when>
                 <xsl:otherwise>
@@ -273,26 +278,152 @@
             </xsl:choose>
         }
         </xsl:if>  <!--close for  test="$isSync='1'-->
+       </xsl:if> <!-- close for  test="$mep='http://www.w3.org/2004/08/wsdl/in-out' -->
+
+  </xsl:for-each>
+
+
+
+  <xsl:for-each select="method">
+    <xsl:variable name="outputours"><xsl:value-of select="output/param/@ours"></xsl:value-of></xsl:variable>
+    <xsl:variable name="outputtype">
+      <xsl:choose>
+        <xsl:when test="output/param/@ours">
+            <xsl:choose>
+                    <xsl:when test="not(@type='char' or @type='bool' or @type='date_time' or @type='duration')">adb_<xsl:value-of select="output/param/@type"/>_t*</xsl:when>
+                    <xsl:when test="@type='duration' or @type='date_time' or @type='uri' or @type='qname' or @type='base64_binary'">axutil_<xsl:value-of select="@type"/>_t*</xsl:when>
+                    <xsl:otherwise>axis2_<xsl:value-of select="output/param/@type"/>_t*</xsl:otherwise>
+                </xsl:choose>
+            
+                </xsl:when>
+        <xsl:otherwise><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    <xsl:variable name="caps-outputtype"><xsl:value-of select="output/param/@caps-type"></xsl:value-of></xsl:variable>
+    <xsl:variable name="style"><xsl:value-of select="@style"></xsl:value-of></xsl:variable>
+    <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
+    <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
+
+    <xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
+    <xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
+
+
+     <xsl:if test="$mep='12'">
         <!-- Async method generation -->
         <xsl:if test="$isAsync='1'">
+
+        struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data
+        {   
+            void *data;
+            axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, <xsl:value-of select="$outputtype"/><xsl:text> _</xsl:text><xsl:value-of select="output/param/@name"/>, void *data);
+            axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data);
+        };
+
+        static axis2_status_t AXIS2_CALL axis2_stub_on_error_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>(axis2_callback_t *callback, const axutil_env_t *env, int exception)
+        {
+            axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int, void *data);
+            struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data* callback_data = NULL;
+            void *user_data = NULL;
+
+            axis2_status_t status;
+        
+            callback_data = (struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data*)axis2_callback_get_data(callback);
+        
+            user_data = callback_data->data;
+            on_error = callback_data->on_error;
+        
+            status = on_error(env, exception, user_data);
+
+            if(callback_data)
+            {
+                AXIS2_FREE(env->allocator, callback_data);
+            }
+            return status;
+        } 
+
+        axis2_status_t AXIS2_CALL axis2_stub_on_complete_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>(axis2_callback_t *callback, const axutil_env_t *env)
+        {
+            axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, <xsl:value-of select="$outputtype"/><xsl:text> _</xsl:text><xsl:value-of select="output/param/@name"/>, void *data);
+            struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data* callback_data = NULL;
+            void *user_data = NULL;
+            axis2_status_t status;
+ 
+            <xsl:if test="output/param/@ours">
+           	    <!-- this means data binding is enable -->
+                <xsl:value-of select="$outputtype"/> ret_val = NULL;
+            </xsl:if>
+
+            axiom_node_t *ret_node = NULL;
+            axiom_soap_envelope_t *soap_envelope = NULL;
+
+            callback_data = (struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data*)axis2_callback_get_data(callback);
+
+            soap_envelope = axis2_callback_get_envelope(callback, env);
+            if(soap_envelope)
+            {
+                axiom_soap_body_t *soap_body;
+                soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+                if(soap_body)
+                {
+                    axiom_node_t *body_node = axiom_soap_body_get_base_node(soap_body, env);
+                    if(body_node)
+                    {
+                        ret_node = axiom_node_get_first_child(body_node, env);
+                    }
+                }
+            }
+
+            user_data = callback_data->data;
+            on_complete = callback_data->on_complete;
+
+            <xsl:choose>
+                <xsl:when test="output/param/@ours">
+                    if(ret_node != NULL)
+                    {
+                        ret_val = adb_<xsl:value-of select="output/param/@type"/>_create(env);
+     
+                        if(adb_<xsl:value-of select="output/param/@type"/>_deserialize(ret_val, env, &amp;ret_node, NULL, AXIS2_FALSE ) == AXIS2_FAILURE)
+                        {
+                            AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the LendResponse_deserialize: "
+                                                                    "This should be due to an invalid XML");
+                            adb_<xsl:value-of select="output/param/@type"/>_free(ret_val, env);
+                            ret_val = NULL;
+                        }
+                     }
+                     else
+                     {
+                         ret_val = NULL; 
+                     }
+                     status = on_complete(env, ret_val, user_data);
+                </xsl:when>
+                <xsl:otherwise>
+                     status = on_complete(env, ret_node, user_data);
+                </xsl:otherwise>
+            </xsl:choose>
+ 
+            if(callback_data)
+            {
+                AXIS2_FREE(env->allocator, callback_data);
+            }
+            return status;
+        }
+
         /**
           * auto generated method signature for asynchronous invocations
           * for "<xsl:value-of select="@qname"/>" operation.
           <!--  select only the body parameters  -->
-          <xsl:for-each select="input/param[@type!='']">* @param _<xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+          *<xsl:for-each select="input/param[@type!='']"><xsl:text>
+          </xsl:text>* @param _<xsl:value-of select="@name"/></xsl:for-each>
           * @param on_complete callback to handle on complete
           * @param on_error callback to handle on error
           */
-         <xsl:variable name="callbackoncomplete"><xsl:value-of select="$callbackname"></xsl:value-of><xsl:text>_on_complete</xsl:text></xsl:variable>
-         <xsl:variable name="callbackonerror"><xsl:value-of select="$callbackname"></xsl:value-of><xsl:text>_on_error</xsl:text></xsl:variable>
          void axis2_stub_start_op_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axutil_env_t *env<xsl:for-each select="input/param[@type!='']">,
-                                                    <xsl:variable name="inputtype">
-                                                        <xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
-                                                    </xsl:variable>
-                                                    <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
+                                                    <xsl:variable name="inputtype"><xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
+                                                    <xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
                                                   </xsl:for-each>,
-                                                  axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axutil_env_t *) ,
-                                                  axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axutil_env_t *, int ) )
+                                                  void *user_data,
+                                                  axis2_status_t ( AXIS2_CALL *on_complete ) (const axutil_env_t *, <xsl:value-of select="$outputtype"/><xsl:text> _</xsl:text><xsl:value-of select="output/param/@name"/>, void *data) ,
+                                                  axis2_status_t ( AXIS2_CALL *on_error ) (const axutil_env_t *, int exception, void *data) )
          {
 
             axis2_callback_t *callback = NULL;
@@ -307,20 +438,29 @@
             <xsl:if test="$style='doc'">
             axutil_string_t *soap_act = NULL;
             </xsl:if>
+            
+            struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data *callback_data;
 
+            callback_data = (struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data*) AXIS2_MALLOC(env->allocator, 
+                                    sizeof(struct axis2_stub_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>_callback_data));
+            if(NULL == callback_data)
+            {
+                AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "Can not allocate memeory for the callback data structures");
+                return;
+            }
             <!-- for service client currently suppported only 1 input param -->
-            <xsl:for-each select="input/param[@type!='']">
-                <xsl:if test="position()=1">
-                    <xsl:choose>
-                        <xsl:when test="@ours">
-                            payload = adb_<xsl:value-of select="@type"/>_serialize(_<xsl:value-of select="@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
-                        </xsl:when>
-                        <xsl:otherwise>
-                            payload = _<xsl:value-of select="@name"/>;
-                        </xsl:otherwise>
-                    </xsl:choose>
-                </xsl:if>
-            </xsl:for-each>
+            <xsl:variable name="firstParam" select="input/param[1]"/>
+            <xsl:if test="$firstParam/@type!=''">
+               <xsl:choose>
+                   <xsl:when test="$firstParam/@ours">
+                       payload = adb_<xsl:value-of select="$firstParam/@type"/>_serialize(_<xsl:value-of select="$firstParam/@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
+                   </xsl:when>
+                   <xsl:otherwise>
+                       payload = _<xsl:value-of select="$firstParam/@name"/>;
+                   </xsl:otherwise>
+               </xsl:choose>
+            </xsl:if>
+
 
 
             options = axis2_stub_get_options( stub, env);
@@ -353,9 +493,15 @@
 
             callback = axis2_callback_create(env);
             /* Set our on_complete fucntion pointer to the callback object */
-            axis2_callback_set_on_complete(callback, on_complete);
+            axis2_callback_set_on_complete(callback, axis2_stub_on_complete_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>);
             /* Set our on_error function pointer to the callback object */
-            axis2_callback_set_on_error(callback, on_error);
+            axis2_callback_set_on_error(callback, axis2_stub_on_error_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>);
+
+            callback_data-> data = user_data;
+            callback_data-> on_complete = on_complete;
+            callback_data-> on_error = on_error;
+
+            axis2_callback_set_data(callback, (void*)callback_data);
 
             /* Send request */
             axis2_svc_client_send_receive_non_blocking(svc_client, env, payload, callback);
@@ -384,10 +530,8 @@
           */
          axis2_status_t
          axis2_stub_op_<xsl:value-of select="$servicename"/>_<xsl:value-of select="@name"/>( axis2_stub_t *stub, const axutil_env_t *env <xsl:for-each select="input/param[@type!='']"> ,
-                                                 <xsl:variable name="inputtype">
-                                                    <xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if>
-                                                 </xsl:variable>
-                                                 <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
+                                                 <xsl:variable name="inputtype"><xsl:if test="@ours">adb_</xsl:if><xsl:value-of select="@type"/><xsl:if test="@ours">_t*</xsl:if></xsl:variable>
+                                                 <xsl:value-of select="$inputtype"/><xsl:text> _</xsl:text><xsl:value-of select="@name"/>
                                               </xsl:for-each>)
          {
             axis2_status_t status;
@@ -400,19 +544,17 @@
             axiom_node_t *payload = NULL;
 
             <!-- for service client currently suppported only 1 input param -->
-            <xsl:for-each select="input/param[@type!='']">
-                <xsl:if test="position()=1">
-                    <xsl:choose>
-                        <xsl:when test="@ours">
-                            payload = adb_<xsl:value-of select="@type"/>_serialize(_<xsl:value-of select="@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
-                        </xsl:when>
-                        <xsl:otherwise>
-                            payload = _<xsl:value-of select="@name"/>;
-                        </xsl:otherwise>
-                    </xsl:choose>
-                </xsl:if>
-            </xsl:for-each>
-
+            <xsl:variable name="firstParam" select="input/param[1]"/>
+            <xsl:if test="$firstParam/@type!=''">
+               <xsl:choose>
+                   <xsl:when test="$firstParam/@ours">
+                       payload = adb_<xsl:value-of select="$firstParam/@type"/>_serialize(_<xsl:value-of select="$firstParam/@name"/>, env, NULL, NULL, AXIS2_TRUE, NULL, NULL);
+                   </xsl:when>
+                   <xsl:otherwise>
+                       payload = _<xsl:value-of select="$firstParam/@name"/>;
+                   </xsl:otherwise>
+               </xsl:choose>
+            </xsl:if>
 
             options = axis2_stub_get_options( stub, env);
             if ( NULL == options )

Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -69,6 +69,7 @@
             <xsl:variable name="outParamComplexType" select="output/param[@location='body']/@complextype"></xsl:variable>
             <xsl:variable name="outParamCount" select="count(output/param[@location='body']/param)"></xsl:variable>
             <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
+            <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
             <xsl:choose>
                 <!-- Code generation for in-out only. Need to consider the other meps also
                     They should be parts of this xsl:choose loop -->
@@ -84,6 +85,8 @@
                         </xsl:when>
                         <xsl:when test="string-length(normalize-space($outParamComplexType)) > 0">
                             <xsl:value-of select="$outParamComplexType"/><xsl:text> </xsl:text>result
+                        </xsl:when>
+                        <xsl:when test="($outParamCount=0) and ($isUnwrapParameters)">
                         </xsl:when>
                         <xsl:when test="string-length(normalize-space($outParamType)) > 0">
                             <xsl:value-of select="$outParamType"/><xsl:text> </xsl:text>result



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