You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2006/01/20 11:29:35 UTC
svn commit: r370776 - in
/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java:
DatabindingTemplate.xsl InterfaceImplementationTemplate.xsl
Author: ajith
Date: Fri Jan 20 02:29:28 2006
New Revision: 370776
URL: http://svn.apache.org/viewcvs?rev=370776&view=rev
Log:
Updated the DatabindingTemplate.xsl to make the fromOM logic more efficient
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl?rev=370776&r1=370775&r2=370776&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl Fri Jan 20 02:29:28 2006
@@ -195,20 +195,20 @@
private java.lang.Object fromOM(org.apache.axis2.om.OMElement param,
java.lang.Class type){
- Object obj;
+
try {
- java.lang.reflect.Method parseMethod = type.getMethod("parse",new Class[]{javax.xml.stream.XMLStreamReader.class});
- obj = null;
- if (parseMethod!=null){
- obj = parseMethod.invoke(null,new Object[]{param.getXMLStreamReaderWithoutCaching()});
- }else{
- //oops! we don't know how to deal with this. Perhaps the reflective one is a good choice here
- }
+ <xsl:for-each select="param">
+ <xsl:if test="@type!=''">
+ if (<xsl:value-of select="@type"/>.class.equals(type)){
+ return <xsl:value-of select="@type"/>.parse(param.getXMLStreamReaderWithoutCaching());
+ }
+ </xsl:if>
+ </xsl:for-each>
} catch (Exception e) {
throw new RuntimeException(e);
}
- return obj;
+ return null;
}
</xsl:template>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=370776&r1=370775&r2=370776&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Fri Jan 20 02:29:28 2006
@@ -195,9 +195,17 @@
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
org.apache.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
org.apache.axis2.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
- <!-- todo need to change this to cater for unwrapped messgaes (multiple parts) -->
- java.lang.Object object = fromOM(getElement(_returnEnv,"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
- return (<xsl:value-of select="$outputtype"/>)object;
+ <!-- todo need to change this to cater for unwrapped messages (multiple parts) -->
+ <xsl:choose>
+ <xsl:when test="$style='doc'">
+ java.lang.Object object = fromOM(getElement(_returnEnv,"<xsl:value-of select="$style"/>"),<xsl:value-of select="$outputtype"/>.class);
+ return (<xsl:value-of select="$outputtype"/>)object;
+ </xsl:when>
+ <xsl:otherwise>
+ //Unsupported style!! No code is generated
+ throw java.lang.UnsupportedOperationException("Unsupported Style");
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:otherwise>
</xsl:choose>