You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/12/21 13:17:56 UTC

svn commit: r358274 - in /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2: schema/writer/ wsdl/ wsdl/codegen/ wsdl/codegen/emitter/ wsdl/codegen/extension/ wsdl/codegen/writer/ wsdl/template/java/

Author: ajith
Date: Wed Dec 21 04:17:31 2005
New Revision: 358274

URL: http://svn.apache.org/viewcvs?rev=358274&view=rev
Log:
1. Updated the codegenerator not to generate seperate classes for databind supporters
   Now the fromOM and toOm methods are generated inside the stub (or the MessageReceiver). The templates  for databind supporters are included inside the main template itself until I figure out the API to pump the template from outside.
2. Added the -w (wrap classes) option to the commandline option list
3. Fixed several bugs in the JavaBeanWriter.java
4. removed some unused writers and templates (updated that in the property file as well)

The generated test classes need to be amended! However the build is fine even with the generated code in security module

Removed:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/BeanWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/DatabindingSupportClassWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/LocalTestClassWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/TestServiceXMLWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/TestSkeletonImplWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/BeanTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/JAXBSupporterTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/LocalTestClassTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestSkeletonImplTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/XMLBeansSupporterTemplate.xsl
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Wed Dec 21 04:17:31 2005
@@ -79,7 +79,12 @@
                 Element rootElement = XSLTUtils.getElement(globalWrappedDocument,"beans");
                 globalWrappedDocument.appendChild(rootElement);
                 XSLTUtils.addAttribute(globalWrappedDocument,"name",WRAPPED_DATABINDING_CLASS_NAME,rootElement);
-                XSLTUtils.addAttribute(globalWrappedDocument,"package",packageName,rootElement);
+                String tempPackageName = null;
+                if (packageName.endsWith(".")){
+                     tempPackageName = this.packageName.substring(0, this.packageName.lastIndexOf("."));
+                }
+
+                XSLTUtils.addAttribute(globalWrappedDocument,"package",tempPackageName,rootElement);
             }
         } catch (IOException e) {
             throw new SchemaCompilationException(e);
@@ -206,12 +211,14 @@
             loadTemplate();
         }
 
+        //if wrapped then do not write the classes now but add the models to a global document. However in order to write the
+        //global class that is generated, one needs to call the writeBatch() method
         if (wrapClasses){
             globalWrappedDocument.getDocumentElement().appendChild(
                     getBeanElement(globalWrappedDocument, className, originalName, packageName, qName, isElement, metainf, propertyNames, typeMap)
             );
             //now the fully qualified class name needs to have the name of the including class as well
-            fullyqualifiedClassName = packageName + "."+ WRAPPED_DATABINDING_CLASS_NAME +"." + className;
+            fullyqualifiedClassName = (this.packageName==null?"":this.packageName)+ WRAPPED_DATABINDING_CLASS_NAME +"." + className;
         }else{
             //create the model
             Document model= XSLTUtils.getDocument();

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Wed Dec 21 04:17:31 2005
@@ -48,7 +48,7 @@
         System.out.println(
                 "-sd : Generate service descriptor (i.e. axis2.xml). Default is off.Valid with -ss ");
         System.out.println(
-                "-d <databinding> : valid databinding(s) are adb and xmlbeans. Default is xmlbeans");
+                "-d <databinding> : valid databinding(s) are adb and xmlbeans. Default is adb");
         System.exit(0);
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Wed Dec 21 04:17:31 2005
@@ -29,7 +29,7 @@
     private WSDLDescription wom;
     private CommandLineOptionParser parser;
     private File outputLocation;
-    
+
     //get the defaults for these from the property file
     private String outputLanguage = ConfigPropertyFileLoader.getDefaultLanguage();
     private String databindingType = ConfigPropertyFileLoader.getDefaultDBFrameworkName();
@@ -45,16 +45,30 @@
     private String packageName = XSLTConstants.DEFAULT_PACKAGE_NAME;
     private boolean wrapClasses = false;
 
+    private boolean generateAll = false;
+
+
+
     /**
      * A hashmap to hang the property objects
      */
     private Map policyMap = new HashMap();
 
- /*
- * A hashmap of properties that may be populated on the way. extensions can populate it
- * This can be used to keep non specific information
- */
+    /*
+    * A hashmap of properties that may be populated on the way. extensions can populate it
+    * This can be used to keep non specific information
+    */
     private Map configurationProperties = new HashMap();
+
+
+    public boolean isGenerateAll() {
+        return generateAll;
+    }
+
+    public void setGenerateAll(boolean generateAll) {
+        this.generateAll = generateAll;
+    }
+
     /**
      * get the wrap classes flag
      * @return
@@ -111,7 +125,7 @@
      * @return
      */
     public Object get(Object key){
-       return configurationProperties.get(key);
+        return configurationProperties.get(key);
     }
 
     /**
@@ -201,9 +215,9 @@
         //check and create the directories
         if (this.outputLocation.exists()){
             if (this.outputLocation.isFile()){
-               throw  new RuntimeException("The specified output location is not a directory!"); 
+                throw  new RuntimeException("The specified output location is not a directory!");
             }
-         }else{
+        }else{
             this.outputLocation.mkdirs();
         }
 
@@ -243,6 +257,12 @@
                 DATA_BINDING_TYPE_OPTION);
         if(dataBindingOption != null){
             setDatabindingType(dataBindingOption.getOptionValue());
+        }
+
+        CommandLineOption wrapClassesOption = (CommandLineOption) optionMap.get(
+                WRAP_CLASSES_OPTION);
+        if(wrapClassesOption != null){
+            wrapClasses = true;
         }
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOption.java Wed Dec 21 04:17:31 2005
@@ -93,10 +93,11 @@
                 (CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
                 (CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
                 (PACKAGE_OPTION).equalsIgnoreCase(optionType) ||
-                (GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(
-                        optionType) ||
+                (GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(optionType) ||
                 (GENERATE_TEST_CASE_OPTION).equalsIgnoreCase(optionType) ||
                 (STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType) ||
-                (DATA_BINDING_TYPE_OPTION).equalsIgnoreCase(optionType));
+                (DATA_BINDING_TYPE_OPTION).equalsIgnoreCase(optionType)||
+                (WRAP_CLASSES_OPTION).equalsIgnoreCase(optionType))
+                ;
     }
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CommandLineOptionConstants.java Wed Dec 21 04:17:31 2005
@@ -30,6 +30,7 @@
     public static final String STUB_LANGUAGE_OPTION = "l";
     public static final String GENERATE_TEST_CASE_OPTION = "t";
     public static final String DATA_BINDING_TYPE_OPTION = "d";
+    public static final String WRAP_CLASSES_OPTION = "w";
 
     public static final String INVALID_OPTION = "INVALID_OPTION";
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties Wed Dec 21 04:17:31 2005
@@ -56,10 +56,6 @@
 java.testclass.template=org.apache.axis2.wsdl.codegen.writer.TestClassWriter,/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
 java.service.template=org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter,/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
 java.message.receiver.template=org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter,/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
-java.dbsupporter.xmlbeans.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/XMLBeansSupporterTemplate.xsl
-java.dbsupporter.jaxb.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/XMLBeansSupporterTemplate.xsl
-java.dbsupporter.adb.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
-java.dbsupporter.default.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/DefaultDataBindingSupporterTemplate.xsl
 #
 java.antbuild.xmlbeans.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl
 java.antbuild.adb.template=org.apache.axis2.wsdl.codegen.writer.AntBuildWriter,/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Wed Dec 21 04:17:31 2005
@@ -24,7 +24,6 @@
 import org.apache.axis2.wsdl.codegen.writer.AntBuildWriter;
 import org.apache.axis2.wsdl.codegen.writer.CallbackHandlerWriter;
 import org.apache.axis2.wsdl.codegen.writer.ClassWriter;
-import org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter;
 import org.apache.axis2.wsdl.codegen.writer.InterfaceImplementationWriter;
 import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter;
 import org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter;
@@ -126,9 +125,10 @@
             }
 
             // Call the emit stub method to generate the client side too
-            // Do we need to enforce this here ?????
-            // Perhaps we can introduce a flag to determine this!
-            emitStub();
+            if (configuration.isGenerateAll()){
+                 emitStub();
+            }
+
 
         } catch (Exception e) {
             throw new CodeGenerationException(e);
@@ -204,6 +204,11 @@
                 writeServiceXml(axisBinding.getBoundInterface(), axisBinding);
                 //write a MessageReceiver for this particular service.
                 writeMessageReceiver(axisBinding);
+                //write the ant build if not asked for all
+                if (!configuration.isGenerateAll()){
+                  writeAntBuild(axisBinding.getBoundInterface(),axisBinding);
+                }
+
             }
         }
     }
@@ -235,6 +240,7 @@
         for (Iterator iterator = interfaceCollection.iterator(); iterator.hasNext();) {
             //Write the interfaces
             WSDLInterface axisInterface = (WSDLInterface) iterator.next();
+            //note that this case we do not care about the wrapping flag
             writeInterface(axisInterface, null);
             //write the call back handlers
             writeCallBackHandlers(axisInterface, null);
@@ -270,15 +276,17 @@
                 axisService = checkService(wom, axisService);
                 //write the inteface
                 //feed the binding information also
-                writeInterface(axisBinding.getBoundInterface(), axisBinding);
+                //note that we do not create this interface if the user switched on the wrap classes mode
+                if (!configuration.isWrapClasses()){
+                    writeInterface(axisBinding.getBoundInterface(), axisBinding);
+                }
                 //write the call back handlers
                 writeCallBackHandlers(axisBinding.getBoundInterface(), axisBinding);
                 //write interface implementations
                 writeInterfaceImplementation(axisBinding, axisService);
                 //write the test classes
                 writeTestClasses(axisBinding);
-                //write the databinding supporters
-                writeDatabindingSupporters(axisBinding);
+
                 //write a dummy implementation call for the tests to run.
                 //writeTestSkeletonImpl(axisBinding);
                 //write a testservice.xml that will load the dummy skeleton impl for testing
@@ -369,11 +377,13 @@
      * @throws Exception
      */
     protected void writeInterface(WSDLInterface axisInterface, WSDLBinding axisBinding) throws Exception {
+
         Document interfaceModel = createDOMDocumentForInterface(axisInterface, axisBinding);
         InterfaceWriter interfaceWriter =
                 new InterfaceWriter(this.configuration.getOutputLocation(),
                         this.configuration.getOutputLanguage());
         writeClass(interfaceModel, interfaceWriter);
+
     }
 
 
@@ -396,44 +406,8 @@
 
     }
 
-    /**
-     * Writes the skeleton
-     *
-     * @param axisBinding
-     * @throws Exception
-     */
-    protected void writeDatabindingSupporters(WSDLBinding axisBinding) throws Exception {
-        Collection col = axisBinding.getBoundInterface().getOperations()
-                .values();
-        Document databindingSupporterModel;
-
-        //create a writer here. The writer is reusable when writing multiple classes
-        ClassWriter databindingSupportWriter = new DatabindingSupportClassWriter(
-                this.configuration.getOutputLocation(),
-                this.configuration.getOutputLanguage(),
-                this.configuration.getDatabindingType());
-        String portTypeName = axisBinding.getBoundInterface().getName().getLocalPart();
-
-        //if wrapped generate one class that has all the conversion methods
-        if (configuration.isWrapClasses()){
-            databindingSupporterModel = createDOMDocumentforSerialization(portTypeName,col.iterator(),axisBinding);
-            writeClass(databindingSupporterModel, databindingSupportWriter);
-        } else{
-            for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-                //Note -  there will be a supporter generated per method and will contain the methods to serilize and
-                //deserailize the relevant objects
-
-                WSDLOperation operation = (WSDLOperation) iterator.next();
-                WSDLBindingOperation bindingop = axisBinding.getBindingOperation(operation.getName());
-                databindingSupporterModel = createDOMDocumentforSerialization(
-                        operation,portTypeName, bindingop);
-                writeClass(databindingSupporterModel, databindingSupportWriter);
-            }
-        }
 
 
-    }
-
     /**
      * Writes the Ant build
      *
@@ -792,9 +766,11 @@
                 rootElement);
         fillSyncAttributes(doc, rootElement);
         loadOperations(boundInterface, doc, rootElement, binding);
-        doc.appendChild(rootElement);
-
 
+        /////////////////////////
+        rootElement.appendChild(createDOMElementforDatabinders(doc,binding));
+        /////////////////////////
+        doc.appendChild(rootElement);
         return doc;
     }
 
@@ -1048,61 +1024,34 @@
 
     }
 
-    protected Document createDOMDocumentforSerialization(
-            String portTypeName,Iterator operationsInterator,WSDLBinding axisBinding) {
-        Document doc = getEmptyDocument();
-        while (operationsInterator.hasNext()) {
-            WSDLOperation operation = (WSDLOperation) operationsInterator.next();
-            WSDLBindingOperation bindingop = axisBinding.getBindingOperation(operation.getName());
-            doc.appendChild(createDOMElementforSerializationForOperation(doc,operation,portTypeName,bindingop));
-        }
 
-        return doc;
-    }
 
-    protected Document createDOMDocumentforSerialization(
-            WSDLOperation operation, String portTypeName, WSDLBindingOperation bindingOperation) {
-        Document doc = getEmptyDocument();
-        doc.appendChild(createDOMElementforSerializationForOperation(doc,operation,portTypeName,bindingOperation));
-        return doc;
-    }
+    protected Element createDOMElementforDatabinders(
+            Document doc, WSDLBinding binding) {
+        //First Iterate through the operations and find the relevant fromOM and toOM methods to be generated
+        Map bindingOperationsMap =  binding.getBindingOperations();
 
-    protected Element createDOMElementforSerializationForOperation(
-            Document doc,WSDLOperation operation, String portTypeName, WSDLBindingOperation bindingOperation) {
-        Element rootElement = doc.createElement("class");
-        addAttribute(doc,
-                "package",
-                configuration.getPackageName() +
-                        DATABINDING_PACKAGE_NAME_SUFFIX,
-                rootElement);
-        String localPart = reformatName(operation.getName().getLocalPart(),false);
-        portTypeName = reformatName(portTypeName,false);
-        addAttribute(doc,
-                "name",
-                portTypeName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
-                rootElement);
-        addAttribute(doc, "methodname", localPart, rootElement);
-        addAttribute(doc,
-                "namespace",
-                operation.getName().getNamespaceURI(),
-                rootElement);
-
-        //Add the parameters to a map with their type as the key
-        //this step is needed to remove repetitions
         Map parameterMap = new HashMap();
-        Element inputParamElement = getInputParamElement(doc, operation);
-
-        if (inputParamElement!=null){
-            parameterMap.put(inputParamElement.getAttribute("type"),inputParamElement);
-        }
+        Iterator operationsIterator =  bindingOperationsMap.values().iterator();
+        while (operationsIterator.hasNext()) {
+            WSDLBindingOperation bindingOperation = (WSDLBindingOperation) operationsIterator.next();
+            //Add the parameters to a map with their type as the key
+            //this step is needed to remove repetitions
+
+            //process the input and output parameters
+            Element inputParamElement = getInputParamElement(doc, bindingOperation.getOperation());
+            if (inputParamElement!=null){
+                parameterMap.put(inputParamElement.getAttribute("type"),inputParamElement);
+            }
+            Element outputParamElement = getOutputParamElement(doc, bindingOperation.getOperation());
+            if (outputParamElement!=null){
+                parameterMap.put(outputParamElement.getAttribute("type"),outputParamElement);
+            }
 
-        Element outputParamElement = getOutputParamElement(doc, operation);
-        if (outputParamElement!=null){
-            parameterMap.put(outputParamElement.getAttribute("type"),outputParamElement);
-        }
-        Element newChild;
+            //todo process the exceptions
 
-        if (bindingOperation!=null) {
+            //process the header parameters
+            Element newChild;
             List headerParameterQNameList= new ArrayList();
             addHeaderOperations(headerParameterQNameList,bindingOperation,true);
             List parameterElementList = getParameterElementList(doc,headerParameterQNameList, "header");
@@ -1120,8 +1069,12 @@
                 newChild = (Element) parameterElementList.get(i);
                 parameterMap.put(newChild.getAttribute("type"),newChild);
             }
+
         }
 
+        Element rootElement = doc.createElement("databinders");
+        addAttribute(doc,"dbtype",configuration.getDatabindingType(),rootElement);
+
         //add the names of the elements that have base 64 content
         //if the base64 name list is missing then this whole step is skipped
         rootElement.appendChild(getBase64Elements(doc));
@@ -1132,6 +1085,7 @@
             rootElement.appendChild((Element)iterator.next());
         }
 
+
         return rootElement;
     }
 
@@ -1191,16 +1145,21 @@
                 "callbackname",
                 localPart + CALL_BACK_HANDLER_SUFFIX,
                 rootElement);
+        //add the wrap classes flag
+        if (configuration.isWrapClasses()){
+            addAttribute(doc,
+                    "wrapped",
+                    "yes",
+                    rootElement);
+        }
+
+        //todo fix this
         addAttribute(doc,
                 "dbsupportpackage",
                 configuration.getPackageName() +
                         DATABINDING_PACKAGE_NAME_SUFFIX,
                 rootElement);
-        addAttribute(doc,
-                "dbsupportpackage",
-                configuration.getPackageName() +
-                        DATABINDING_PACKAGE_NAME_SUFFIX,
-                rootElement);
+
         //add SOAP version
         addSoapVersion(binding,doc,rootElement);
         //add the end point
@@ -1209,6 +1168,13 @@
         fillSyncAttributes(doc, rootElement);
         //load the operations
         loadOperations(boundInterface, doc, rootElement, binding);
+
+        //add the databind supporters. Now the databind supporters are completly contained inside
+        //the stubs implementation and not visible outside
+        rootElement.appendChild(
+                createDOMElementforDatabinders(doc,binding));
+
+
         doc.appendChild(rootElement);
 
         return doc;
@@ -1241,7 +1207,7 @@
     protected void addEndpoints(Document doc,
                                 Element rootElement,
                                 HashMap endpointMap) throws Exception{
-       // Map endpointPolicyMap = configuration.getPolicyMap();
+        // Map endpointPolicyMap = configuration.getPolicyMap();
         Object[] endpoints = endpointMap.values().toArray();
         WSDLEndpoint endpoint;
         Element endpointElement;

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java Wed Dec 21 04:17:31 2005
@@ -92,8 +92,11 @@
                 }
             }
             //call the schema compiler
-            CompilerOptions options = new CompilerOptions().setOutputLocation(configuration.getOutputLocation());
+            CompilerOptions options = new CompilerOptions();
+            options.setOutputLocation(configuration.getOutputLocation());
             options.setPackageName(ADB_PACKAGE_NAME_PREFIX);
+            options.setWrapClasses(configuration.isWrapClasses());
+
 
             SchemaCompiler schemaCompiler = new SchemaCompiler(options);
             schemaCompiler

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Wed Dec 21 04:17:31 2005
@@ -1,58 +1,59 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="text"/>
     <xsl:template match="/class">
-    <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
-    <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
-    <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
-    <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
-    <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
-    <xsl:variable name="dbpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
-    <xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
-    /**
-     * <xsl:value-of select="@name"/>.java
-     *
-     * This file was auto-generated from WSDL
-     * by the Apache Axis2 version: #axisVersion# #today#
-     */
-    package <xsl:value-of select="$package"/>;
+        <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
+        <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+        <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+        <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+        <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+        <xsl:variable name="dbpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
+        <xsl:variable name="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+        /**
+        * <xsl:value-of select="@name"/>.java
+        *
+        * This file was auto-generated from WSDL
+        * by the Apache Axis2 version: #axisVersion# #today#
+        */
+        package <xsl:value-of select="$package"/>;
 
         <!-- Put the MTOM enable flag -->
 
 
-    /*
-     *  <xsl:value-of select="@name"/> java implementation 
-    */
+        /*
+        *  <xsl:value-of select="@name"/> java implementation
+        */
 
-    public class <xsl:value-of select="@name"/> extends org.apache.axis2.client.Stub implements <xsl:value-of select="$interfaceName"/>{
+        public class <xsl:value-of select="@name"/> extends org.apache.axis2.client.Stub
+        <xsl:if test="not(@wrapped)">implements <xsl:value-of select="$interfaceName"/></xsl:if>{
         //default axis home being null forces the system to pick up the mars from the axis2 library
         public static final String AXIS2_HOME = null;
         protected static org.apache.axis2.description.AxisOperation[] _operations;
 
         static{
 
-           //creating the Service
-           _service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>");
+        //creating the Service
+        _service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>");
 
-           //creating the operations
-           org.apache.axis2.description.AxisOperation __operation;
-           _operations = new org.apache.axis2.description.OutInAxisOperation[<xsl:value-of select="count(method)"/>];
-      <xsl:for-each select="method">
-           __operation = new org.apache.axis2.description.OutInAxisOperation();
-           __operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
-           _operations[<xsl:value-of select="position()-1"/>]=__operation;
-           _service.addOperation(__operation);
-     </xsl:for-each>
-       }
+        //creating the operations
+        org.apache.axis2.description.AxisOperation __operation;
+        _operations = new org.apache.axis2.description.OutInAxisOperation[<xsl:value-of select="count(method)"/>];
+        <xsl:for-each select="method">
+            __operation = new org.apache.axis2.description.OutInAxisOperation();
+            __operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
+            _operations[<xsl:value-of select="position()-1"/>]=__operation;
+            _service.addOperation(__operation);
+        </xsl:for-each>
+        }
 
-       /**
+        /**
         * Constructor
         */
         public <xsl:value-of select="@name"/>(String axis2Home,String targetEndpoint) throws java.lang.Exception {
-		    //creating the configuration
-           _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
-           _configurationContext.getAxisConfiguration().addService(_service);
-           _serviceContext =new org.apache.axis2.context.ServiceGroupContext(_configurationContext, _service.getParent()).getServiceContext(_service.getName());
-           _clientOptions.setTo(new org.apache.axis2.addressing.EndpointReference(targetEndpoint));
+        //creating the configuration
+        _configurationContext = new org.apache.axis2.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
+        _configurationContext.getAxisConfiguration().addService(_service);
+        _serviceContext =new org.apache.axis2.context.ServiceGroupContext(_configurationContext, _service.getParent()).getServiceContext(_service.getName());
+        _clientOptions.setTo(new org.apache.axis2.addressing.EndpointReference(targetEndpoint));
 
         <!--  Set the soap version depending on the binding. Default is 1.1 so don't set anything for that case-->
         <xsl:if test="$soapVersion='1.2'">
@@ -68,14 +69,14 @@
         * Default Constructor
         */
         public <xsl:value-of select="@name"/>() throws java.lang.Exception {
-         <!-- change this -->
+        <!-- change this -->
         <xsl:for-each select="endpoint">
             <xsl:choose>
                 <xsl:when test="position()=1">
-                     this(AXIS2_HOME,"<xsl:value-of select="."/>" );
+                    this(AXIS2_HOME,"<xsl:value-of select="."/>" );
                 </xsl:when>
                 <xsl:otherwise>
-                     //this(AXIS2_HOME,"<xsl:value-of select="."/>" );
+                    //this(AXIS2_HOME,"<xsl:value-of select="."/>" );
                 </xsl:otherwise>
             </xsl:choose>
             <xsl:if test="@policyRef">
@@ -87,271 +88,413 @@
 
 
 
-     <xsl:for-each select="method">
-         <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
-         <xsl:variable name="style"><xsl:value-of select="@style"></xsl:value-of></xsl:variable>
-         <xsl:variable name="dbsupportclassname"><xsl:value-of select="@dbsupportname"></xsl:value-of></xsl:variable>
-         <xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
-         <xsl:variable name="fullsupporterclassname"><xsl:value-of select="$dbpackage"/>.<xsl:value-of select="$dbsupportclassname"/></xsl:variable>
-         <xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
-
-         <!-- Code generation for the in-out mep -->
-		 <xsl:if test="$mep='http://www.w3.org/2004/08/wsdl/in-out'">
-         <xsl:if test="$isSync='1'">
+        <xsl:for-each select="method">
+            <xsl:variable name="outputtype"><xsl:value-of select="output/param/@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>
+
+            <!-- Code generation for the in-out mep -->
+            <xsl:if test="$mep='http://www.w3.org/2004/08/wsdl/in-out'">
+                <xsl:if test="$isSync='1'">
+                    /**
+                    * Auto generated method signature
+                    * @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#<xsl:value-of select="@name"/>
+                    <xsl:for-each select="input/param[@type!='']">
+                        * @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+                    </xsl:text></xsl:for-each>
+                    */
+                    public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+                    <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+                    <xsl:for-each select="input/param[@type!='']">
+                        <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                    </xsl:for-each>) throws java.rmi.RemoteException{
+
+                    org.apache.axis2.client.Call _call = new org.apache.axis2.client.Call(_serviceContext);
+                    org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options(_clientOptions);
+                    _call.setClientOptions(_options);
+
+                    org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
+                    _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
+                    <!-- see whether this makes sense
+             this is not implemented in the emitter properly-->
+                    <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+
+                    //set the properties
+                    populateModules(_call);
+
+                    org.apache.axis2.soap.SOAPEnvelope env;
+                    env = createEnvelope();
+                    <xsl:variable name="count"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
+                    <xsl:choose>
+                        <!-- test the number of input parameters
+                        If the number of parameter is more then just run the normal test-->
+                        <xsl:when test="$count>0">
+                            <xsl:choose>
+                                <xsl:when test="$style='rpc'">
+                                    // Style is RPC
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI(), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+                                    new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
+                                    new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
+                                </xsl:when>
+                                <xsl:when test="$style='doc'">
+
+                                    //Style is Doc.
+                                    <xsl:for-each select="input/param[@location='body']">
+                                        setValueDoc(env,toOM(<xsl:value-of select="@name"/>));
+                                    </xsl:for-each>
+                                    <xsl:for-each select="input/param[@location='header']">
+                                        setValueDoc(env,toOM(<xsl:value-of select="@name"/>),true);
+                                    </xsl:for-each>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    //Unknown style!! No code is generated
+                                    throw java.lang.UnsupportedOperationException("Unknown Style");
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <!-- No input parameters present. So generate assuming no input parameters-->
+                        <xsl:otherwise>
+                            <xsl:choose>
+                                <xsl:when test="$style='rpc'">
+                                    //Style is RPC. No input parameters
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+                                </xsl:when>
+                                <xsl:when test="$style='doc'">
+                                    //Style is Doc. No input parameters
+                                    setValueDoc(env,null);
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    //Unknown style!! No code is generated
+                                    throw UnsupportedOperationException("Unknown Style");
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:otherwise>
+                    </xsl:choose>
+
+                    _messageContext.setEnvelope(env);
+                    <xsl:choose>
+                        <xsl:when test="$outputtype=''">
+                            _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+                            return;
+                        </xsl:when>
+                        <xsl:otherwise>
+                            //set the exception throwing status
+                            _call.getClientOptions().setExceptionToBeThrownOnSOAPFault(true);
+                            org.apache.axis2.context.MessageContext  _returnMessageContext = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+                            org.apache.axis2.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
+                            java.lang.Object object = fromOM(getElement(_returnEnv,"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
+                            return (<xsl:value-of select="$outputtype"/>)object;
+                        </xsl:otherwise>
+                    </xsl:choose>
+
+                    <!-- this needs to be changed -->
+                    }
+                </xsl:if>
+                <xsl:if test="$isAsync='1'">
+                    /**
+                    * Auto generated method signature for Asynchronous Invocations
+                    * @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#start<xsl:value-of select="@name"/>
+                    <xsl:for-each select="input/param[@type!='']">
+                        * @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+                    </xsl:text></xsl:for-each>
+                    */
+                    public  void start<xsl:value-of select="@name"/>(
+                    <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
+                    <xsl:for-each select="input/param[@type!='']">
+                        <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+                    <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException{
+
+                    org.apache.axis2.client.Call _call = new org.apache.axis2.client.Call(_serviceContext);
+                    org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options(_clientOptions);
+                    _call.setClientOptions(_options);
+                    org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
+                    _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
+
+                    <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+
+                    org.apache.axis2.soap.SOAPEnvelope env = createEnvelope();
+                    <xsl:choose>
+                        <!-- There are more than 1 parameter in the input-->
+                        <xsl:when test="$paramCount>0">
+                            <xsl:choose>
+                                <xsl:when test="$style='rpc'">
+                                    // Style is RPC
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,
+                                    "<xsl:value-of select="@namespace"/>",
+                                    "<xsl:value-of select="@name"/>",
+                                    new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
+                                    new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
+                                </xsl:when>
+
+                                <xsl:when test="$style='doc'">
+                                    //Style is Doc
+                                    setValueDoc(env,toOM(<xsl:value-of select="input/param[1]/@name"/>));
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    //Unknown style!! No code is generated
+                                    throw UnsupportedOperationException("Unknown Style");
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:choose>
+                                <xsl:when test="$style='rpc'">
+                                    //Style is RPC. No input parameters
+                                    org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,
+                                    "<xsl:value-of select="@namespace"/>",
+                                    "<xsl:value-of select="@name"/>",
+                                    null,
+                                    null);
+                                </xsl:when>
+                                <!-- The follwing code is specific to XML beans-->
+                                <xsl:when test="$style='doc'">
+                                    //Style is Doc. No input parameters
+                                    setValueDoc(env,null);
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    //Unknown style!! No code is generated
+                                    throw UnsupportedOperationException("Unknown Style");
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    _messageContext.setEnvelope(env);
+                    <xsl:choose>
+                        <xsl:when test="$outputtype=''">
+                            //Nothing to pass as the callback!!!
+                            _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext,null);
+                        </xsl:when>
+                        <xsl:otherwise>
+                            _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext, new org.apache.axis2.client.async.Callback(){
+                            public void onComplete(org.apache.axis2.client.async.AsyncResult result){
+
+                            java.lang.Object object = fromOM(getElement(result.getResponseEnvelope(),"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
+                            callback.receiveResult<xsl:value-of select="@name"/>((<xsl:value-of select="$outputtype"/>)object);
+                            }
+                            public void reportError(java.lang.Exception e){
+                            callback.receiveError<xsl:value-of select="@name"/>(e);
+                            }
+                            }
+                            );
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    }
+                </xsl:if>
+                <!-- End of in-out mep -->
+            </xsl:if>
+            <!-- Start of in only mep-->
+            <xsl:if test="$mep='http://www.w3.org/2004/08/wsdl/in-only'">
+                <!-- for the in only mep there is no notion of sync or async. And there is no return type also -->
+                public void <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+                <xsl:for-each select="input/param[@type!='']">
+                    <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+                </xsl:for-each>) throws java.rmi.RemoteException{
+                org.apache.axis2.client.MessageSender _msgSender = new org.apache.axis2.client.MessageSender(_serviceContext);
+
+                org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
+                org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options(_clientOptions);
+                _msgSender.setClientOptions(_options);
+
+                _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
+
+                <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
+                org.apache.axis2.soap.SOAPEnvelope env;
+                env = createEnvelope();
+                <xsl:choose>
+                    <!-- test the number of input parameters
+                       If the number of parameter is more then just run the normal generation-->
+                    <xsl:when test="count(input/param[@type!=''])>0">
+                        <xsl:choose>
+                            <xsl:when test="$style='rpc'">
+                                // Style is RPC
+                                org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
+                                new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
+                                new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
+                            </xsl:when>
+                            <xsl:when test="$style='doc'">
+                                <!-- for the doc lit case there can be only one element. So take the first element -->
+                                //Style is Doc.
+                                setValueDoc(env,toOM(<xsl:value-of select="input/param[1]/@name"/>));
+                            </xsl:when>
+                            <xsl:otherwise>
+                                //Unknown style!! No code is generated
+                                throw java.lang.UnsupportedOperationException("Unknown Style");
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <!-- No input parameters present. So generate assuming no input parameters-->
+                    <xsl:otherwise>
+                        <xsl:choose>
+                            <xsl:when test="$style='rpc'">
+                                //Style is RPC. No input parameters
+                                org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
+                            </xsl:when>
+                            <xsl:when test="$style='doc'">
+                                //Style is Doc. No input parameters
+                                setValueDoc(env,null);
+                            </xsl:when>
+                            <xsl:otherwise>
+                                //Unknown style!! No code is generated
+                                throw UnsupportedOperationException("Unknown Style");
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+
+                //set the properties
+                populateModules(_msgSender);
+
+                _messageContext.setEnvelope(env);
+                _msgSender.send(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+                return;
+                }
+            </xsl:if>
+        </xsl:for-each>
+
         /**
-         * Auto generated method signature
-         * @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#<xsl:value-of select="@name"/>
-         <xsl:for-each select="input/param[@type!='']">
-         * @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
-         </xsl:text></xsl:for-each>
-         */
-        public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
-        <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
-         <xsl:for-each select="input/param[@type!='']">
-            <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
-         </xsl:for-each>) throws java.rmi.RemoteException{
-
-		     org.apache.axis2.client.Call _call = new org.apache.axis2.client.Call(_serviceContext);
-             org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options(_clientOptions);
-             _call.setClientOptions(_options);
-
- 		     org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
-            _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
-             <!-- see whether this makes sense
-                this is not implemented in the emitter properly-->
-             <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
-
-             //set the properties
-            populateModules(_call);
-
-            org.apache.axis2.soap.SOAPEnvelope env = null;
-            env = createEnvelope();
-            <xsl:variable name="count"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
-            <xsl:choose>
-            <!-- test the number of input parameters
-				  If the number of parameter is more then just run the normal test-->
-                <xsl:when test="$count>0">
-                  <xsl:choose>
-                      <xsl:when test="$style='rpc'">
-               // Style is RPC
-              org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI(), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
-              new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
-              new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
-                      </xsl:when>
-                      <xsl:when test="$style='doc'">
-
-               //Style is Doc.
-                <xsl:for-each select="input/param[@location='body']">
-               setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="@name"/>));
-                 </xsl:for-each>
-                 <xsl:for-each select="input/param[@location='header']">
-               setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="@name"/>),true);
-                 </xsl:for-each>
-                 </xsl:when>
-                 <xsl:otherwise>
-               //Unknown style!! No code is generated
-               throw java.lang.UnsupportedOperationException("Unknown Style");
-                      </xsl:otherwise>
-                  </xsl:choose>
-              </xsl:when>
-              <!-- No input parameters present. So generate assuming no input parameters-->
-              <xsl:otherwise>
-                   <xsl:choose>
-                   <xsl:when test="$style='rpc'">
-               //Style is RPC. No input parameters
-               org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
-                      </xsl:when>
-                     <xsl:when test="$style='doc'">
-               //Style is Doc. No input parameters
-               setValueDoc(env,null);
-                      </xsl:when>
-                      <xsl:otherwise>
-             //Unknown style!! No code is generated
-              throw UnsupportedOperationException("Unknown Style");
-                      </xsl:otherwise>
-                  </xsl:choose>
-             </xsl:otherwise>
-            </xsl:choose>
+        *
+        */
+     private void optimizeContent(org.apache.axis2.om.OMElement element, javax.xml.namespace.QName[] qNames){
+        for (int i = 0; i &lt; qNames.length; i++) {
+            markElementsAsOptimized(qNames[i],element);
+        }
+    }
 
-             _messageContext.setEnvelope(env);
-             <xsl:choose>
-             <xsl:when test="$outputtype=''">
-             _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
-               return;
-              </xsl:when>
-              <xsl:otherwise>
-             //set the exception throwing status
-             _call.getClientOptions().setExceptionToBeThrownOnSOAPFault(true);
-             org.apache.axis2.context.MessageContext  _returnMessageContext = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
-             org.apache.axis2.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
-             java.lang.Object object = <xsl:value-of select="$fullsupporterclassname"/>.fromOM(getElement(_returnEnv,"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
-             return (<xsl:value-of select="$outputtype"/>)object;
-                 </xsl:otherwise>
-             </xsl:choose>
+        /**
+        *
+        */
+    private void markElementsAsOptimized(javax.xml.namespace.QName qName,org.apache.axis2.om.OMElement rootElt){
+        if (rootElt.getQName().equals(qName)){
+            //get the text node and mark it
+            org.apache.axis2.om.OMNode node = rootElt.getFirstOMChild();
+            if (node.getType()==org.apache.axis2.om.OMNode.TEXT_NODE){
+                ((org.apache.axis2.om.OMText)node).setOptimize(true);
+            }
 
-            <!-- this needs to be changed -->
         }
+        java.util.Iterator childElements = rootElt.getChildElements();
+        while (childElements.hasNext()) {
+            markElementsAsOptimized(qName,(org.apache.axis2.om.OMElement)childElements.next());
+        }
+    }
+
+        //<xsl:apply-templates/>
+
+        }
+
+
+
+    </xsl:template>
+
+
+    <!-- #################################################################################  -->
+    <!-- ############################   xmlbeans template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='xmlbeans']">
+
+        <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
+        <xsl:if test="$base64">
+            private static javax.xml.namespace.QName[] qNameArray = {
+            <xsl:for-each select="base64Elements/name">
+                <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
+            </xsl:for-each>
+            };
         </xsl:if>
-        <xsl:if test="$isAsync='1'">
-         /**
-         * Auto generated method signature for Asynchronous Invocations
-         * @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#start<xsl:value-of select="@name"/>
-          <xsl:for-each select="input/param[@type!='']">
-         * @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
-         </xsl:text></xsl:for-each>
-         */
-        public  void start<xsl:value-of select="@name"/>(
-         <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
-         <xsl:for-each select="input/param[@type!='']">
-            <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
-            <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException{
-
-             org.apache.axis2.client.Call _call = new org.apache.axis2.client.Call(_serviceContext);
-            org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options(_clientOptions);
-             _call.setClientOptions(_options);
- 		     org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
-             _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
-            
-            <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
-
-             org.apache.axis2.soap.SOAPEnvelope env = createEnvelope();
-             <xsl:choose>
-             <!-- There are more than 1 parameter in the input-->
-              <xsl:when test="$paramCount>0">
-              <xsl:choose>
-               <xsl:when test="$style='rpc'">
-           // Style is RPC
-           org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,
-            "<xsl:value-of select="@namespace"/>",
-            "<xsl:value-of select="@name"/>",
-             new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
-             new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
-                      </xsl:when>
-
-                      <xsl:when test="$style='doc'">
-           //Style is Doc
-            setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="input/param[1]/@name"/>));
-                      </xsl:when>
-                      <xsl:otherwise>
-          //Unknown style!! No code is generated
-          throw UnsupportedOperationException("Unknown Style");
-                      </xsl:otherwise>
-                  </xsl:choose>
-              </xsl:when>
-              <xsl:otherwise>
-                   <xsl:choose>
-                   <xsl:when test="$style='rpc'">
-           //Style is RPC. No input parameters
-              org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,
-                "<xsl:value-of select="@namespace"/>",
-                "<xsl:value-of select="@name"/>",
-                null,
-                null);
-                      </xsl:when>
-                      <!-- The follwing code is specific to XML beans-->
-                      <xsl:when test="$style='doc'">
-           //Style is Doc. No input parameters
-           setValueDoc(env,null);
-                      </xsl:when>
-                      <xsl:otherwise>
-          //Unknown style!! No code is generated
-          throw UnsupportedOperationException("Unknown Style");
-                      </xsl:otherwise>
-                  </xsl:choose>
-              </xsl:otherwise>
-            </xsl:choose>
-             _messageContext.setEnvelope(env);
-             <xsl:choose>
-             <xsl:when test="$outputtype=''">
-              //Nothing to pass as the callback!!!
-              _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext,null);
-              </xsl:when>
-              <xsl:otherwise>
-               _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext, new org.apache.axis2.client.async.Callback(){
-                public void onComplete(org.apache.axis2.client.async.AsyncResult result){
 
-			    java.lang.Object object = <xsl:value-of select="$fullsupporterclassname"/>.fromOM(getElement(result.getResponseEnvelope(),"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
-                             callback.receiveResult<xsl:value-of select="@name"/>((<xsl:value-of select="$outputtype"/>)object);
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+                public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
+                org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
+                (org.apache.axis2.om.OMAbstractFactory.getOMFactory(),new org.apache.axis2.util.StreamWrapper(param.newXMLStreamReader())) ;
+
+                <xsl:choose>
+                    <xsl:when test="$base64">
+                         org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement();
+                         optimizeContent(documentElement,qNameArray);
+                         return documentElement;
+                    </xsl:when>
+                    <xsl:otherwise>
+                        return  builder.getDocumentElement();
+                    </xsl:otherwise>
+                </xsl:choose>
+
                 }
-                public void reportError(java.lang.Exception e){
-                      callback.receiveError<xsl:value-of select="@name"/>(e);
+            </xsl:if>
+
+        </xsl:for-each>
+
+        public org.apache.xmlbeans.XmlObject fromOM(org.apache.axis2.om.OMElement param,
+        java.lang.Class type){
+        try{
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+                if (<xsl:value-of select="@type"/>.class.equals(type)){
+                return <xsl:value-of select="@type"/>.Factory.parse(param.getXMLStreamReader()) ;
                 }
+            </xsl:if>
+        </xsl:for-each>
+        }catch(java.lang.Exception e){
+        throw new RuntimeException("Data binding error",e);
+        }
+        return null;
+        }
+
+    </xsl:template>
+
+    <!-- #################################################################################  -->
+    <!-- ############################   ADB template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='adb']">
+
+         <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
+         <xsl:if test="$base64">
+             private static javax.xml.namespace.QName[] qNameArray = {
+             <xsl:for-each select="base64Elements/name">
+                 <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
+             </xsl:for-each>
+             };
+         </xsl:if>
+
+         <xsl:for-each select="param">
+             <xsl:if test="@type!=''">
+                 <!-- consider all the types to ADBbeans. So no instanceof check -->
+                 public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
+                 org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
+                 (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
+                 return builder.getDocumentElement();
+                 }
+             </xsl:if>
+         </xsl:for-each>
+
+         public  java.lang.Object fromOM(org.apache.axis2.om.OMElement param,
+         java.lang.Class type){
+              Object obj;
+             try {
+                 java.lang.reflect.Method parseMethod = type.getMethod("parse",new Class[]{javax.xml.stream.XMLStreamReader.class});
+                 obj = null;
+                 if (parseMethod!=null){
+                     obj = parseMethod.invoke(null,new Object[]{param.getXMLStreamReader()});
+                 }else{
+                     //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here
+                 }
+             } catch (Exception e) {
+                  throw new RuntimeException(e);
              }
-            );
-              </xsl:otherwise>
-             </xsl:choose>
-        }
-      </xsl:if>
-      <!-- End of in-out mep -->
-      </xsl:if>
-      <!-- Start of in only mep-->
-      <xsl:if test="$mep='http://www.w3.org/2004/08/wsdl/in-only'">
-      <!-- for the in only mep there is no notion of sync or async. And there is no return type also -->
-      public void <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
-         <xsl:for-each select="input/param[@type!='']">
-            <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
-         </xsl:for-each>) throws java.rmi.RemoteException{
-         org.apache.axis2.client.MessageSender _msgSender = new org.apache.axis2.client.MessageSender(_serviceContext);
-            
- 		    org.apache.axis2.context.MessageContext _messageContext = getMessageContext();
-          org.apache.axis2.client.Options _options = new org.apache.axis2.client.Options(_clientOptions);
-          _msgSender.setClientOptions(_options);
-
-          _options.setSoapAction("<xsl:value-of select="$soapAction"/>");
-
-          <xsl:for-each select="input/param[@Action!='']">_options.setAction("<xsl:value-of select="@Action"/>");</xsl:for-each>
-          org.apache.axis2.soap.SOAPEnvelope env = null;
-            env = createEnvelope();
-            <xsl:choose>
-            <!-- test the number of input parameters
-				  If the number of parameter is more then just run the normal generation-->
-              <xsl:when test="count(input/param[@type!=''])>0">
-                  <xsl:choose>
-                      <xsl:when test="$style='rpc'">
-               // Style is RPC
-              org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",
-              new String[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if>"<xsl:value-of select="@name"/>"</xsl:for-each>},
-              new Object[]{<xsl:for-each select="input/param[@type!='']"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@name"/></xsl:for-each>});
-                      </xsl:when>
-                      <xsl:when test="$style='doc'">
-                      <!-- for the doc lit case there can be only one element. So take the first element -->
-               //Style is Doc.
-               setValueDoc(env,<xsl:value-of select="$fullsupporterclassname"/>.toOM(<xsl:value-of select="input/param[1]/@name"/>));
-                      </xsl:when>
-                      <xsl:otherwise>
-               //Unknown style!! No code is generated
-               throw java.lang.UnsupportedOperationException("Unknown Style");
-                      </xsl:otherwise>
-                  </xsl:choose>
-              </xsl:when>
-              <!-- No input parameters present. So generate assuming no input parameters-->
-              <xsl:otherwise>
-                   <xsl:choose>
-                   <xsl:when test="$style='rpc'">
-               //Style is RPC. No input parameters
-               org.apache.axis2.rpc.client.RPCStub.setValueRPC(getFactory(_options.getSoapVersionURI()), env,"<xsl:value-of select="@namespace"/>","<xsl:value-of select="@name"/>",null,null);
-                      </xsl:when>
-                     <xsl:when test="$style='doc'">
-               //Style is Doc. No input parameters
-               setValueDoc(env,null);
-                      </xsl:when>
-                      <xsl:otherwise>
-             //Unknown style!! No code is generated
-              throw UnsupportedOperationException("Unknown Style");
-                      </xsl:otherwise>
-                  </xsl:choose>
-             </xsl:otherwise>
-            </xsl:choose>
-            
-            //set the properties
-            populateModules(_msgSender);
-            
-             _messageContext.setEnvelope(env);
-             _msgSender.send(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
-               return;
-          }
-      </xsl:if>
-     </xsl:for-each>
-    }
+
+             return obj;
+         }
+
+     </xsl:template>
+    <!-- #################################################################################  -->
+    <!-- ############################   none template!!!   ##############################  -->
+    <xsl:template match="databinders[@dbtype='none']">
+        public  org.apache.axis2.om.OMElement fromOM(org.apache.axis2.om.OMElement param, java.lang.Class type){
+           return param;
+        }
+
+        public  org.apache.axis2.om.OMElement  toOM(org.apache.axis2.om.OMElement param){
+            return param;
+        }
     </xsl:template>
- </xsl:stylesheet>
+
+</xsl:stylesheet>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=358274&r1=358273&r2=358274&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Wed Dec 21 04:17:31 2005
@@ -46,7 +46,6 @@
             <xsl:variable name="returntype"><xsl:value-of select="output/param/@type"/></xsl:variable>
             <xsl:variable name="returnvariable"><xsl:value-of select="output/param/@name"/></xsl:variable>
             <xsl:variable name="namespace"><xsl:value-of select="@namespace"/></xsl:variable>
-            <xsl:variable name="dbsupportname"><xsl:value-of select="@dbsupportname"/></xsl:variable>
 
             <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
             <xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
@@ -64,44 +63,9 @@
 
             <xsl:choose>
                 <xsl:when test="$style='rpc'">
-                    //rpc style
-                    <xsl:variable name="inputparamcount"><xsl:value-of select="count(input/param)"/></xsl:variable>
-                    <xsl:for-each select="input/param">
-                        <xsl:if test="@type!=''">
-
-                            org.apache.axis2.om.OMElement firstChild = (org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstChild();
-                            if(null == firstChild)
-                            throw new org.apache.axis2.AxisFault("Wrapper Element Not Found for the axisOperation of RPC style");
-                            java.util.Iterator children = firstChild.getChildren();
-                            org.apache.xmlbeans.XmlObject[] params = new org.apache.xmlbeans.XmlObject[<xsl:value-of select="$inputparamcount"/>];
-                            int count = 0;
-                            while(children.hasNext() &amp;&amp; count &lt; <xsl:value-of select="$inputparamcount"/>){
-                            params[count] = org.soapinterop.databinding.echoStringDatabindingSupporter.fromOM((org.apache.axis2.om.OMElement)children.next(), <xsl:value-of select="@type"/>.class);
-                            count++;
-                            }
-                            if(count!= <xsl:value-of select="$inputparamcount"/>)
-                            throw new org.apache.axis2.AxisFault("Parts mismatch in the message");
-
-                        </xsl:if>
-                    </xsl:for-each>
-
-                    <xsl:if test="$returntype!=''">
-                        <xsl:value-of select="$returnvariable"/> =</xsl:if> skel.<xsl:value-of select="@name"/>(
-                    <xsl:for-each select="input/param">
-                        <xsl:if test="@type!=''">
-                            (<xsl:value-of select="@type"/>)params[<xsl:value-of select="position()-1"/>]<xsl:if test="position()!=$inputparamcount">,</xsl:if>
-                        </xsl:if>
-                    </xsl:for-each>);
-                    //Create a default envelop
-                    envelope = getSOAPFactory().getDefaultEnvelope();
-                    org.apache.axis2.om.OMNamespace ns = getSOAPFactory().createOMNamespace("<xsl:value-of select="$namespace"/>", "<xsl:value-of select="$name"/>Responce");
-                    org.apache.axis2.om.OMElement responseMethodName = getSOAPFactory().createOMElement(methodName + "Response", ns);
-                    //Create a Omelement of the result if a result exist
-                    <xsl:if test="$returntype!=''">
-                        responseMethodName.setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.toOM(<xsl:value-of select="$returnvariable"/>));
-                    </xsl:if>
 
-                    envelope.getBody().setFirstChild(responseMethodName);
+                    //rpc style  -- this needs to be filled
+
                 </xsl:when>
                 <xsl:when test="$style='doc'">
                     //doc style
@@ -110,7 +74,7 @@
                     <xsl:choose>
                         <xsl:when test="$paramCount &gt; 0"> skel.<xsl:value-of select="@name"/>(
                             <xsl:for-each select="input/param[@location='body']">
-                                <xsl:if test="@type!=''">(<xsl:value-of select="@type"/>)<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.fromOM((org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstElement().detach(), <xsl:value-of select="@type"/>.class)<xsl:if test="position() &gt; 1">,</xsl:if></xsl:if>
+                                <xsl:if test="@type!=''">(<xsl:value-of select="@type"/>)fromOM((org.apache.axis2.om.OMElement)msgContext.getEnvelope().getBody().getFirstElement().detach(), <xsl:value-of select="@type"/>.class)<xsl:if test="position() &gt; 1">,</xsl:if></xsl:if>
                             </xsl:for-each>);
                         </xsl:when>
                         <xsl:otherwise>skel.<xsl:value-of select="@name"/>();</xsl:otherwise>
@@ -121,7 +85,7 @@
                     envelope = getSOAPFactory().getDefaultEnvelope();
                     //Create a Omelement of the result if a result exist
 
-                    <xsl:if test="$returntype!=''">envelope.getBody().setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$dbsupportname"/>.toOM(<xsl:value-of select="$returnvariable"/>));
+                    <xsl:if test="$returntype!=''">envelope.getBody().setFirstChild(toOM(<xsl:value-of select="$returnvariable"/>));
                     </xsl:if>
                 </xsl:when>
 
@@ -148,6 +112,117 @@
         <xsl:for-each select="method"/>
         }
 
+        <!-- generate the databind supporters-->
+        //<xsl:apply-templates/>
+
+        }
+    </xsl:template>
+
+     <!-- #################################################################################  -->
+    <!-- ############################   xmlbeans template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='xmlbeans']">
+
+        <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
+        <xsl:if test="$base64">
+            private static javax.xml.namespace.QName[] qNameArray = {
+            <xsl:for-each select="base64Elements/name">
+                <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
+            </xsl:for-each>
+            };
+        </xsl:if>
+
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+                public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
+                org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
+                (org.apache.axis2.om.OMAbstractFactory.getOMFactory(),new org.apache.axis2.util.StreamWrapper(param.newXMLStreamReader())) ;
+
+                <xsl:choose>
+                    <xsl:when test="$base64">
+                         org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement();
+                         optimizeContent(documentElement,qNameArray);
+                         return documentElement;
+                    </xsl:when>
+                    <xsl:otherwise>
+                        return  builder.getDocumentElement();
+                    </xsl:otherwise>
+                </xsl:choose>
+
+                }
+            </xsl:if>
+
+        </xsl:for-each>
+
+        public org.apache.xmlbeans.XmlObject fromOM(org.apache.axis2.om.OMElement param,
+        java.lang.Class type){
+        try{
+        <xsl:for-each select="param">
+            <xsl:if test="@type!=''">
+                if (<xsl:value-of select="@type"/>.class.equals(type)){
+                return <xsl:value-of select="@type"/>.Factory.parse(param.getXMLStreamReader()) ;
+                }
+            </xsl:if>
+        </xsl:for-each>
+        }catch(java.lang.Exception e){
+        throw new RuntimeException("Data binding error",e);
+        }
+        return null;
+        }
+
+    </xsl:template>
+
+    <!-- #################################################################################  -->
+    <!-- ############################   ADB template   ##############################  -->
+    <xsl:template match="databinders[@dbtype='adb']">
+
+         <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
+         <xsl:if test="$base64">
+             private static javax.xml.namespace.QName[] qNameArray = {
+             <xsl:for-each select="base64Elements/name">
+                 <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
+             </xsl:for-each>
+             };
+         </xsl:if>
+
+         <xsl:for-each select="param">
+             <xsl:if test="@type!=''">
+                 <!-- consider all the types to ADBbeans. So no instanceof check -->
+                 public  org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
+                 org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
+                 (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
+                 return builder.getDocumentElement();
+                 }
+             </xsl:if>
+         </xsl:for-each>
+
+         public  java.lang.Object fromOM(org.apache.axis2.om.OMElement param,
+         java.lang.Class type){
+              Object obj;
+             try {
+                 java.lang.reflect.Method parseMethod = type.getMethod("parse",new Class[]{javax.xml.stream.XMLStreamReader.class});
+                 obj = null;
+                 if (parseMethod!=null){
+                     obj = parseMethod.invoke(null,new Object[]{param.getXMLStreamReader()});
+                 }else{
+                     //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here
+                 }
+             } catch (Exception e) {
+                  throw new RuntimeException(e);
+             }
+
+             return obj;
+         }
+
+     </xsl:template>
+    <!-- #################################################################################  -->
+    <!-- ############################   none template!!!   ##############################  -->
+    <xsl:template match="databinders[@dbtype='none']">
+        public  org.apache.axis2.om.OMElement fromOM(org.apache.axis2.om.OMElement param, java.lang.Class type){
+           return param;
+        }
+
+        public  org.apache.axis2.om.OMElement  toOM(org.apache.axis2.om.OMElement param){
+            return param;
         }
     </xsl:template>
 </xsl:stylesheet>