You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/06/29 13:34:39 UTC

svn commit: r202349 - in /webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl: codegen/emitter/MultiLanguageClientEmitter.java template/java/MessageReceiverTemplate.xsl

Author: chathura
Date: Wed Jun 29 04:34:39 2005
New Revision: 202349

URL: http://svn.apache.org/viewcvs?rev=202349&view=rev
Log:
Server side Message Receiver generation added

Modified:
    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/MessageReceiverTemplate.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=202349&r1=202348&r2=202349&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 04:34:39 2005
@@ -499,6 +499,7 @@
         addAttribute(doc,"name",boundInterface.getName().getLocalPart()+MESSAGE_RECEIVER_SUFFIX,rootElement);
         addAttribute(doc,"skeletonname",boundInterface.getName().getLocalPart() + SERVICE_CLASS_SUFFIX,rootElement);
         addAttribute(doc, "basereceiver", "org.apache.axis.receivers.AbstractInOutSyncMessageReceiver", rootElement);
+        addAttribute(doc,"dbsupportpackage",configuration.getPackageName()+DATABINDING_PACKAGE_NAME_SUFFIX,rootElement);
         fillSyncAttributes(doc, rootElement);
         loadOperations(boundInterface, doc, rootElement, binding);
         doc.appendChild(rootElement);

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=202349&r1=202348&r2=202349&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 04:34:39 2005
@@ -1,15 +1,20 @@
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-    <xsl:output method="text"/>
-    <xsl:template match="/interface">
-
-	<xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
+	<xsl:output method="text"/>
+	<xsl:template match="/interface">
+		<xsl:variable name="skeletonname">
+			<xsl:value-of select="@skeletonname"/>
+		</xsl:variable>
+		<xsl:variable name="dbsupportpackage">
+			<xsl:value-of select="@dbsupportpackage"/>
+		</xsl:variable>
+	
     package <xsl:value-of select="@package"/>;
 
     /**
      *  Auto generated message receiver
      */
 
-    public class <xsl:value-of select="@name"></xsl:value-of> extends <xsl:value-of select="@basereceiver"/>{
+    public class <xsl:value-of select="@name"/> extends <xsl:value-of select="@basereceiver"/>{
     
 		public void invokeBusinessLogic(org.apache.axis.context.MessageContext msgContext, org.apache.axis.context.MessageContext newMsgContext) 
 		throws org.apache.axis.engine.AxisFault{
@@ -19,7 +24,7 @@
             // get the implementation class for the Web Service
             Object obj = getTheImplementationObject(msgContext);
            
-            <xsl:value-of select="$skeletonname"></xsl:value-of> skel = (<xsl:value-of select="$skeletonname"></xsl:value-of>)obj;
+            <xsl:value-of select="$skeletonname"/> skel = (<xsl:value-of select="$skeletonname"/>)obj;
             //Out Envelop
              org.apache.axis.soap.SOAPEnvelope envelope = null;
              //Find the operation that has been set by the Dispatch phase.
@@ -32,30 +37,89 @@
             if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
             
 				<xsl:for-each select="method">
-
-					<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="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="name">
+				<xsl:value-of select="@name"/>
+			</xsl:variable>
+			<xsl:variable name="style">
+				<xsl:value-of select="@style"/>
+			</xsl:variable>
+					
 					
-					if(methodName.equals("<xsl:value-of select="@name"></xsl:value-of> ")){
+					if(methodName.equals("<xsl:value-of select="@name"/> ")){
+						
 						<xsl:for-each select="input/param">
-							<xsl:if test="@type!=''">
-								<xsl:value-of select="@type"/> <xsl:text> </xsl:text><xsl:value-of select="@name"/> = null;
+				<xsl:if test="@type!=''">
+					<xsl:value-of select="@type"/>
+					<xsl:text> </xsl:text>
+					<xsl:value-of select="@name"/> = null;
+								
 							</xsl:if>
-						</xsl:for-each>
-						<xsl:if test="$returntype!=''">
-								<xsl:value-of select="$returntype"/> <xsl:text> </xsl:text><xsl:value-of select="$returnvariable"/> = null;
+			</xsl:for-each>
+			<xsl:if test="$returntype!=''">
+				<xsl:value-of select="$returntype"/>
+				<xsl:text> </xsl:text>
+				<xsl:value-of select="$returnvariable"/> = null;
+						</xsl:if>
+			<xsl:choose>
+				<xsl:when test="$style='rpc'">
+				//rpc style
+					<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="@name"/>
 						</xsl:if>
-						<xsl:if test="count(input/param)='1'">
-							<xsl:if test="$returntype!=''"><xsl:value-of select="$returnvariable"/> =</xsl:if> skel.<xsl:value-of select="@name"></xsl:value-of>(
-							<xsl:for-each select="input/param">
-								<xsl:if test="@type!=''">
-									<xsl:value-of select="@name"/>
+					</xsl:for-each>);
+							//Create a default envelop
+								envelope = getSOAPFactory().getDefaultEnvelope();
+								org.apache.axis.om.OMNamespace ns = getSOAPFactory().createOMNamespace("<xsl:value-of select="$namespace"/>", "<xsl:value-of select="$name"/>Responce");
+								org.apache.axis.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="$name"/>DatabindingSupporter().toOM(<xsl:value-of select="$returnvariable"/>));		
 								</xsl:if>
-							</xsl:for-each>);
+											
+								envelope.getBody().setFirstChild(responseMethodName);
+							</xsl:when>
+							
+				<xsl:when test="$style='doc'">
+				//doc style
+					<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="@name"/>
 						</xsl:if>
+					</xsl:for-each>);
+					//Create a default envelop
+					envelope = getSOAPFactory().getDefaultEnvelope();
+					//Create a Omelement of the result if a result exist
+					<xsl:if test="$returntype!=''">envelope.setFirstChild(<xsl:value-of select="$dbsupportpackage"/>.<xsl:value-of select="$name"/>DatabindingSupporter().toOM(<xsl:value-of select="$returnvariable"/>));		
+					</xsl:if>											
+				</xsl:when>
+							
+							
+				<xsl:otherwise>
+									//Unknown style!! No code is generated
+								  throw UnsupportedOperationException("Unknown Style");
+							</xsl:otherwise>
+			</xsl:choose>
+						
+						
 						
 					}
 			   </xsl:for-each>
+			   
+			   newMsgContext.setEnvelope(envelope);
             }
            
             
@@ -63,9 +127,9 @@
         } catch (Exception e) {
             throw org.apache.axis.engine.AxisFault.makeFault(e);
         }
-     <xsl:for-each select="method"></xsl:for-each>
+     <xsl:for-each select="method"/>
 		 }
 	
     }
     </xsl:template>
- </xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>