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/30 06:24:15 UTC

svn commit: r202478 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/clientapi/ wsdl/src/org/apache/axis/wsdl/codegen/emitter/ wsdl/src/org/apache/axis/wsdl/template/java/

Author: ajith
Date: Wed Jun 29 21:24:12 2005
New Revision: 202478

URL: http://svn.apache.org/viewcvs?rev=202478&view=rev
Log:
Changed some parts of the databinder
1. Added the soap action to the templates
2. Fixed the generation of the client side code with the serverside code generation

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.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/template/java/InterfaceImplementationTemplate.xsl
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java?rev=202478&r1=202477&r2=202478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java Wed Jun 29 21:24:12 2005
@@ -42,6 +42,14 @@
     protected String soapVersionURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
     protected String soapAction = "";
 
+    public String getSoapAction() {
+        return soapAction;
+    }
+
+    public void setSoapAction(String soapAction) {
+        this.soapAction = soapAction;
+    }
+
     public MEPClient(ServiceContext service, String mep) {
         this.serviceContext = service;
         this.mep = mep;

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=202478&r1=202477&r2=202478&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 Wed Jun 29 21:24:12 2005
@@ -92,7 +92,7 @@
     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";
-    
+
 
     protected InputStream xsltStream = null;
     protected CodeGenConfiguration configuration;
@@ -239,7 +239,7 @@
     protected void writeSkeleton(WSDLBinding axisBinding) throws Exception {
 
         //Note -  One can generate the skeleton using the interface XML
-        XmlDocument skeletonModel = createDOMDocuementForInterface(axisBinding);
+        XmlDocument skeletonModel = createDOMDocuementForSkeleton(axisBinding);
         ClassWriter skeletonWriter = new SkeletonWriter(this.configuration.getOutputLocation(),
                 this.configuration.getOutputLanguage()
         );
@@ -307,9 +307,9 @@
                 );
         writeClass(interfaceImplModel,writer);
     }
-    
+
     protected void writeMessageReceiver(WSDLBinding axisBinding)throws Exception{
-    	if (configuration.isWriteMessageReceiver()){
+        if (configuration.isWriteMessageReceiver()){
             XmlDocument classModel = createDocumentForMessageReceiver(axisBinding);
             MessageReceiverWriter writer =
                     new MessageReceiverWriter(this.configuration.getOutputLocation(),
@@ -367,17 +367,18 @@
             writeSkeleton(axisBinding);
             //write interface implementations
             writeServiceXml(axisBinding);
-            //write the test classes
-            writeTestClasses(axisBinding);
             //write the local test classes
             writeLocalTestClasses(axisBinding);
-            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
             writeTestServiceXML(axisBinding);
             //write a MessageReceiver for this particular service.
             writeMessageReceiver(axisBinding);
+            //////////////////////////////////////
+            // Call the emit stub method to generate the client side too
+            emitStub();
+
         } catch (Exception e) {
             e.printStackTrace();
             throw new CodeGenerationException(e);
@@ -496,10 +497,10 @@
 
         return doc;
     }
-    
-    
+
+
     protected XmlDocument createDocumentForMessageReceiver(WSDLBinding binding){
-    	WSDLInterface boundInterface = binding.getBoundInterface();
+        WSDLInterface boundInterface = binding.getBoundInterface();
 
         XmlDocument doc = new XmlDocument();
         Element rootElement = doc.createElement("interface");
@@ -512,13 +513,13 @@
         fillSyncAttributes(doc, rootElement);
         loadOperations(boundInterface, doc, rootElement, binding);
         doc.appendChild(rootElement);
-        
+
         try {
-			doc.write(System.out);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
+            doc.write(System.out);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
 
         return doc;
     }
@@ -533,11 +534,7 @@
         XmlDocument doc = new XmlDocument();
         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);
-        }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);
         loadOperations(boundInterface, doc, rootElement);
@@ -546,6 +543,20 @@
 
     }
 
+    protected XmlDocument createDOMDocuementForSkeleton(WSDLBinding binding){
+        WSDLInterface boundInterface = binding.getBoundInterface();
+
+        XmlDocument doc = new XmlDocument();
+        Element rootElement = doc.createElement("interface");
+        addAttribute(doc,"package",configuration.getPackageName(), rootElement);
+        addAttribute(doc,"name",boundInterface.getName().getLocalPart()+SERVICE_CLASS_SUFFIX,rootElement);
+        addAttribute(doc,"callbackname",boundInterface.getName().getLocalPart() + CALL_BACK_HANDLER_SUFFIX,rootElement);
+        fillSyncAttributes(doc, rootElement);
+        loadOperations(boundInterface, doc, rootElement);
+        doc.appendChild(rootElement);
+        return doc;
+
+    }
     private void fillSyncAttributes(XmlDocument doc, Element rootElement) {
         addAttribute(doc,"isAsync",this.configuration.isAsyncOn()?"1":"0",rootElement);
         addAttribute(doc,"isSync",this.configuration.isSyncOn()?"1":"0",rootElement);
@@ -582,21 +593,21 @@
     }
 
 
-   private void addSOAPAction(XmlDocument doc,Element rootElement,WSDLBindingOperation binding){
-    		Iterator extIterator = binding.getExtensibilityElements().iterator();
-            boolean actionAdded = false;
-    		while(extIterator.hasNext()){
-    			WSDLExtensibilityElement element = (WSDLExtensibilityElement)extIterator.next();
-    			if(element.getType().equals(ExtensionConstants.SOAP_OPERATION)){
-                    addAttribute(doc,"soapaction", ((SOAPOperation)element).getSoapAction(),rootElement);
-                    actionAdded = true ;
-    			}
-    		}
-
-       if (!actionAdded){
-           addAttribute(doc,"soapaction", "",rootElement);
-    	}
-   }
+    private void addSOAPAction(XmlDocument doc,Element rootElement,WSDLBindingOperation binding){
+        Iterator extIterator = binding.getExtensibilityElements().iterator();
+        boolean actionAdded = false;
+        while(extIterator.hasNext()){
+            WSDLExtensibilityElement element = (WSDLExtensibilityElement)extIterator.next();
+            if(element.getType().equals(ExtensionConstants.SOAP_OPERATION)){
+                addAttribute(doc,"soapaction", ((SOAPOperation)element).getSoapAction(),rootElement);
+                actionAdded = true ;
+            }
+        }
+
+        if (!actionAdded){
+            addAttribute(doc,"soapaction", "",rootElement);
+        }
+    }
 
     protected XmlDocument createDOMDocuementForTestCase(WSDLBinding binding) {
         WSDLInterface boundInterface = binding.getBoundInterface();
@@ -729,41 +740,41 @@
     }
 
     private void testCompatibiltyAll(WSDLBinding binding){
-         HashMap map = binding.getBindingOperations();
-         WSDLBindingOperation bindingOp;
-         Collection col = map.values();
-         for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-             bindingOp =  (WSDLBindingOperation)iterator.next();
-             testCompatibilityInput(bindingOp);
-             testCompatibilityOutput(bindingOp);
-         }
+        HashMap map = binding.getBindingOperations();
+        WSDLBindingOperation bindingOp;
+        Collection col = map.values();
+        for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+            bindingOp =  (WSDLBindingOperation)iterator.next();
+            testCompatibilityInput(bindingOp);
+            testCompatibilityOutput(bindingOp);
+        }
 
 
     }
     private void testCompatibilityInput(WSDLBindingOperation binding){
 
-    		Iterator extIterator = binding.getInput().getExtensibilityElements().iterator();
-           while(extIterator.hasNext()){
-    			WSDLExtensibilityElement element = (WSDLExtensibilityElement)extIterator.next();
-    			if(element.getType().equals(ExtensionConstants.SOAP_BODY)){
-                    if(WSDLConstants.WSDL_USE_ENCODED.equals(((SOAPBody)element).getUse())){
-                        throw new RuntimeException("The use 'encoded' is not supported!");
-                    }
-    			}
-    		}
-    }
-
-     private void testCompatibilityOutput(WSDLBindingOperation binding){
-
-    		Iterator extIterator = binding.getOutput().getExtensibilityElements().iterator();
-           while(extIterator.hasNext()){
-    			WSDLExtensibilityElement element = (WSDLExtensibilityElement)extIterator.next();
-    			if(element.getType().equals(ExtensionConstants.SOAP_BODY)){
-                    if(WSDLConstants.WSDL_USE_ENCODED.equals(((SOAPBody)element).getUse())){
-                        throw new RuntimeException("The use 'encoded' is not supported!");
-                    }
-    			}
-    		}
+        Iterator extIterator = binding.getInput().getExtensibilityElements().iterator();
+        while(extIterator.hasNext()){
+            WSDLExtensibilityElement element = (WSDLExtensibilityElement)extIterator.next();
+            if(element.getType().equals(ExtensionConstants.SOAP_BODY)){
+                if(WSDLConstants.WSDL_USE_ENCODED.equals(((SOAPBody)element).getUse())){
+                    throw new RuntimeException("The use 'encoded' is not supported!");
+                }
+            }
+        }
+    }
+
+    private void testCompatibilityOutput(WSDLBindingOperation binding){
+
+        Iterator extIterator = binding.getOutput().getExtensibilityElements().iterator();
+        while(extIterator.hasNext()){
+            WSDLExtensibilityElement element = (WSDLExtensibilityElement)extIterator.next();
+            if(element.getType().equals(ExtensionConstants.SOAP_BODY)){
+                if(WSDLConstants.WSDL_USE_ENCODED.equals(((SOAPBody)element).getUse())){
+                    throw new RuntimeException("The use 'encoded' is not supported!");
+                }
+            }
+        }
     }
 }
 

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=202478&r1=202477&r2=202478&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 Wed Jun 29 21:24:12 2005
@@ -77,12 +77,12 @@
 		    org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_serviceContext);
  		    org.apache.axis.context.MessageContext _messageContext = getMessageContext();
             _call.setTo(toEPR);
+            _call.setSoapAction("<xsl:value-of select="$soapAction"/>");
             org.apache.axis.soap.SOAPEnvelope env = null;
             env = createEnvelope();
             <xsl:choose>
               <xsl:when test="$inputtype!=''">
                   <xsl:choose>
-
                       <xsl:when test="$style='rpc'">
                        // Style is RPC
                              setValueRPC(env,
@@ -152,6 +152,7 @@
              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);
+            _call.setSoapAction("<xsl:value-of select="$soapAction"/>");
              org.apache.axis.soap.SOAPEnvelope env = createEnvelope();
              <xsl:choose>
               <xsl:when test="$inputtype!=''">

Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl?rev=202478&r1=202477&r2=202478&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl Wed Jun 29 21:24:12 2005
@@ -47,7 +47,7 @@
 			<xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
 					
 					
-					if(methodName.equals("<xsl:value-of select="@name"/> ")){
+					if(methodName.equals("<xsl:value-of select="@name"/>")){
 											
 				
 			<xsl:if test="$returntype!=''">