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 ch...@apache.org on 2005/10/06 05:26:09 UTC

svn commit: r306512 - in /webservices/axis2/trunk/java: etc/ modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/ modules/codegen/test-resources/XMLBeanSchemaUtilityRepo/services/ modules/codegen/test/org/apache/axis2/databinding/ modu...

Author: chinthaka
Date: Wed Oct  5 20:25:25 2005
New Revision: 306512

URL: http://svn.apache.org/viewcvs?rev=306512&view=rev
Log:
- now one can invoke with empty payload using the call api. Fixing stuff for that.
- adding not yet completed code, test case and temp test resources for schema generation from XMLBeans ?WSDL stuff
- making the email addresses in the project.xml spam proof.

Modified:
    webservices/axis2/trunk/java/etc/project.xml
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java
    webservices/axis2/trunk/java/modules/codegen/test-resources/XMLBeanSchemaUtilityRepo/services/databindingService.jar
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/XMLBeansSchemaUtilityTest.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java

Modified: webservices/axis2/trunk/java/etc/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/etc/project.xml?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
--- webservices/axis2/trunk/java/etc/project.xml (original)
+++ webservices/axis2/trunk/java/etc/project.xml Wed Oct  5 20:25:25 2005
@@ -58,65 +58,65 @@
         <developer>
             <name>Davanum Srinivas</name>
             <id>dims</id>
-            <email>dims@apache.org</email>
+            <email>dims AT apache.org</email>
             <organization>WSO2</organization>
         </developer>
         <developer>
             <name>Sanjiva Weerawarana</name>
             <id>sanjiva</id>
-            <email>sanjiva@apache.org</email>
+            <email>sanjiva AT apache.org</email>
             <organization>Lanka Software Foundation</organization>
         </developer>
         <developer>
             <name>Glen Daniels</name>
             <id>gdaniels</id>
-            <email>gdaniels@apache.org</email>
+            <email>gdaniels AT apache.org</email>
             <organization>Sonic Software</organization>
         </developer>
         <developer>
             <name>Aleksander Slominski</name>
             <id>alek</id>
-            <email>aslom@cs.indiana.edu</email>
+            <email>aslom AT cs.indiana.edu</email>
             <organization>Indiana University Extreme! Computing Lab</organization>
         </developer>
         <developer>
             <name>Srinath Perera</name>
             <id>hemapani</id>
-            <email>hemapani@apache.org</email>
+            <email>hemapani AT apache.org</email>
             <organization>Lanka Software Foundation</organization>
             <url>http://www.apache.org/~hemapani</url>
         </developer>
         <developer>
             <name>Eran Chinthaka</name>
             <id>chinthaka</id>
-            <email>chinthaka@apache.org</email>
+            <email>chinthaka AT apache.org</email>
             <organization>Lanka Software Foundation</organization>
             <url>http://www.apache.org/~chinthaka</url>
         </developer>
         <developer>
             <name>Dasarath Weerathunga</name>
             <id>dasarath</id>
-            <email>dasarath@opensource.lk</email>
+            <email>dasarath AT opensource.lk</email>
             <organization>Lanka Software Foundation</organization>
         </developer>
         <developer>
             <name>Jaliya Ekanayake</name>
             <id>jaliya</id>
-            <email>jaliya@opensource.lk</email>
+            <email>jaliya AT opensource.lk</email>
             <organization>Virtusa / Lanka Software Foundation</organization>
             <url>http://www.apache.org/~jaliya</url>
         </developer>
         <developer>
             <name>Chathura Herath</name>
             <id>chathura</id>
-            <email>chathura@opensource.lk</email>
+            <email>chathura AT opensource.lk</email>
             <organization>LSF/MIT</organization>
             <url>www.apache.org/~chathura</url>
         </developer>
         <developer>
             <name>Deepal Jayasinghe</name>
             <id>deepal</id>
-            <email>deepal@apache.org</email>
+            <email>deepal AT apache.org</email>
             <organization>Lanka Software Foundation</organization>
             <url>http://www.apache.org/~deepal</url>
 
@@ -124,7 +124,7 @@
         <developer>
             <name>Ajith Ranabahu</name>
             <id>ajith</id>
-            <email>ajith@apache.org</email>
+            <email>ajith AT apache.org</email>
             <organization>Lanka Software Foundation</organization>
             <url>http://www.apache.org/~ajith</url>
 
@@ -132,37 +132,37 @@
         <developer>
             <name>Venkat Reddy</name>
             <id>venkat</id>
-            <email>vreddyp@gmail.com</email>
+            <email>vreddyp AT gmail.com</email>
             <organization>Computer Associates</organization>
         </developer>
         <developer>
             <name>Ashutosh Shahi</name>
             <id>ashu</id>
-            <email>Ashutosh.Shahi@ca.com</email>
+            <email>Ashutosh.Shahi AT ca.com</email>
             <organization>Computer Associates</organization>
         </developer>
         <developer>
             <name>Jayachandra Sekhara Rao Sunkara</name>
             <id>jaya</id>
-            <email>jayachandra@gmail.com</email>
+            <email>jayachandra AT gmail.com</email>
             <organization>Computer Associates</organization>
         </developer>
         <developer>
             <name>Thilina Gunarathne</name>
             <id>thilina</id>
-            <email>thilina@opensource.lk</email>
+            <email>thilina AT opensource.lk</email>
             <organization>Lanka Software Foundation</organization>
         </developer>
         <developer>
             <name>Ruchith Fernando</name>
             <id>ruchith</id>
-            <email>ruchithf@apache.lk</email>
+            <email>ruchithf AT apache.lk</email>
             <organization>Lanka Software Foundation</organization>
         </developer>
         <developer>
             <name>Saminda Abeyruwan</name>
             <id>saminda</id>
-            <email>saminda@opensource.lk</email>
+            <email>saminda AT opensource.lk</email>
             <organization>Lanka Software Foundation</organization>
         </developer>
 
@@ -171,32 +171,32 @@
     <contributors>
         <contributor>
             <name>Farhaan Mohideen</name>
-            <email>fmohideen@valista.com</email>
+            <email>fmohideen AT valista.com</email>
             <organization>Lanka Software Foundation</organization>
         </contributor>
         <contributor>
             <name>Changshin Lee</name>
-            <email>iasandcb@hotmail.com</email>
+            <email>iasandcb AT hotmail.com</email>
             <organization>Tmax Soft, Korea</organization>
         </contributor>
         <contributor>
             <name>Chamil Thanthrimudalige</name>
-            <email>chamil@opensource.lk</email>
+            <email>chamil AT opensource.lk</email>
             <organization>Lanka Software Foundation</organization>
         </contributor>
         <contributor>
             <name>Nadana Gunarathna</name>
-            <email>nadana@opensource.lk</email>
+            <email>nadana AT opensource.lk</email>
             <organization>Lanka Software Foundation</organization>
         </contributor>
         <contributor>
             <name>Gayan Asanka</name>
-            <email>gayan@opensource.lk</email>
+            <email>gayan AT opensource.lk</email>
             <organization>Lanka Software Foundation</organization>
         </contributor>
         <contributor>
             <name>Anushka Kumara</name>
-            <email>anushkakumar@gmail.com</email>
+            <email>anushkakumar AT gmail.com</email>
             <organization>Lanka Software Foundation</organization>
         </contributor>
         <contributor>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/extensions/XMLBeans/XMLBeansSchemaUtility.java Wed Oct  5 20:25:25 2005
@@ -8,7 +8,14 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.xmlbeans.XmlObject;
 
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Iterator;
 
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -34,8 +41,9 @@
     public boolean isRelevant(ServiceDescription serviceDescription) throws AxisFault {
         try {
             ClassLoader classLoader = serviceDescription.getClassLoader();
-            String serviceName = serviceDescription.getName().getLocalPart();
-            Class serviceImplementation = classLoader.loadClass(serviceName);
+            String serviceClassName = (String) serviceDescription.getParameter("ServiceClass").getValue();
+
+            Class serviceImplementation = classLoader.loadClass(serviceClassName);
 
             // get each and every method
             Method[] methods = serviceImplementation.getMethods();
@@ -47,7 +55,7 @@
                 for (int j = 0; j < methodParameterTypes.length; j++) {
                     Class parameter = methodParameterTypes[j];
 
-                    if (isExtendsFromXMLObject(parameter)) {
+                    if (isExtendsFromGivenBaseClass(parameter, XmlObject.class)) {
                         return true;
                     }
                 }
@@ -60,18 +68,144 @@
     }
 
     public OMElement getSchema(ServiceDescription serviceDescription) throws AxisFault {
-      return null;
+        if (!isRelevant(serviceDescription)) {
+            return null;
+        }
+
+        ArrayList mainClassListForSchemaGeneration = new ArrayList();
+
+        try {
+            ClassLoader classLoader = serviceDescription.getClassLoader();
+            String serviceClassName = (String) serviceDescription.getParameter("ServiceClass").getValue();
+
+            Class serviceImplementation = classLoader.loadClass(serviceClassName);
+
+            // get each and every method
+            Method[] methods = serviceImplementation.getMethods();
+            for (int i = 0; i < methods.length; i++) {
+                Method serviceImplClassMethods = methods[i];
+
+                // get the parameters for the serviceImplClassMethods
+                Class[] methodParameterTypes = serviceImplClassMethods.getParameterTypes();
+                for (int j = 0; j < methodParameterTypes.length; j++) {
+                    Class parameter = methodParameterTypes[j];
+                    if (isExtendsFromGivenBaseClass(parameter, XmlObject.class)) {
+                        Class aClass = classLoader.loadClass(parameter.getName() + "$Factory");
+                        Method newInstanceMethod = aClass.getMethod("newInstance", null);
+                        System.out.println(newInstanceMethod.invoke(parameter, null).getClass());
+                        XmlObject xmlObject = (XmlObject) newInstanceMethod.invoke(parameter, null);
+                        if (xmlObject.schemaType().isDocumentType()) {
+                            mainClassListForSchemaGeneration.add(xmlObject);
+                        }
+                    }
+                }
+            }
+
+            // now we have all the document type obejcts in the ArrayList. Now generate the schema
+            // from that
+            Iterator documentTypeElementIter = mainClassListForSchemaGeneration.iterator();
+            while (documentTypeElementIter.hasNext()) {
+                XmlObject xmlObject = (XmlObject) documentTypeElementIter.next();
+//                String sourceName = xmlObject.schemaType().getSourceName();
+//                XmlCursor xCur = xmlObject.newCursor();
+//
+//                if (xCur.toFirstContentToken() == XmlCursor.TokenType.START) {
+//                do {
+//                    Node n = xCur.getDomNode();
+//                    System.out.println("n = " + n);
+//                    if (n.getNodeType() == Node.ELEMENT_NODE) {
+//                        System.out.println(((Element) n));
+//                    }
+//                } while (xCur.toNextSibling());
+
+//            }
+
+                File file = new File("test/test2");
+                if(!file.exists()){
+                    file.delete();
+                    file.createNewFile();
+                }
+
+                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+                xmlObject.save(byteArrayOutputStream);
+                String str = new String(byteArrayOutputStream.toByteArray());
+                System.out.println("str = " + str);
+//                xmlObject.schemaType().getTypeSystem().
+//                SchemaType[] schemaTypes = xmlObject.schemaType().getTypeSystem().documentTypes();
+//                for (int i = 0; i < schemaTypes.length; i++) {
+//                    SchemaType schemaType = schemaTypes[i];
+//                    schemaType.
+//
+//                }
+//                InputStream is = classLoader.getResourceAsStream("schemaorg_apache_xmlbeans/src/" + sourceName);
+//                String str = new String(getBytesFromFile(is));
+//                System.out.println("str = " + str);
+
+            }
+
+        } catch (ClassNotFoundException e) {
+            log.error("Can not load the service " + serviceDescription + " from the given class loader");
+            throw new AxisFault(e);
+        } catch (NoSuchMethodException e) {
+            throw new AxisFault(e);
+        } catch (IllegalAccessException e) {
+            throw new AxisFault(e);
+        } catch (InvocationTargetException e) {
+            throw new AxisFault(e);
+        } catch (IOException e) {
+            throw new AxisFault(e);
+
+        }
+        return null;
+    }
+
+    public static byte[] getBytesFromFile(InputStream is) throws IOException {
+
+        // Get the size of the file
+
+        // You cannot create an array using a long type.
+        // It needs to be an int type.
+        // Before converting to an int type, check
+        // to ensure that file is not larger than Integer.MAX_VALUE.
+//        if (length > Integer.MAX_VALUE) {
+//            // File is too large
+//        }
+
+        // Create the byte array to hold the data
+        byte[] bytes = new byte[55555];
+
+        // Read in the bytes
+        int offset = 0;
+        int numRead = 0;
+        while (offset < bytes.length
+                && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
+            offset += numRead;
+        }
+
+        // Ensure all the bytes have been read in
+        if (offset < bytes.length) {
+            throw new IOException("Could not completely read the input stream ");
+        }
+
+        // Close the input stream and return bytes
+        is.close();
+        return bytes;
     }
 
-    private boolean isExtendsFromXMLObject(Class checkingClass) {
-        if (checkingClass == XmlObject.class) {
+    private boolean isExtendsFromGivenBaseClass(Class classNeededToBeChecked, Class baseClass) {
+        if (classNeededToBeChecked == baseClass) {
             return true;
         } else {
-            if (checkingClass.getSuperclass() != null) {
-                return isExtendsFromXMLObject(checkingClass.getSuperclass());
-            } else {
-                return false;
+            Class[] interfaces = classNeededToBeChecked.getInterfaces();
+            for (int i = 0; i < interfaces.length; i++) {
+                if (interfaces[i] == baseClass) {
+                    return true;
+                }
+
             }
+            return false;
+
+
         }
 
 

Modified: webservices/axis2/trunk/java/modules/codegen/test-resources/XMLBeanSchemaUtilityRepo/services/databindingService.jar
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test-resources/XMLBeanSchemaUtilityRepo/services/databindingService.jar?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
Binary files - no diff available.

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/XMLBeansSchemaUtilityTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/XMLBeansSchemaUtilityTest.java?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/XMLBeansSchemaUtilityTest.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/databinding/XMLBeansSchemaUtilityTest.java Wed Oct  5 20:25:25 2005
@@ -1,12 +1,14 @@
 package org.apache.axis2.databinding;
 
 import junit.framework.TestCase;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.databinding.extensions.XMLBeans.XMLBeansSchemaUtility;
 import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.description.ServiceGroupDescription;
 import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /*
  * Copyright 2001-2004 The Apache Software Foundation.
@@ -29,14 +31,36 @@
 public class XMLBeansSchemaUtilityTest extends TestCase {
 
     AxisConfiguration ar;
-    String repo ="./test-resources/XMLBeanSchemaUtilityRepo";
+    String repo = "./test-resources/XMLBeanSchemaUtilityRepo";
+    protected Log log = LogFactory.getLog(getClass());
+
 
-    public ServiceDescription getDummyServiceDescription() throws AxisFault {
+    private ServiceDescription getDummyServiceDescription() throws AxisFault {
         ConfigurationContextFactory builder = new ConfigurationContextFactory();
         ar = builder.buildConfigurationContext(repo).getAxisConfiguration();
-        ServiceDescription service = ar.getService("databindingService");
-        assertNotNull(service);
-        return null;
+        return ar.getService("databindingService");
     }
+
+    public void testIsRelevant(){
+        try {
+            XMLBeansSchemaUtility xmlBeansSchemaUtility = new XMLBeansSchemaUtility();
+            assertTrue(xmlBeansSchemaUtility.isRelevant(getDummyServiceDescription()));
+        } catch (AxisFault axisFault) {
+            log.error("Error in testIsRelevant ", axisFault);
+            fail("Error");
+        }
+    }
+
+    public void testGetSchema(){
+        try {
+            XMLBeansSchemaUtility xmlBeansSchemaUtility = new XMLBeansSchemaUtility();
+            ServiceDescription dummyServiceDescription = getDummyServiceDescription();
+            OMElement schema = xmlBeansSchemaUtility.getSchema(dummyServiceDescription);
+        } catch (AxisFault axisFault) {
+            log.error("Error in testIsRelevant ", axisFault);
+            fail("Error");
+        }
+    }
+
 
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/Call.java Wed Oct  5 20:25:25 2005
@@ -22,10 +22,10 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.deployment.util.PhasesInfo;
-import org.apache.axis2.description.ServiceDescription;
-import org.apache.axis2.description.OperationDescriptionFactory;
 import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.OperationDescriptionFactory;
 import org.apache.axis2.description.OutInOperationDescription;
+import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.engine.AxisConfigurationImpl;
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.soap.SOAPEnvelope;
@@ -108,6 +108,9 @@
         opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop, WSDLConstants.MEP_CONSTANT_IN_OUT);
 
         MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
+        if(envelope == null || envelope.getBody() == null){
+            throw new AxisFault("SOAP envelope or SOAP Body can not be null");
+        }
         msgctx.setEnvelope(envelope);
 
         this.lastResponseMessage = super.invokeBlocking(opDesc, msgctx);
@@ -140,7 +143,7 @@
      * Invoke the nonblocking/Asynchronous call
      *
      * @param axisop
-     * @param envelope   -  This should be a SOAP Envelope 
+     * @param envelope   -  This should be a SOAP Envelope
      *                 invocation behaves accordingly
      * @param callback
      * @throws org.apache.axis2.AxisFault
@@ -156,6 +159,9 @@
         opDesc = createOpDescAndFillInFlowInformation(opDesc,axisop,WSDLConstants.MEP_CONSTANT_IN_OUT);
 
         MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
+        if(envelope == null || envelope.getBody() == null){
+            throw new AxisFault("SOAP envelope or SOAP Body can not be null");
+        }
         msgctx.setEnvelope(envelope);
         //call the underline implementation
         super.invokeNonBlocking(opDesc, msgctx, callback);
@@ -170,7 +176,7 @@
             OperationDescription opDesc,
             String axisOp , int mepURL) throws AxisFault {
         if (opDesc == null) {
-            //if the operation is not alrady define we will copy the 
+            //if the operation is not alrady define we will copy the
             //crated Phases from the templete operation to the this Operation
 
 //            opDesc = new OperationDescription(new QName(axisOp));
@@ -198,7 +204,7 @@
             throws AxisFault {
         ConfigurationContext sysContext = null;
         //we are trying to keep one configuration Context at the Client side. That make it easier to
-        //manage the TransportListeners. But using the static referance is bit crude!. 
+        //manage the TransportListeners. But using the static referance is bit crude!.
         if (ListenerManager.configurationContext == null) {
             ConfigurationContextFactory efac =
                     new ConfigurationContextFactory();

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/MEPClient.java Wed Oct  5 20:25:25 2005
@@ -76,17 +76,17 @@
      * MEPClient copied to the MessageContext
      */
     protected void prepareInvocation(OperationDescription axisop, MessageContext msgCtx)
-        throws AxisFault {
+            throws AxisFault {
         if (axisop == null) {
             throw new AxisFault(Messages.getMessage("cannotBeNullOperationDescription"));
         }
         //make sure operation is type right MEP
         if (mep.equals(axisop.getMessageExchangePattern())) {
             throw new AxisFault(
-                Messages.getMessage(
-                    "mepClientSupportOnly",
-                    mep,
-                    axisop.getMessageExchangePattern()));
+                    Messages.getMessage(
+                            "mepClientSupportOnly",
+                            mep,
+                            axisop.getMessageExchangePattern()));
         }
         //if operation not alrady added, add it
         if (serviceContext.getServiceConfig().getOperation(axisop.getName()) == null) {
@@ -102,6 +102,7 @@
 
     /**
      * This class prepare the SOAP Envelope using the payload
+     *
      * @param toSend
      * @return
      * @throws AxisFault
@@ -110,15 +111,18 @@
         MessageContext msgctx = new MessageContext(serviceContext.getEngineContext());
 
         SOAPEnvelope envelope = createDefaultSOAPEnvelope();
-        envelope.getBody().addChild(toSend);
+        if (toSend != null) {
+            envelope.getBody().addChild(toSend);
+        }
         msgctx.setEnvelope(envelope);
         return msgctx;
     }
 
     /**
-     * try to infer the transport looking at the URL, the URL can be http:// 
-     * tcp:// mail:// local://. The method will look for the trnasport name as the 
+     * try to infer the transport looking at the URL, the URL can be http://
+     * tcp:// mail:// local://. The method will look for the trnasport name as the
      * protocol part of the transport.
+     *
      * @param epr
      * @return
      * @throws AxisFault
@@ -135,15 +139,17 @@
 
         if (transport != null) {
             return serviceContext.getEngineContext().getAxisConfiguration().getTransportOut(
-                new QName(transport));
+                    new QName(transport));
 
         } else {
             throw new AxisFault(Messages.getMessage("cannotInferTransport"));
         }
 
     }
+
     /**
      * create write SOAPEvelope(in terms of version) based on the values set.
+     *
      * @return
      * @throws AxisFault
      */
@@ -160,9 +166,10 @@
     }
 
     /**
-     * Engage a given Module to the current invocation. But to call this method the 
+     * Engage a given Module to the current invocation. But to call this method the
      * Module *MUST* be enable (picked up by the deployment and known to Axis2) else
      * Exception will be thrown. To be detected put the moduels to the AXIS2_REPOSITORY/modules directory
+     *
      * @param name
      * @throws AxisFault
      */
@@ -196,12 +203,11 @@
     }
 
     /**
-     *
      * @param exceptionToBeThrownOnSOAPFault - If there is a SOAP Fault in the body of the incoming
-     * SOAP Message, system can be configured to throw an exception with the details extracted from
-     * the information from the fault message.
-     * This boolean variable will enable that facility. If this is false, the response message will just
-     * be returned to the application, irrespective of whether it has a Fault or not.
+     *                                       SOAP Message, system can be configured to throw an exception with the details extracted from
+     *                                       the information from the fault message.
+     *                                       This boolean variable will enable that facility. If this is false, the response message will just
+     *                                       be returned to the application, irrespective of whether it has a Fault or not.
      */
     public void setExceptionToBeThrownOnSOAPFault(boolean exceptionToBeThrownOnSOAPFault) {
         isExceptionToBeThrownOnSOAPFault = exceptionToBeThrownOnSOAPFault;

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java?rev=306512&r1=306511&r2=306512&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/SOAPMessageBodyBasedDispatcher.java Wed Oct  5 20:25:25 2005
@@ -50,10 +50,11 @@
             throws AxisFault {
         OMElement bodyFirstChild = messageContext.getEnvelope().getBody()
                 .getFirstElement();
-        if(bodyFirstChild !=null)
+        if(bodyFirstChild == null){
+            return null;
+        }else{
               operationName = new QName(bodyFirstChild.getLocalName());
-        else
-           throw  new AxisFault("Empty Body SOAPEnevelop");
+        }
 
         return service.getOperation(operationName);
     }