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 aj...@apache.org on 2005/06/23 16:35:46 UTC

svn commit: r193149 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/clientapi/ wsdl/ wsdl/src/org/apache/axis/wsdl/codegen/ wsdl/src/org/apache/axis/wsdl/codegen/emitter/ wsdl/src/org/apache/axis/wsdl/codegen/extension/ wsdl/src/org...

Author: ajith
Date: Thu Jun 23 07:35:45 2005
New Revision: 193149

URL: http://svn.apache.org/viewcvs?rev=193149&view=rev
Log:
The following changes are made
1. XMLBeans is integrated to the code generator
 I.Codegen Engine is modified
 II.New templates and writers are added
 III. Emitter is modified
 IV. Stub is slightly modified
2.Project XML of the wsdl module is modified to download the XMLBeans jar file (Beware. This is over 2M!)

Added:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/DatabindingSupportClassWriter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/LocalTestClassWriter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/LocalTestClassTemplate.xsl
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl
Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
    webservices/axis/trunk/java/modules/wsdl/project.xml
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMapper.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java Thu Jun 23 07:35:45 2005
@@ -27,12 +27,17 @@
 import org.apache.axis.om.OMElement;
 import org.apache.axis.om.OMFactory;
 import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory;
 import org.apache.axis.soap.SOAPEnvelope;
 import org.apache.axis.soap.SOAPBody;
 import org.apache.axis.soap.SOAPFactory;
 import org.apache.axis.soap.impl.llom.SOAPProcessingException;
 import org.apache.wsdl.WSDLService;
 
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
+
 
 
 /**
@@ -116,32 +121,38 @@
         OMNamespace methodNamespace = fac.createOMNamespace(methodNamespaceURI,"ns1");
         OMElement elt =  fac.createOMElement(methodName,methodNamespace);
         if (paramNames!=null){
-        //find the relevant object here, convert it and add it to the elt
-        for (int i = 0; i < paramNames.length; i++) {
-            String paramName = paramNames[i];
-            Object value  = values[i];
-            elt.addChild(StubSupporter.createRPCMappedElement(paramName,
-                    fac.createOMNamespace("",null),//empty namespace
-                    value,
-                    fac));
-        }
+            //find the relevant object here, convert it and add it to the elt
+            for (int i = 0; i < paramNames.length; i++) {
+                String paramName = paramNames[i];
+                Object value  = values[i];
+                elt.addChild(StubSupporter.createRPCMappedElement(paramName,
+                        fac.createOMNamespace("",null),//empty namespace
+                        value,
+                        fac));
+            }
         }
         body.addChild(elt);
     }
 
 
-    protected void setValueDOC(SOAPEnvelope env,OMElement value){
-        SOAPBody body = env.getBody();
-        body.addChild(value);
+    protected OMElement getElementFromReader(XMLStreamReader reader) {
+        StAXOMBuilder builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(),reader) ;
+        return builder.getDocumentElement();
     }
 
+    protected void setValueDoc(SOAPEnvelope env,OMElement value){
+        if (value!=null){
+            SOAPBody body = env.getBody();
+            body.addChild(value);
+        }
+    }
 
-    protected Object getValue(SOAPEnvelope env,String type,Class outputType){
+    protected OMElement getElement(SOAPEnvelope env,String type){
         SOAPBody body = env.getBody();
         OMElement element = body.getFirstElement();
 
         if (WSDLService.STYLE_RPC.equals(type)){
-            return StubSupporter.getRPCMappedElementValue(element.getFirstElement(),outputType);
+            return element.getFirstElement(); //todo this needs to be fixed
         }else if (WSDLService.STYLE_DOC.equals(type)){
             return element;
         }else {
@@ -149,11 +160,25 @@
         }
 
     }
+
+//    protected Object getValue(SOAPEnvelope env,String type,Class outputType){
+//        SOAPBody body = env.getBody();
+//        OMElement element = body.getFirstElement();
+//
+//        if (WSDLService.STYLE_RPC.equals(type)){
+//            return StubSupporter.getRPCMappedElementValue(element.getFirstElement(),outputType);
+//        }else if (WSDLService.STYLE_DOC.equals(type)){
+//            return element;
+//        }else {
+//            throw new UnsupportedOperationException("Unsupported type");
+//        }
+//
+//    }
     /**
      * get the message context
      */
     protected MessageContext getMessageContext() throws AxisFault {
-            return new MessageContext(_configurationContext);
+        return new MessageContext(_configurationContext);
     }
 
 

Modified: webservices/axis/trunk/java/modules/wsdl/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/project.xml?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/project.xml (original)
+++ webservices/axis/trunk/java/modules/wsdl/project.xml Thu Jun 23 07:35:45 2005
@@ -72,5 +72,14 @@
                 <module>true</module>
             </properties>
         </dependency>
+	 <dependency>
+      	<groupId>xmlbeans</groupId>
+      	<artifactId>xbean</artifactId>
+      	<version>2.0.0-beta1</version>
+      	<type>jar</type>
+      	<properties>
+        		<module>true</module>
+      	</properties>
+    	 </dependency>	
 	</dependencies>
 </project>

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java Thu Jun 23 07:35:45 2005
@@ -20,6 +20,7 @@
 import java.util.Map;
 
 import org.apache.wsdl.WSDLDescription;
+import org.apache.axis.wsdl.databinding.TypeMapper;
 
 /**
  * @author chathura@opensource.lk
@@ -31,8 +32,10 @@
 	private CommandLineOptionParser parser;
 	private File outputLocation;
     private int outputLanguage = XSLTConstants.LanguageTypes.JAVA;
+    private int databindingType = XSLTConstants.DataBindingTypes.XML_BEANS; //default is XML beans
     private boolean advancedCodeGenEnabled=false;
 
+
     private boolean asyncOn=true;
     private boolean syncOn=true;
     private boolean serverSide=false;
@@ -41,6 +44,24 @@
     private boolean writeMessageReceiver = true;
     private String packageName=XSLTConstants.DEFAULT_PACKAGE_NAME;
 
+
+    private TypeMapper typeMapper;
+
+    public TypeMapper getTypeMapper() {
+        return typeMapper;
+    }
+
+    public void setTypeMapper(TypeMapper typeMapper) {
+        this.typeMapper = typeMapper;
+    }
+
+    public int getDatabindingType() {
+        return databindingType;
+    }
+
+    public void setDatabindingType(int databindingType) {
+        this.databindingType = databindingType;
+    }
 
 	/**
 	 * @param wom

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java Thu Jun 23 07:35:45 2005
@@ -32,6 +32,8 @@
 import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
 import org.apache.axis.wsdl.codegen.extension.CodeGenExtention;
 import org.apache.axis.wsdl.codegen.extension.PackageFinder;
+import org.apache.axis.wsdl.codegen.extension.XMLBeansExtension;
+import org.apache.axis.wsdl.databinding.TypeMapper;
 import org.apache.wsdl.WSDLDescription;
 
 /**
@@ -68,26 +70,32 @@
         AxisBindingBuilder axisBindingBuilder = new AxisBindingBuilder();
         axisBindingBuilder.init(this.configuration);
         axisBindingBuilder.engage();
+
         PackageFinder packageFinder = new PackageFinder();
         packageFinder.init(this.configuration);
         this.moduleEndpoints.add(packageFinder);
 
+        XMLBeansExtension xmlBeanExtension = new XMLBeansExtension();
+        xmlBeanExtension.init(this.configuration);
+        this.moduleEndpoints.add(xmlBeanExtension);
     }
 
 
     public void generate()throws CodeGenerationException{
+
         for(int i = 0; i< this.moduleEndpoints.size(); i++){
             ((CodeGenExtention)this.moduleEndpoints.get(i)).engage();
         }
 
-        Emitter clientEmitter = null;
+        Emitter emitter = null;
+        TypeMapper mapper = configuration.getTypeMapper();
 
         switch (configuration.getOutputLanguage()){
             case XSLTConstants.LanguageTypes.JAVA:
-                clientEmitter =  new JavaEmitter(this.configuration);
+                emitter =  new JavaEmitter(this.configuration,mapper);
                 break;
             case XSLTConstants.LanguageTypes.C_SHARP:
-                clientEmitter = new CSharpEmitter(this.configuration);
+                emitter = new CSharpEmitter(this.configuration,mapper);
                 break;
             case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
             case XSLTConstants.LanguageTypes.VB_DOT_NET:
@@ -97,9 +105,9 @@
 
         }
         if (this.configuration.isServerSide())
-            clientEmitter.emitSkeleton();
+            emitter.emitSkeleton();
         else
-            clientEmitter.emitStub();
+            emitter.emitStub();
 
 
     }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java Thu Jun 23 07:35:45 2005
@@ -31,6 +31,12 @@
         public static final int VB_DOT_NET=4;
     }
 
+      public interface DataBindingTypes{
+
+        public static final int XML_BEANS=1;
+        public static final int JAXB=2;
+
+    }
     /**
      * Interface templates
      */
@@ -77,7 +83,17 @@
     	public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl";
     	public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/TestClassTemplate.xsl";
     }
-    
+
+     public interface XSLTDatabindingSupporterTemplates{
+    	public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl";
+    	//public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/TestClassTemplate.xsl";
+    }
+
+    public interface XSLTLocalTestClassTemplates{
+    	public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl";
+    	public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/LocalTestClassTemplate.xsl";
+    }
+
     public interface XSLTTestSkeltonImplTemplates{
     	public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/TestSkeletonImplTemplate.xsl";
     }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Thu Jun 23 07:35:45 2005
@@ -24,6 +24,8 @@
 import org.apache.axis.wsdl.codegen.writer.TestClassWriter;
 import org.apache.axis.wsdl.codegen.writer.TestServiceXMLWriter;
 import org.apache.axis.wsdl.codegen.writer.TestSkeltonImplWriter;
+import org.apache.axis.wsdl.codegen.writer.LocalTestClassWriter;
+import org.apache.axis.wsdl.codegen.writer.DatabindingSupportClassWriter;
 import org.apache.axis.wsdl.databinding.TypeMapper;
 import org.apache.crimson.tree.XmlDocument;
 import org.apache.wsdl.WSDLBinding;
@@ -78,8 +80,11 @@
     private static final String CALL_BACK_HANDLER_SUFFIX = "CallbackHandler";
     private static final String STUB_SUFFIX = "Stub";
     private static final String TEST_SUFFIX = "Test";
+    private static final String LOCAL_TEST_SUFFIX = "LocalTest";
     private static final String SERVICE_CLASS_SUFFIX ="Skeleton";
     private static final String TEST_PACKAGE_NAME_SUFFIX =".test";
+    private static final String DATABINDING_SUPPORTER_NAME_SUFFIX ="DatabindingSupporter";
+    private static final String DATABINDING_PACKAGE_NAME_SUFFIX =".databinding";
     private static final String TEST_SERVICE_CLASS_NAME_SUFFIX ="SkeletonTest";
     private static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver";
     
@@ -132,19 +137,21 @@
             writeCallBackHandlers(axisBinding);
             //write the test classes
             writeTestClasses(axisBinding);
+            //write the databinding supporters
+            writeDatabindingSupporters(axisBinding);
             //write a dummy implementation call for the tests to run.
-            writeTestSkeletonImpl(axisBinding);
+            //writeTestSkeletonImpl(axisBinding);
             //write a testservice.xml that will load the dummy skeleton impl for testing
-            writeTestServiceXML(axisBinding);
+            //writeTestServiceXML(axisBinding);
         } catch (Exception e) {
             e.printStackTrace();
             throw new CodeGenerationException(e);
         }
     }
-    
-    
+
+
     protected void writeTestSkeletonImpl(WSDLBinding binding)throws Exception{
-    	if (configuration.isWriteTestCase()){
+        if (configuration.isWriteTestCase()){
             XmlDocument classModel = createDocumentForTestSkeltonImpl(binding);
             TestSkeltonImplWriter callbackWriter =
                     new TestSkeltonImplWriter(this.configuration.getOutputLocation(),
@@ -153,7 +160,7 @@
             writeClass(classModel,callbackWriter);
         }
     }
-    
+
     /**
      *
      */
@@ -171,6 +178,24 @@
     }
 
     /**
+     * Write the local test classes. these test classes are different from the
+     * usual test classes because it is meant to work with the generated test
+     * skeleton class.
+     * @param binding
+     * @throws Exception
+     */
+    protected void writeLocalTestClasses(WSDLBinding binding) throws Exception{
+
+        if (configuration.isWriteTestCase()){
+            XmlDocument classModel = createDOMDocuementForLocalTestCase(binding);
+            LocalTestClassWriter callbackWriter =
+                    new LocalTestClassWriter(this.configuration.getOutputLocation(),
+                            this.configuration.getOutputLanguage()
+                    );
+            writeClass(classModel,callbackWriter);
+        }
+    }
+    /**
      *
      */
     protected void writeTestClasses(WSDLBinding binding) throws Exception{
@@ -215,9 +240,26 @@
 
 
     }
-    
-    
-	
+
+    /**
+     * Writes the skeleton
+     * @param axisBinding
+     * @throws Exception
+     */
+    protected void writeDatabindingSupporters(WSDLBinding axisBinding) throws Exception {
+        Collection col = axisBinding.getBoundInterface().getOperations().values();
+        for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+            //Note -  there will be a supporter generated per method and will contain the methods to serilize and
+            //deserilize the relevant objects
+            XmlDocument databindingSupporterModel = createDOMDocumentforSerialization((WSDLOperation)iterator.next());
+            ClassWriter databindingSupportWriter = new DatabindingSupportClassWriter(this.configuration.getOutputLocation(),
+                    this.configuration.getOutputLanguage(),this.configuration.getDatabindingType()
+            );
+            writeClass(databindingSupporterModel,databindingSupportWriter);
+        }
+
+    }
+
     protected void writeTestServiceXML(WSDLBinding axisBinding) throws Exception {
         if (this.configuration.isWriteTestCase()){
             //Note -  One can generate the service xml using the interface XML
@@ -305,9 +347,6 @@
                 model.getDocumentElement().getAttribute("name"));
         writer.writeOutFile(new ByteArrayInputStream(memoryStream.toByteArray()));
     }
-    
-    
-
 
     /**
      * @see org.apache.axis.wsdl.codegen.emitter.Emitter#emitSkeleton()
@@ -322,6 +361,8 @@
             writeServiceXml(axisBinding);
             //write the test classes
             writeTestClasses(axisBinding);
+            //write the local test classes
+            writeLocalTestClasses(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
@@ -334,10 +375,8 @@
         }
     }
 
-     
-    
     protected XmlDocument createDocumentForTestSkeltonImpl(WSDLBinding binding){
-    	WSDLInterface boundInterface = binding.getBoundInterface();
+        WSDLInterface boundInterface = binding.getBoundInterface();
 
         XmlDocument doc = new XmlDocument();
         Element rootElement = doc.createElement("class");
@@ -351,7 +390,7 @@
         doc.appendChild(rootElement);
         return doc;
     }
-    
+
     /**
      * Generating the callbacks
      * @param binding
@@ -381,17 +420,19 @@
      */
     protected Element getInputElement(XmlDocument doc,WSDLOperation operation){
         Element inputElt = doc.createElement("input");
-        //todo this should be multiple
+        Element param = getInputParamElement(doc, operation);
+        inputElt.appendChild(param);
+        return inputElt;
+    }
+
+    private Element getInputParamElement(XmlDocument doc, WSDLOperation operation) {
+        //todo this should go in a loop
         Element param = doc.createElement("param");
         addAttribute(doc,"name",this.mapper.getParameterName(operation.getInputMessage().getElement()),param);
-
-        Class typeMapping = this.mapper.getTypeMapping(operation.getInputMessage().getElement());
-        String typeMappingStr  =typeMapping==null?"":typeMapping.getName();
+        String typeMapping = this.mapper.getTypeMapping(operation.getInputMessage().getElement());
+        String typeMappingStr  =typeMapping==null?"":typeMapping;
         addAttribute(doc,"type",typeMappingStr,param);
-
-        inputElt.appendChild(param);
-
-        return inputElt;
+        return param;
     }
 
     /**
@@ -402,15 +443,19 @@
      */
     protected Element getOutputElement(XmlDocument doc,WSDLOperation operation){
         Element outputElt = doc.createElement("output");
+        Element param = getOutputParamElement(doc, operation);
+        outputElt.appendChild(param);
+        return outputElt;
+    }
+
+    private Element getOutputParamElement(XmlDocument doc, WSDLOperation operation) {
         Element param = doc.createElement("param");
         addAttribute(doc,"name",this.mapper.getParameterName(operation.getOutputMessage().getElement()),param);
 
-        Class typeMapping = this.mapper.getTypeMapping(operation.getOutputMessage().getElement());
-        String typeMappingStr=typeMapping==null?"":typeMapping.getName();
+        String typeMapping = this.mapper.getTypeMapping(operation.getOutputMessage().getElement());
+        String typeMappingStr=typeMapping==null?"":typeMapping;
         addAttribute(doc,"type",typeMappingStr,param);
-        outputElt.appendChild(param);
-
-        return outputElt;
+        return param;
     }
 
     /**
@@ -422,16 +467,16 @@
     }
 
     protected XmlDocument createDOMDocuementForServiceXML(WSDLBinding binding, boolean forTesting) {
-    	WSDLInterface boundInterface = binding.getBoundInterface();
+        WSDLInterface boundInterface = binding.getBoundInterface();
 
         XmlDocument doc = new XmlDocument();
         Element rootElement = doc.createElement("interface");
         if(forTesting){
-        	addAttribute(doc,"package",configuration.getPackageName()+TEST_PACKAGE_NAME_SUFFIX, rootElement);
-	        addAttribute(doc,"name",boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX,rootElement);
-        }else{        
-	        addAttribute(doc,"package",configuration.getPackageName(), rootElement);
-	        addAttribute(doc,"name",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
+            addAttribute(doc,"package",configuration.getPackageName()+TEST_PACKAGE_NAME_SUFFIX, rootElement);
+            addAttribute(doc,"name",boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX,rootElement);
+        }else{
+            addAttribute(doc,"package",configuration.getPackageName(), rootElement);
+            addAttribute(doc,"name",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
         }
         addAttribute(doc,"servicename",boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX,rootElement);
         fillSyncAttributes(doc, rootElement);
@@ -474,9 +519,9 @@
         Element rootElement = doc.createElement("interface");
         addAttribute(doc,"package",configuration.getPackageName(), rootElement);
         if(this.configuration.isServerSide()){
-        	addAttribute(doc,"name",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
+            addAttribute(doc,"name",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
         }else{
-        	addAttribute(doc,"name",boundInterface.getName().getLocalPart(),rootElement);
+            addAttribute(doc,"name",boundInterface.getName().getLocalPart(),rootElement);
         }
         addAttribute(doc,"callbackname",boundInterface.getName().getLocalPart() + CALL_BACK_HANDLER_SUFFIX,rootElement);
         fillSyncAttributes(doc, rootElement);
@@ -503,8 +548,11 @@
         for (Iterator iterator = col.iterator(); iterator.hasNext();) {
             operation = (WSDLOperation) iterator.next();
             methodElement = doc.createElement("method");
-            addAttribute(doc,"name",removeUnsuitableCharacters(operation.getName().getLocalPart()),methodElement);
+            String localPart = operation.getName().getLocalPart();
+            addAttribute(doc,"name",localPart,methodElement);
             addAttribute(doc,"namespace",operation.getName().getNamespaceURI(),methodElement);
+            addAttribute(doc,"style",operation.getStyle(),methodElement);
+            addAttribute(doc,"dbsupportname",localPart+DATABINDING_SUPPORTER_NAME_SUFFIX,methodElement);
             methodElement.appendChild(getInputElement(doc,operation));
             methodElement.appendChild(getOutputElement(doc,operation));
             rootElement.appendChild(methodElement);
@@ -516,12 +564,32 @@
 
         XmlDocument doc = new XmlDocument();
         Element rootElement = doc.createElement("class");
+        addAttribute(doc,"package",configuration.getPackageName(),rootElement);
+        String localPart = boundInterface.getName().getLocalPart();
+        addAttribute(doc,"name",localPart+TEST_SUFFIX,rootElement);
+        addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
+        addAttribute(doc,"interfaceName",localPart,rootElement);
+        addAttribute(doc,"callbackname",localPart + CALL_BACK_HANDLER_SUFFIX,rootElement);
+        addAttribute(doc,"stubname",localPart + STUB_SUFFIX,rootElement);
+        addAttribute(doc,"dbsupportpackage",configuration.getPackageName()+DATABINDING_PACKAGE_NAME_SUFFIX,rootElement);
+        fillSyncAttributes(doc, rootElement);
+        loadOperations(boundInterface, doc, rootElement);
+        doc.appendChild(rootElement);        
+        return doc;
+
+    }
+
+    protected XmlDocument createDOMDocuementForLocalTestCase(WSDLBinding binding) {
+        WSDLInterface boundInterface = binding.getBoundInterface();
+
+        XmlDocument doc = new XmlDocument();
+        Element rootElement = doc.createElement("class");
         String serviceXMLPath = configuration.getPackageName().replace('.','/')+TEST_PACKAGE_NAME_SUFFIX.replace('.','/')+"/testservice.xml";
         addAttribute(doc,"package",configuration.getPackageName()+TEST_PACKAGE_NAME_SUFFIX,rootElement);
         addAttribute(doc, "servicexmlpath", serviceXMLPath, rootElement);
         addAttribute(doc, "implpackage", configuration.getPackageName(), rootElement);
         String localPart = boundInterface.getName().getLocalPart();
-        addAttribute(doc,"name",localPart+TEST_SUFFIX,rootElement);
+        addAttribute(doc,"name",localPart+LOCAL_TEST_SUFFIX,rootElement);
         addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
         addAttribute(doc,"interfaceName",localPart,rootElement);
         addAttribute(doc,"callbackname",localPart + CALL_BACK_HANDLER_SUFFIX,rootElement);
@@ -529,11 +597,24 @@
         addAttribute(doc, "address", "http://localhost:"+Constants.TEST_PORT+"/services/"+boundInterface.getName().getLocalPart()+TEST_SERVICE_CLASS_NAME_SUFFIX, rootElement);
         fillSyncAttributes(doc, rootElement);
         loadOperations(boundInterface, doc, rootElement);
-        doc.appendChild(rootElement);        
+        doc.appendChild(rootElement);
         return doc;
 
     }
 
+    protected XmlDocument createDOMDocumentforSerialization(WSDLOperation operation){
+        XmlDocument doc = new XmlDocument();
+        Element rootElement = doc.createElement("class");
+        addAttribute(doc,"package",configuration.getPackageName()+DATABINDING_PACKAGE_NAME_SUFFIX,rootElement);
+        String localPart =operation.getName().getLocalPart();
+        addAttribute(doc,"name",localPart+DATABINDING_SUPPORTER_NAME_SUFFIX,rootElement);
+        addAttribute(doc,"methodname",localPart,rootElement);
+        addAttribute(doc,"namespace",operation.getName().getNamespaceURI(),rootElement);
+        rootElement.appendChild(getInputParamElement(doc,operation));
+        rootElement.appendChild(getOutputParamElement(doc,operation));
+        doc.appendChild(rootElement);
+        return doc;
+    }
 
     /**
      * Creates the DOM tree for implementations
@@ -554,12 +635,11 @@
         addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
         addAttribute(doc,"interfaceName",localPart,rootElement);
         addAttribute(doc,"callbackname",localPart + CALL_BACK_HANDLER_SUFFIX,rootElement);
-//        addAttribute(doc,"testcase",localPart + TEST_SUFFIX,rootElement);
+        addAttribute(doc,"dbsupportpackage",configuration.getPackageName()+DATABINDING_PACKAGE_NAME_SUFFIX,rootElement);
         addEndpoints(doc,rootElement,endpoints);
         fillSyncAttributes(doc, rootElement);
         loadOperations(boundInterface, doc, rootElement);
         doc.appendChild(rootElement);
-
         return doc;
 
     }
@@ -577,7 +657,7 @@
             while(iterator.hasNext())  {
                 WSDLExtensibilityElement element = (WSDLExtensibilityElement)iterator.next();
                 if (element.getType().equals(ExtensionConstants.SOAP_ADDRESS)){
-                   address = (org.apache.wsdl.extensions.SOAPAddress)element;
+                    address = (org.apache.wsdl.extensions.SOAPAddress)element;
                 }
             }
             text = doc.createTextNode(address.getLocationURI());     //todo How to get the end point address

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java?rev=193149&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/extension/XMLBeansExtension.java Thu Jun 23 07:35:45 2005
@@ -0,0 +1,111 @@
+package org.apache.axis.wsdl.codegen.extension;
+
+import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis.wsdl.databinding.JavaTypeMapper;
+import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlBeans;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.BindingConfig;
+import org.apache.xmlbeans.Filer;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.wsdl.extensions.DefaultExtensibilityElement;
+import org.apache.wsdl.extensions.ExtensionConstants;
+import org.apache.wsdl.extensions.Schema;
+import org.apache.wsdl.WSDLExtensibilityElement;
+import org.w3c.dom.Element;
+
+import javax.wsdl.extensions.ExtensibilityElement;
+import java.io.File;
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.FileOutputStream;
+import java.io.Writer;
+import java.io.FileWriter;
+import java.util.List;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+public class XMLBeansExtension extends AbstractCodeGenerationExtension implements CodeGenExtention {
+    private static final String DEFUALT_STS_NAME = "foo";
+
+
+    public void init(CodeGenConfiguration configuration) {
+        this.configuration = configuration;
+    }
+
+    public void engage() {
+        List typesArray = configuration.getWom().getTypes().getExtensibilityElements();
+        WSDLExtensibilityElement extensiblityElt = null;
+        XmlObject[] xmlObjects=new XmlObject[typesArray.size()];
+
+        for (int i = 0; i < typesArray.size(); i++) {
+            extensiblityElt =  (WSDLExtensibilityElement)typesArray.get(i);
+            if (ExtensionConstants.SCHEMA.equals(extensiblityElt.getType())) {
+                try {
+                    xmlObjects[i] = XmlObject.Factory.parse(((Schema)extensiblityElt).getElelment());
+                } catch (XmlException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+
+        final File outputFolder =  configuration.getOutputLocation();
+
+        try {
+            SchemaTypeSystem sts = XmlBeans.compileXmlBeans(DEFUALT_STS_NAME, null,
+                    xmlObjects,
+                    new BindingConfig(), XmlBeans.getContextTypeLoader(),
+                    new Filer() {
+                        public OutputStream createBinaryFile(String typename)
+                                throws IOException {
+                            File file = new File(outputFolder,typename);
+                            file.getParentFile().mkdirs();
+                            file.createNewFile();
+                            return new FileOutputStream(file);
+                        }
+
+                        public Writer createSourceFile(String typename)
+                                throws IOException {
+                            typename = typename.replace('.',File.separatorChar);
+                            File file = new File(outputFolder,typename+".java");
+                            file.getParentFile().mkdirs();
+                            file.createNewFile();
+                            return new FileWriter(file);
+                        }
+                    }, null);
+
+            //create the type mapper
+            JavaTypeMapper mapper = new JavaTypeMapper();
+            SchemaType[] types= sts.documentTypes();
+
+            for (int i= 0; i < types.length; i++){
+                //System.out.println("type name = " + types[i].getFullJavaImplName()+" "+types[i].getDocumentElementName());
+                mapper.addTypeMapping(types[i].getDocumentElementName(), types[i].getFullJavaName());
+            }
+            //set the type mapper to the config
+            configuration.setTypeMapper(mapper);
+
+        } catch (XmlException e) {
+           throw new RuntimeException(e);
+        }
+
+    }
+
+
+}

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/DatabindingSupportClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/DatabindingSupportClassWriter.java?rev=193149&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/DatabindingSupportClassWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/DatabindingSupportClassWriter.java Thu Jun 23 07:35:45 2005
@@ -0,0 +1,59 @@
+package org.apache.axis.wsdl.codegen.writer;
+
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+import java.io.File;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+public class DatabindingSupportClassWriter extends ClassWriter {
+
+    private int databindingFramework=0;
+
+    public DatabindingSupportClassWriter(String outputFileLocation) {
+        this.outputFileLocation = new File(outputFileLocation);
+    }
+
+    public DatabindingSupportClassWriter(File outputFileLocation,int language,int databindingFramework) {
+        this.outputFileLocation = outputFileLocation;
+        this.language = language;
+        this.databindingFramework = databindingFramework;
+    }
+
+    public void setDatabindingFramework(int databindingFramework) {
+        this.databindingFramework = databindingFramework;
+    }
+
+    public void loadTemplate() {
+        if (this.databindingFramework==XSLTConstants.DataBindingTypes.XML_BEANS){
+            Class clazz = this.getClass();
+            switch (language){
+                case XSLTConstants.LanguageTypes.JAVA:
+                    this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTDatabindingSupporterTemplates.JAVA_TEMPLATE);
+                    break;
+                case XSLTConstants.LanguageTypes.C_SHARP:
+                case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
+                case XSLTConstants.LanguageTypes.VB_DOT_NET:
+                default:
+                    throw new UnsupportedOperationException();
+            }
+        }else{
+            throw new UnsupportedOperationException("Unsupported Data binding Framework!");
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/LocalTestClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/LocalTestClassWriter.java?rev=193149&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/LocalTestClassWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/LocalTestClassWriter.java Thu Jun 23 07:35:45 2005
@@ -0,0 +1,49 @@
+package org.apache.axis.wsdl.codegen.writer;
+
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+import java.io.File;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * 
+ */
+public class LocalTestClassWriter extends ClassWriter{
+
+     public LocalTestClassWriter(String outputFileLocation) {
+        this.outputFileLocation = new File(outputFileLocation);
+    }
+
+    public LocalTestClassWriter(File outputFileLocation,int language) {
+        this.outputFileLocation = outputFileLocation;
+        this.language = language;
+    }
+      public void loadTemplate() {
+        Class clazz = this.getClass();
+        switch (language){
+            case XSLTConstants.LanguageTypes.JAVA:
+                this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTLocalTestClassTemplates.JAVA_TEMPLATE);
+                break;
+            case XSLTConstants.LanguageTypes.C_SHARP:
+                this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTLocalTestClassTemplates.CSHARP_TEMPLATE);
+                break;
+            case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
+            case XSLTConstants.LanguageTypes.VB_DOT_NET:
+            default:
+                throw new UnsupportedOperationException();
+        }
+    }
+}

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/JavaTypeMapper.java Thu Jun 23 07:35:45 2005
@@ -60,4 +60,7 @@
        this.map.put(new QName(XSD_SCHEMA_URL,"QName"),QName.class);
     }
 
+    public String toString() {
+        return this.map.toString();
+    }
 }

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMapper.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMapper.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMapper.java Thu Jun 23 07:35:45 2005
@@ -41,7 +41,7 @@
      * @param qname name of the XML element to be mapped
      * @return a class that represents the particualr type
      */
-    public Class getTypeMapping(QName qname);
+    public String getTypeMapping(QName qname);
 
     /**
      * Get the parameter name

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/databinding/TypeMappingAdapter.java Thu Jun 23 07:35:45 2005
@@ -36,13 +36,13 @@
      *
      * @see TypeMapper#getTypeMapping(javax.xml.namespace.QName)
      */
-    public Class getTypeMapping(QName qname) {
+    public String getTypeMapping(QName qname) {
         if ((qname!=null)){
             Object o = map.get(qname);
             if (o!=null){
-               return (Class)o;
+               return (String)o;
             }else{
-                return OMElement.class;
+                return "java.lang.Object";
             }
         }
 

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl Thu Jun 23 07:35:45 2005
@@ -3,7 +3,12 @@
     <xsl:template match="/interface">
     <xsl:comment>Auto generated Axis Service XML</xsl:comment>
     <service><xsl:attribute name="name"><xsl:value-of select="@servicename"/></xsl:attribute>
-    <parameter name="ServiceClass" locked="xsd:false"><xsl:value-of select="@package"/>.<xsl:value-of select="@name"/></parameter>
+    <parameter name="ServiceClass" locked="xsd:false">
+        <xsl:choose>
+            <xsl:when test="@package=''"><xsl:value-of select="@name"/></xsl:when>
+            <xsl:otherwise> <xsl:value-of select="@package"/>.<xsl:value-of select="@name"/></xsl:otherwise>
+        </xsl:choose>
+       </parameter>
     <xsl:for-each select="method">
          <xsl:comment>Mounting the method <xsl:value-of select="@name"/> </xsl:comment>
          <operation><xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute></operation>

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl Thu Jun 23 07:35:45 2005
@@ -6,6 +6,7 @@
     <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>
     package <xsl:value-of select="$package"/>;
 
     /*
@@ -39,7 +40,7 @@
 
            this.toEPR = new org.apache.axis.addressing.EndpointReference(org.apache.axis.addressing.AddressingConstants.WSA_TO,targetEndpoint);
 		    //creating the configuration
-           _configurationContext = new org.apache.axis.context.ConfigurationContextFactory().buildClientEngineContext(axis2Home);
+           _configurationContext = new org.apache.axis.context.ConfigurationContextFactory().buildClientConfigurationContext(axis2Home);
             _configurationContext.getAxisConfiguration().addService(_service);
            _serviceContext = _configurationContext.createServiceContext(_service.getName());
 
@@ -56,8 +57,10 @@
 
      <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="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
          <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
+         <xsl:variable name="dbsupportclassname"><xsl:value-of select="@dbsupportname"></xsl:value-of></xsl:variable>  
 
          <!-- When genrating code, the MEP should be taken into account    -->
 
@@ -74,33 +77,67 @@
             _call.setTo(toEPR);
             org.apache.axis.soap.SOAPEnvelope env = null;
             env = createEnvelope();
+              //create a databinder
+            <xsl:variable name="fullsupporterclassname"><xsl:value-of select="$dbpackage"/>.<xsl:value-of select="$dbsupportclassname"/></xsl:variable>
+            <xsl:value-of select="$fullsupporterclassname"/> databindSupporter = new <xsl:value-of select="$fullsupporterclassname"/>();
+
              <xsl:choose>
               <xsl:when test="$inputtype!=''">
-                setValueRPC(env,
+                  <xsl:choose>
+
+                      <xsl:when test="$style='rpc'">
+                       // Style is RPC
+                             setValueRPC(env,
                             "<xsl:value-of select="@namespace"/>",
                             "<xsl:value-of select="@name"/>",
                             new String[]{"<xsl:value-of select="$inputparam"/>"},
-                            new Object[]{<xsl:value-of select="$inputparam"/>});     //fix this - code is RPC only
+                            new Object[]{<xsl:value-of select="$inputparam"/>});  //this needs to be fixed
+                      </xsl:when>
+
+                      <xsl:when test="$style='doc'">
+                       //Style is Doc
+                       setValueDoc(env,databindSupporter.toOM(<xsl:value-of select="$inputparam"/>));
+                      </xsl:when>
+                      <xsl:otherwise>
+                       //Unknown style!! No code is generated
+                       throw java.lang.UnsupportedOperationException("Unknown Style");
+                      </xsl:otherwise>
+                  </xsl:choose>
               </xsl:when>
               <xsl:otherwise>
-               setValueRPC(env,
+                   <xsl:choose>
+                   <xsl:when test="$style='rpc'">
+                       //Style is RPC. No input parameters
+                          setValueRPC(env,
                             "<xsl:value-of select="@namespace"/>",
                             "<xsl:value-of select="@name"/>",
                             null,
-                            null);     //fix this - code is RPC only
+                            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=''">
-                    _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
-                    return;
-                 </xsl:when>
-                 <xsl:otherwise>
+               _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+               return;
+              </xsl:when>
+              <xsl:otherwise>
              org.apache.axis.context.MessageContext  _returnMessageContext = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
              org.apache.axis.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
-             <!-- todo this needs to be fixed -->
-             return (<xsl:value-of select="$outputtype"/>)getValue(_returnEnv,"rpc",<xsl:value-of select="$outputtype"/>.class);
+             java.lang.Object object = databindSupporter.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>
 
@@ -117,23 +154,50 @@
              org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_serviceContext);<!-- this needs to change -->
  		     org.apache.axis.context.MessageContext _messageContext = getMessageContext();
              _call.setTo(toEPR);
-             org.apache.axis.soap.SOAPEnvelope env = null;
+             org.apache.axis.soap.SOAPEnvelope env = createEnvelope();
              <xsl:choose>
               <xsl:when test="$inputtype!=''">
-                env = createEnvelope();
-                setValueRPC(env,
+              <xsl:choose>
+               <xsl:when test="$style='rpc'">
+                       // Style is RPC
+                             setValueRPC(env,
                             "<xsl:value-of select="@namespace"/>",
                             "<xsl:value-of select="@name"/>",
                             new String[]{"<xsl:value-of select="$inputparam"/>"},
                             new Object[]{<xsl:value-of select="$inputparam"/>});
+                      </xsl:when>
+                      <!-- The follwing code is specific to XML beans-->
+                      <xsl:when test="$style='doc'">
+                       //Style is Doc
+                       setValueDoc(env,getElementFromReader(<xsl:value-of select="$inputparam"/>.newXMLStreamReader()));
+                      </xsl:when>
+                      <xsl:otherwise>
+                          //Unknown style!! No code is generated
+                          throw UnsupportedOperationException("Unknown Style");
+                      </xsl:otherwise>
+                  </xsl:choose>
               </xsl:when>
               <xsl:otherwise>
-                env = createEnvelope();
-                setValueRPC(env,
+                   <xsl:choose>
+                   <xsl:when test="$style='rpc'">
+                       //Style is RPC. No input parameters
+                          setValueRPC(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);

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/LocalTestClassTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/LocalTestClassTemplate.xsl?rev=193149&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/LocalTestClassTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/LocalTestClassTemplate.xsl Thu Jun 23 07:35:45 2005
@@ -0,0 +1,165 @@
+<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="implpackage"><xsl:value-of select="@implpackage"/></xsl:variable>
+    <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+    <xsl:variable name="stubname"><xsl:value-of select="@stubname"/></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="address"><xsl:value-of select="@address"/></xsl:variable>
+    <xsl:variable name="servicexmlpath"><xsl:value-of select="@servicexmlpath"/></xsl:variable>
+    package <xsl:value-of select="$package"/>;
+    
+	import java.io.InputStream;
+	import java.net.ServerSocket;
+
+	import javax.xml.namespace.QName;
+	
+	import org.apache.axis.context.ConfigurationContext;
+	import org.apache.axis.deployment.DeploymentEngine;
+	import org.apache.axis.description.ServiceDescription;
+	import org.apache.axis.engine.AxisConfiguration;
+	import org.apache.axis.wsdl.codegen.Constants;
+	import org.apache.axis.om.OMAbstractFactory;
+	import org.apache.axis.om.OMElement;
+	import org.apache.axis.om.OMFactory;
+	import org.apache.axis.om.impl.llom.OMTextImpl;
+	import org.apache.axis.transport.http.SimpleHTTPServer;
+
+
+    /*
+     *  Auto generated Junit test case by the Axis code generator
+    */
+
+    public class <xsl:value-of select="@name"/> extends junit.framework.TestCase{
+    
+    
+    private static int count = 0;
+	private static SimpleHTTPServer server;
+	
+	public void setUp() throws Exception {
+		if (count == 0) {
+			DeploymentEngine deploymentEngine = new DeploymentEngine(System
+					.getProperty("user.dir"));
+			AxisConfiguration axisConfig = deploymentEngine.load();
+			ClassLoader classLoader = this.getClass().getClassLoader();
+			classLoader.getResource("<xsl:value-of select="$implpackage"/>.<xsl:value-of select="$interfaceName"/>");
+			classLoader.getResource("<xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>");
+			ClassLoader cl = Thread.currentThread().getContextClassLoader();
+			InputStream in = cl
+					.getResourceAsStream("<xsl:value-of select="$servicexmlpath"/>");
+			ServiceDescription service = new ServiceDescription();
+			deploymentEngine.buildService(service, in, classLoader);
+			
+			ConfigurationContext configurationContext = new ConfigurationContext(
+					axisConfig);
+			ServerSocket serverSoc = null;
+			serverSoc = new ServerSocket(Constants.TEST_PORT);
+			server = new SimpleHTTPServer(
+					configurationContext, serverSoc);
+			Thread thread = new Thread(server);
+			thread.setDaemon(true);
+
+			try {
+				thread.start();
+				System.out.print("Server started on port "
+						+ Constants.TEST_PORT + ".....");
+			} finally {
+
+			}
+		}
+		count++;
+	}
+
+	 protected void tearDown() throws Exception {
+	 	 if (count == 1) {
+            server.stop();
+            count = 0;
+            System.out.print("Server stopped .....");
+        } else {
+            count--;
+        }
+    }
+
+
+     <xsl:for-each select="method">
+         <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+         <xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
+         <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
+         <xsl:if test="$isSync='1'">
+
+        /**
+         * Auto generated test method
+         */
+        public  void test<xsl:value-of select="@name"/>() throws java.lang.Exception{
+
+        <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>(".","<xsl:value-of select="$address"/>/<xsl:value-of select="@name"/>");
+           <xsl:choose>
+             <xsl:when test="$inputtype!=''">
+               assertNotNull(stub.<xsl:value-of select="@name"/>(
+                                (<xsl:value-of select="$inputtype"/>)createTestInput(<xsl:value-of select="$inputtype"/>.class)));//this should come as a type
+              </xsl:when>
+              <xsl:otherwise>
+               // assertNotNull(stub.<xsl:value-of select="@name"/>());
+             </xsl:otherwise>
+            </xsl:choose>
+
+
+
+        }
+        </xsl:if>
+        <xsl:if test="$isAsync='1'">
+            <xsl:variable name="tempCallbackName">tempCallback<xsl:value-of select="generate-id()"/></xsl:variable>
+         /**
+         * Auto generated test method
+         */
+        public  void testStart<xsl:value-of select="@name"/>() throws java.lang.Exception{
+            <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>();
+             <xsl:choose>
+             <xsl:when test="$inputtype!=''">
+                stub.start<xsl:value-of select="@name"/>(
+                   (<xsl:value-of select="$inputtype"/>)createTestInput(<xsl:value-of select="$inputtype"/>.class),
+                    new <xsl:value-of select="$tempCallbackName"/>()
+                );
+              </xsl:when>
+              <xsl:otherwise>
+                stub.start<xsl:value-of select="@name"/>(
+                    new <xsl:value-of select="$tempCallbackName"/>()
+                );
+             </xsl:otherwise>
+            </xsl:choose>
+
+
+        }
+
+        private class <xsl:value-of select="$tempCallbackName"/>  extends <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$callbackname"/>{
+            public <xsl:value-of select="$tempCallbackName"/>(){ super(null);}
+
+            public void receiveResult<xsl:value-of select="@name"/>(org.apache.axis.clientapi.AsyncResult result) {
+			    assertNotNull(result.getResponseEnvelope().getBody().getFirstChild());
+            }
+
+            public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e) {
+                fail();
+            }
+
+        }
+      </xsl:if>
+     </xsl:for-each>
+
+
+     public static Object createTestInput(Class paramClass){
+
+      OMFactory factory = OMAbstractFactory.getOMFactory();
+		OMElement element = factory.createOMElement(new QName("http://soapinterop.org/", "<xsl:value-of select="generate-id()"/>"), null);
+		OMElement element1 = factory.createOMElement(new QName("http://soapinterop.org/","<xsl:value-of select="generate-id()"/>"), element);
+		element.addChild(element1);
+    	OMTextImpl text = new OMTextImpl("<xsl:value-of select="generate-id()"/>");
+    	element1.addChild(text);
+    	return element;
+    }
+    }
+    </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl?rev=193149&r1=193148&r2=193149&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl Thu Jun 23 07:35:45 2005
@@ -3,13 +3,12 @@
     <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="implpackage"><xsl:value-of select="@implpackage"/></xsl:variable>
     <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
     <xsl:variable name="stubname"><xsl:value-of select="@stubname"/></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="address"><xsl:value-of select="@address"/></xsl:variable>
-    <xsl:variable name="servicexmlpath"><xsl:value-of select="@servicexmlpath"/></xsl:variable>
+    <xsl:variable name="dbpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
+
     package <xsl:value-of select="$package"/>;
     
 	import java.io.InputStream;
@@ -34,60 +33,12 @@
     */
 
     public class <xsl:value-of select="@name"/> extends junit.framework.TestCase{
-    
-    
-    private static int count = 0;
-	private static SimpleHTTPServer server;
-	
-	public void setUp() throws Exception {
-		if (count == 0) {
-			DeploymentEngine deploymentEngine = new DeploymentEngine(System
-					.getProperty("user.dir"));
-			AxisConfiguration axisConfig = deploymentEngine.load();
-			ClassLoader classLoader = this.getClass().getClassLoader();
-			classLoader.getResource("<xsl:value-of select="$implpackage"/>.<xsl:value-of select="$interfaceName"/>");
-			classLoader.getResource("<xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>");
-			ClassLoader cl = Thread.currentThread().getContextClassLoader();
-			InputStream in = cl
-					.getResourceAsStream("<xsl:value-of select="$servicexmlpath"/>");
-			ServiceDescription service = new ServiceDescription();
-			deploymentEngine.buildService(service, in, classLoader);
-			
-			ConfigurationContext configurationContext = new ConfigurationContext(
-					axisConfig);
-			ServerSocket serverSoc = null;
-			serverSoc = new ServerSocket(Constants.TEST_PORT);
-			server = new SimpleHTTPServer(
-					configurationContext, serverSoc);
-			Thread thread = new Thread(server);
-			thread.setDaemon(true);
-
-			try {
-				thread.start();
-				System.out.print("Server started on port "
-						+ Constants.TEST_PORT + ".....");
-			} finally {
-
-			}
-		}
-		count++;
-	}
-
-	 protected void tearDown() throws Exception {
-	 	 if (count == 1) {
-            server.stop();
-            count = 0;
-            System.out.print("Server stopped .....");
-        } else {
-            count--;
-        }
-    }
-
 
      <xsl:for-each select="method">
          <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
          <xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
          <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable>  <!-- this needs to change-->
+         <xsl:variable name="dbsupportclassname"><xsl:value-of select="@dbsupportname"></xsl:value-of></xsl:variable>
          <xsl:if test="$isSync='1'">
 
         /**
@@ -95,14 +46,34 @@
          */
         public  void test<xsl:value-of select="@name"/>() throws java.lang.Exception{
 
-        <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>(".","<xsl:value-of select="$address"/>/<xsl:value-of select="@name"/>");
+        <xsl:value-of select="$package"/>.<xsl:value-of select="$stubname"/> stub =
+                    new <xsl:value-of select="$package"/>.<xsl:value-of select="$stubname"/>();//the default implementation should point to the right endpoint
+          //create a new databinder
+        <xsl:variable name="fullsupporterclassname"><xsl:value-of select="$dbpackage"/>.<xsl:value-of select="$dbsupportclassname"/></xsl:variable>
+        <xsl:value-of select="$fullsupporterclassname"/> databindSupporter = new <xsl:value-of select="$fullsupporterclassname"/>();
+
            <xsl:choose>
              <xsl:when test="$inputtype!=''">
-               assertNotNull(stub.<xsl:value-of select="@name"/>(
-                                (<xsl:value-of select="$inputtype"/>)createTestInput(<xsl:value-of select="$inputtype"/>.class)));//this should come as a type
+                <xsl:choose>
+                    <xsl:when test="$outputtype=''">
+                    //There is no output to be tested!
+                    stub.<xsl:value-of select="@name"/>((<xsl:value-of select="$inputtype"/>)databindSupporter.getTestObject(<xsl:value-of select="$inputtype"/>.class));
+                    </xsl:when>
+                    <xsl:otherwise>
+                    assertNotNull(stub.<xsl:value-of select="@name"/>((<xsl:value-of select="$inputtype"/>)databindSupporter.getTestObject(<xsl:value-of select="$inputtype"/>.class)));
+                    </xsl:otherwise>
+                </xsl:choose>
               </xsl:when>
               <xsl:otherwise>
-               // assertNotNull(stub.<xsl:value-of select="@name"/>());
+                  <xsl:choose>
+                    <xsl:when test="$outputtype=''">
+                    //There is no output to be tested!
+                    stub.<xsl:value-of select="@name"/>();
+                    </xsl:when>
+                    <xsl:otherwise>
+                    assertNotNull(stub.<xsl:value-of select="@name"/>());
+                    </xsl:otherwise>
+                </xsl:choose>
              </xsl:otherwise>
             </xsl:choose>
 
@@ -116,11 +87,13 @@
          * Auto generated test method
          */
         public  void testStart<xsl:value-of select="@name"/>() throws java.lang.Exception{
-            <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$stubname"/>();
+            <xsl:value-of select="$package"/>.<xsl:value-of select="$stubname"/> stub = new <xsl:value-of select="$package"/>.<xsl:value-of select="$stubname"/>();
+             //create a new databinder
+            <xsl:variable name="fullsupporterclassname"><xsl:value-of select="$dbpackage"/>.<xsl:value-of select="$dbsupportclassname"/></xsl:variable>
+            <xsl:value-of select="$fullsupporterclassname"/> databindSupporter = new <xsl:value-of select="$fullsupporterclassname"/>();
              <xsl:choose>
              <xsl:when test="$inputtype!=''">
-                stub.start<xsl:value-of select="@name"/>(
-                   (<xsl:value-of select="$inputtype"/>)createTestInput(<xsl:value-of select="$inputtype"/>.class),
+                stub.start<xsl:value-of select="@name"/>((<xsl:value-of select="$inputtype"/>)databindSupporter.getTestObject(<xsl:value-of select="$inputtype"/>.class),
                     new <xsl:value-of select="$tempCallbackName"/>()
                 );
               </xsl:when>
@@ -134,7 +107,7 @@
 
         }
 
-        private class <xsl:value-of select="$tempCallbackName"/>  extends <xsl:value-of select="$implpackage"/>.<xsl:value-of select="$callbackname"/>{
+        private class <xsl:value-of select="$tempCallbackName"/>  extends <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>{
             public <xsl:value-of select="$tempCallbackName"/>(){ super(null);}
 
             public void receiveResult<xsl:value-of select="@name"/>(org.apache.axis.clientapi.AsyncResult result) {

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl?rev=193149&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/XMLBeansSupporterTemplate.xsl Thu Jun 23 07:35:45 2005
@@ -0,0 +1,56 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/class">
+    package <xsl:value-of select="@package"/>;
+
+    /**
+     *  Auto generated supporter class for XML beans by the Axis code generator
+     */
+
+    public class <xsl:value-of select="@name"/> {
+             <xsl:apply-templates />
+
+          public org.apache.xmlbeans.XmlObject fromOM(org.apache.axis.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){
+                    e.printStackTrace();
+                }
+             return null;
+          }
+
+        //Generates an empty object for testing
+         public org.apache.xmlbeans.XmlObject getTestObject(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.newInstance() ;
+                    }
+                     </xsl:if>
+                    </xsl:for-each>
+                 }catch(java.lang.Exception e){
+                    e.printStackTrace();
+                }
+             return null;
+          }
+     }
+    </xsl:template>
+    
+    <xsl:template match="param">
+        <xsl:if test="@type!=''">
+          public  org.apache.axis.om.OMElement  toOM(<xsl:value-of select="@type"/> param){
+		    org.apache.axis.om.impl.llom.builder.StAXOMBuilder builder = org.apache.axis.om.impl.llom.factory.OMXMLBuilderFactory.createStAXOMBuilder
+            (org.apache.axis.om.OMAbstractFactory.getOMFactory(),param.newXMLStreamReader()) ;
+		    return builder.getDocumentElement();
+          }
+       </xsl:if>
+    </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file