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 am...@apache.org on 2006/11/20 10:55:03 UTC
svn commit: r477125 [1/2] - in /webservices/axis2/trunk/java/modules:
adb-codegen/src/org/apache/axis2/schema/
adb-codegen/src/org/apache/axis2/schema/template/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl/codege...
Author: amilas
Date: Mon Nov 20 01:54:58 2006
New Revision: 477125
URL: http://svn.apache.org/viewvc?view=rev&rev=477125
Log:
this commit contains the following changes
1. added the compatibility to axis 1.x generated code when -b option is set. this includes the changes to the file
names and unwrapping the response and request messages as in axis 1.x
2. patch for 1459
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl
webservices/axis2/trunk/java/modules/integration/maven.xml
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/ExtensionUtility.java Mon Nov 20 01:54:58 2006
@@ -3,6 +3,7 @@
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
@@ -10,6 +11,8 @@
import org.apache.axis2.wsdl.databinding.JavaTypeMapper;
import org.apache.axis2.wsdl.databinding.TypeMapper;
import org.apache.axis2.wsdl.util.Constants;
+import org.apache.axis2.util.URLProcessor;
+import org.apache.axis2.AxisFault;
import org.apache.ws.commons.schema.*;
import javax.xml.namespace.QName;
@@ -135,8 +138,47 @@
}
}
+ //put the complext types for the top level elements having them
+ // this is needed in unwrapping and to provide backwordCompatibility
+ if(!configuration.isParametersWrapped() || configuration.isBackwordCompatibilityMode()){
+ AxisService axisService = configuration.getAxisService();
+ AxisOperation axisOperation;
+ AxisMessage axisMessage;
+ for (Iterator operators = axisService.getOperations(); operators.hasNext();){
+ axisOperation = (AxisOperation) operators.next();
+ if (WSDLUtil.isInputPresentForMEP(axisOperation.getMessageExchangePattern())){
+ axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ setComplexTypeName(axisMessage);
+ }
+ if (WSDLUtil.isOutputPresentForMEP(axisOperation.getMessageExchangePattern())){
+ axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ setComplexTypeName(axisMessage);
+ }
+ }
+ }
+
//set the type mapper to the config
configuration.setTypeMapper(mapper);
+
+ }
+
+ /**
+ * set the complext type class name as an message parameter if it exits
+ * @param axisMessage
+ */
+ private static void setComplexTypeName(AxisMessage axisMessage) throws AxisFault {
+
+ XmlSchemaType schemaType = axisMessage.getSchemaElement().getSchemaType();
+ if (schemaType instanceof XmlSchemaComplexType){
+ XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaType;
+ if ((complexType.getName() != null) && (complexType.getQName() != null)) {
+ Map metaInfo = complexType.getMetaInfoMap();
+ String complexTypeName = (String)
+ metaInfo.get(SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY);
+ // store the complext type name to process later
+ axisMessage.addParameter(new Parameter(Constants.COMPLEX_TYPE, complexTypeName));
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl Mon Nov 20 01:54:58 2006
@@ -37,86 +37,126 @@
<xsl:variable name="paramcount" select="count(../../param[@type!='' and @direction='in' and @opname=$opname])"/>
<xsl:if test="not($serverside)">
- <xsl:choose>
- <xsl:when test="$paramcount > 0">
- <xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
- <xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
- <xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
- <xsl:variable name="inputElementComplexType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@complextype"></xsl:variable>
- <xsl:variable name="wrappedParameterCount" select="count(../../param[@type!='' and @direction='in' and @opname=$opname]/param)"></xsl:variable>
- <xsl:if test="generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1])">
+ <xsl:choose>
+ <xsl:when test="$paramcount > 0">
+ <xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
+ <xsl:variable name="inputElementComplexType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@complextype"></xsl:variable>
+ <xsl:variable name="wrappedParameterCount" select="count(../../param[@type!='' and @direction='in' and @opname=$opname]/param)"></xsl:variable>
+ <xsl:if test="generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1])">
+
+ <!-- if the unwrapping mode is on then we have to generate the unwrapped methods -->
<xsl:choose>
- <xsl:when test="$wrappedParameterCount > 0">
- <!-- geneate the toEnvelope method-->
- private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
- <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
- <xsl:value-of select="@type"/> param<xsl:value-of select="position()"/>,
- </xsl:for-each>
- <xsl:value-of select="$inputElementType"/> dummyWrappedType,
- boolean optimizeContent){
-
- <xsl:value-of select="$inputElementType"/> wrappedType = new <xsl:value-of select="$inputElementType"/>();
-
- <xsl:choose>
- <!--<xsl:when test="$inputElementComplexType != ''">-->
- <xsl:when test="string-length(normalize-space($inputElementComplexType)) > 0">
- <xsl:value-of select="$inputElementComplexType"/> wrappedComplexType = new <xsl:value-of select="$inputElementComplexType"/>();
- <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
- wrappedComplexType.set<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);
- </xsl:for-each>
- wrappedType.set<xsl:value-of select="$inputElementShortType"/>(wrappedComplexType);
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
- wrappedType.set<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
-
- org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
- <xsl:choose>
- <xsl:when test="$helpermode">
- emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
- wrappedType,
- <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
- </xsl:when>
- <xsl:otherwise>
- emptyEnvelope.getBody().addChild(wrappedType.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:when test="$wrappedParameterCount > 0">
+ <!-- geneate the toEnvelope method-->
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
+ <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
+ <xsl:value-of select="@type"/> param<xsl:value-of select="position()"/>,
+ </xsl:for-each>
+ <xsl:value-of select="$inputElementType"/> dummyWrappedType,
+ boolean optimizeContent){
+
+ <xsl:value-of select="$inputElementType"/> wrappedType = new <xsl:value-of select="$inputElementType"/>();
+
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($inputElementComplexType)) > 0">
+ <xsl:value-of select="$inputElementComplexType"/> wrappedComplexType = new <xsl:value-of select="$inputElementComplexType"/>();
+ <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
+ wrappedComplexType.set<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);
+ </xsl:for-each>
+ wrappedType.set<xsl:value-of select="$inputElementShortType"/>(wrappedComplexType);
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
+ wrappedType.set<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ <xsl:choose>
+ <xsl:when test="$helpermode">
+ emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
+ wrappedType,
+ <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+ </xsl:when>
+ <xsl:otherwise>
+ emptyEnvelope.getBody().addChild(wrappedType.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+ </xsl:otherwise>
+ </xsl:choose>
- return emptyEnvelope;
- }
+ return emptyEnvelope;
+ }
- </xsl:when>
- <xsl:otherwise>
-
- <!-- Assumption - the parameter is always an ADB element-->
- private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="$inputElementType"/> param, boolean optimizeContent){
- org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
- <xsl:choose>
- <xsl:when test="$helpermode">
- emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
- param,
- <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
</xsl:when>
<xsl:otherwise>
- emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+
</xsl:otherwise>
- </xsl:choose>
- return emptyEnvelope;
- }
+ </xsl:choose>
+ <!-- Assumption - the parameter is always an ADB element-->
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="$inputElementType"/> param, boolean optimizeContent){
+ org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
+ <xsl:choose>
+ <xsl:when test="$helpermode">
+ emptyEnvelope.getBody().addChild(<xsl:value-of select="$inputElementType"/>Helper.getOMElement(
+ param,
+ <xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+ </xsl:when>
+ <xsl:otherwise>
+ emptyEnvelope.getBody().addChild(param.getOMElement(<xsl:value-of select="$inputElementType"/>.MY_QNAME,factory));
+ </xsl:otherwise>
+ </xsl:choose>
+ return emptyEnvelope;
+ }
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <!-- Do nothing here -->
- </xsl:otherwise>
- </xsl:choose>
+ <!-- to support for backword compatiblity we have to add and wrapp method-->
+ /* methods to provide back word compatibility */
+
+ <xsl:if test="string-length(normalize-space($inputElementComplexType)) > 0">
+ private <xsl:value-of select="$inputElementComplexType"/> get<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$inputElementType"/> wrappedType){
+ return wrappedType.get<xsl:value-of select="$inputElementShortType"/>();
+ }
+ private <xsl:value-of select="$inputElementType"/> wrap<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$inputElementComplexType"/> innerType){
+ <xsl:value-of select="$inputElementType"/> wrappedElement = new <xsl:value-of select="$inputElementType"/>();
+ wrappedElement.set<xsl:value-of select="$inputElementShortType"/>(innerType);
+ return wrappedElement;
+ }
+ </xsl:if>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- Do nothing here -->
+ </xsl:otherwise>
+ </xsl:choose>
+ <!-- generate additional getter and setter method to remove top element of the response
+ only usefull when -b option on-->
+ <xsl:if test="count(../../param[@type!='' and @direction='out' and @opname=$opname])=1">
+ <!-- generate the get methods -->
+ <xsl:variable name="outputElement" select="../../param[@type!='' and @direction='out' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="outputElementType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="outputElementShortType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@shorttype"></xsl:variable>
+ <xsl:variable name="outputElementComplexType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@complextype"></xsl:variable>
+
+ <xsl:if test="generate-id($outputElement) = generate-id(key('paramsOut', $outputElementType)[1])">
+ <xsl:if test="string-length(normalize-space($outputElementComplexType)) > 0">
+ private <xsl:value-of select="$outputElementComplexType"/> get<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$outputElementType"/> wrappedType){
+ return wrappedType.get<xsl:value-of select="$outputElementShortType"/>();
+ }
+ private <xsl:value-of select="$outputElementType"/> wrap<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$outputElementComplexType"/> innerType){
+ <xsl:value-of select="$outputElementType"/> wrappedElement = new <xsl:value-of select="$outputElementType"/>();
+ wrappedElement.set<xsl:value-of select="$outputElementShortType"/>(innerType);
+ return wrappedElement;
+ }
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
</xsl:if>
<!-- this piece of logic needs to be generated only for the server side-->
<xsl:if test="$serverside">
@@ -145,6 +185,7 @@
</xsl:if>
</xsl:when>
</xsl:choose>
+
<xsl:if test="count(../../param[@type!='' and @direction='in' and @opname=$opname])=1">
<!-- generate the get methods -->
<xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
@@ -174,6 +215,43 @@
}
</xsl:if>
</xsl:for-each>
+ <xsl:if test="generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1])">
+ <xsl:if test="string-length(normalize-space($inputElementComplexType)) > 0">
+ private <xsl:value-of select="$inputElementComplexType"/> get<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$inputElementType"/> wrappedType){
+ return wrappedType.get<xsl:value-of select="$inputElementShortType"/>();
+ }
+ private <xsl:value-of select="$inputElementType"/> wrap<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$inputElementComplexType"/> innerType){
+ <xsl:value-of select="$inputElementType"/> wrappedElement = new <xsl:value-of select="$inputElementType"/>();
+ wrappedElement.set<xsl:value-of select="$inputElementShortType"/>(innerType);
+ return wrappedElement;
+ }
+ </xsl:if>
+ </xsl:if>
+ </xsl:if>
+
+ <xsl:if test="count(../../param[@type!='' and @direction='out' and @opname=$opname])=1">
+ <!-- generate the get methods -->
+ <xsl:variable name="outputElement" select="../../param[@type!='' and @direction='out' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="outputElementType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="outputElementShortType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@shorttype"></xsl:variable>
+ <xsl:variable name="outputElementComplexType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@complextype"></xsl:variable>
+
+ <xsl:if test="generate-id($outputElement) = generate-id(key('paramsOut', $outputElementType)[1])">
+ <xsl:if test="string-length(normalize-space($outputElementComplexType)) > 0">
+ private <xsl:value-of select="$outputElementComplexType"/> get<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$outputElementType"/> wrappedType){
+ return wrappedType.get<xsl:value-of select="$outputElementShortType"/>();
+ }
+ private <xsl:value-of select="$outputElementType"/> wrap<xsl:value-of select="$opname"/>(
+ <xsl:value-of select="$outputElementComplexType"/> innerType){
+ <xsl:value-of select="$outputElementType"/> wrappedElement = new <xsl:value-of select="$outputElementType"/>();
+ wrappedElement.set<xsl:value-of select="$outputElementShortType"/>(innerType);
+ return wrappedElement;
+ }
+ </xsl:if>
+ </xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Mon Nov 20 01:54:58 2006
@@ -19,6 +19,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.neethi.Policy;
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.woden.internal.util.dom.DOM2Writer;
//import org.apache.woden.internal.util.dom.DOM2Writer;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -68,6 +69,7 @@
// keep a seperate variable for SKELETON_INTERFACE_SUFFIX_BACK although it is
// "" to accomadate any future changes easily.
protected static final String SKELETON_INTERFACE_SUFFIX_BACK = "";
+ protected static final String STUB_INTERFACE_SUFFIX_BACK = "Stub";
protected static final String MESSAGE_RECEIVER_SUFFIX = "MessageReceiver";
protected static final String FAULT_SUFFIX = "Exception";
protected static final String DATABINDING_SUPPORTER_NAME_SUFFIX = "DatabindingSupporter";
@@ -379,7 +381,15 @@
addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement);
addAttribute(doc, "interfaceName", coreClassName, rootElement);
addAttribute(doc, "callbackname", coreClassName + CALL_BACK_HANDLER_SUFFIX, rootElement);
- addAttribute(doc, "stubname", coreClassName + STUB_SUFFIX, rootElement);
+ if (this.codeGenConfiguration.isBackwordCompatibilityMode()){
+ addAttribute(doc, "stubname", makeJavaClassName(axisService.getBindingName()) + STUB_SUFFIX, rootElement);
+ } else {
+ addAttribute(doc, "stubname", coreClassName + STUB_SUFFIX, rootElement);
+ }
+
+ //add backwordcompatibility attribute
+ addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
+ rootElement);
fillSyncAttributes(doc, rootElement);
loadOperations(doc, rootElement, null);
@@ -427,12 +437,26 @@
Element rootElement = doc.createElement("class");
addAttribute(doc, "package", packageName, rootElement);
- addAttribute(doc, "name", stubName, rootElement);
+
addAttribute(doc, "servicename", localPart, rootElement);
//The target nemespace is added as the namespace for this service
addAttribute(doc, "namespace", axisService.getTargetNamespace(), rootElement);
- addAttribute(doc, "interfaceName", localPart, rootElement);
+ if (this.codeGenConfiguration.isBackwordCompatibilityMode()){
+ addAttribute(doc, "interfaceName",
+ makeJavaClassName(axisService.getPortTypeName()) + STUB_INTERFACE_SUFFIX_BACK,
+ rootElement);
+ addAttribute(doc, "name", makeJavaClassName(axisService.getBindingName()) + STUB_SUFFIX,
+ rootElement);
+ } else {
+ addAttribute(doc, "interfaceName", localPart, rootElement);
+ addAttribute(doc, "name", stubName, rootElement);
+ }
+
addAttribute(doc, "callbackname", localPart + CALL_BACK_HANDLER_SUFFIX, rootElement);
+ //add backwordcompatibility attribute
+ addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
+ rootElement);
+
// add the wrap classes flag
if (codeGenConfiguration.isPackClasses()) {
@@ -543,6 +567,95 @@
}
/**
+ * add the qNames of the operation fault message names to faultMessages Mep
+ *
+ * @param operationFaultMessages
+ * @param faultMessagesToMep
+ */
+
+ private void addFaultMessages(List operationFaultMessages, Set faultMessagesToMep) {
+
+ AxisMessage faultMessage;
+ for (Iterator iter = operationFaultMessages.iterator(); iter.hasNext();) {
+ faultMessage = (AxisMessage) iter.next();
+ faultMessagesToMep.add(faultMessage.getElementQName());
+ }
+
+ }
+
+ /**
+ * A util method that returns a unique list of faults for a given mep
+ *
+ * @param doc
+ * @return DOM element
+ */
+ protected Element getUniqueListofFaultsofMep(Document doc, String mep) {
+
+ // list to keep fault message qnames for this mep
+ Set faultListForMep = new HashSet();
+
+ Iterator iter = this.axisService.getOperations();
+ AxisOperation axisOperation;
+
+ for (; iter.hasNext();) {
+ axisOperation = (AxisOperation) iter.next();
+ if (mep == null) {
+ // add the fault messages
+ addFaultMessages(axisOperation.getFaultMessages(),faultListForMep);
+ } else {
+ if (mep.equals(axisOperation.getMessageExchangePattern())){
+ // add the fault messages
+ addFaultMessages(axisOperation.getFaultMessages(),faultListForMep);
+ }
+ }
+ }
+
+ Element rootElement = doc.createElement("fault-list");
+ Element faultElement;
+ QName key;
+ Iterator iterator = faultListForMep.iterator();
+ while (iterator.hasNext()) {
+ faultElement = doc.createElement("fault");
+ key = (QName) iterator.next();
+
+ //as for the name of a fault, we generate an exception
+ addAttribute(doc, "name",
+ (String) fullyQualifiedFaultClassNameMap.get(key),
+ faultElement);
+ addAttribute(doc, "shortName",
+ (String) faultClassNameMap.get(key),
+ faultElement);
+
+ //the type represents the type that will be wrapped by this
+ //name
+ String typeMapping =
+ this.mapper.getTypeMappingName(key);
+ addAttribute(doc, "type", (typeMapping == null)
+ ? ""
+ : typeMapping, faultElement);
+ String attribValue = (String) instantiatableMessageClassNames.
+ get(key);
+
+ addAttribute(doc, "instantiatableType",
+ attribValue == null ? "" : attribValue,
+ faultElement);
+
+ // add an extra attribute to say whether the type mapping is
+ // the default
+ if (mapper.getDefaultMappingName().equals(typeMapping)) {
+ addAttribute(doc, "default", "yes", faultElement);
+ }
+ addAttribute(doc, "value", getParamInitializer(typeMapping),
+ faultElement);
+
+
+ rootElement.appendChild(faultElement);
+ }
+ return rootElement;
+ }
+
+
+ /**
* Adds the endpoint to the document.
*
* @param doc
@@ -727,7 +840,7 @@
Element rootElement = doc.createElement("interface");
String localPart = null;
if (this.codeGenConfiguration.isBackwordCompatibilityMode()){
- localPart = makeJavaClassName(axisService.getPortTypeName());
+ localPart = makeJavaClassName(axisService.getPortTypeName() + STUB_INTERFACE_SUFFIX_BACK);
} else {
localPart = makeJavaClassName(axisService.getName());
}
@@ -736,6 +849,9 @@
addAttribute(doc, "name", localPart, rootElement);
addAttribute(doc, "callbackname", makeJavaClassName(axisService.getName()) + CALL_BACK_HANDLER_SUFFIX,
rootElement);
+ //add backwordcompatibility attribute
+ addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
+ rootElement);
fillSyncAttributes(doc, rootElement);
loadOperations(doc, rootElement, null);
@@ -1007,6 +1123,10 @@
String localPart = makeJavaClassName(axisService.getName());
addAttribute(doc, "name", localPart + mepToSuffixMap.get(mep), rootElement);
+ //add backwordcompatibility attribute
+ addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
+ rootElement);
+
if (this.codeGenConfiguration.isBackwordCompatibilityMode()){
addAttribute(doc, "skeletonname", makeJavaClassName(axisService.getBindingName()) + SKELETON_CLASS_SUFFIX_BACK, rootElement);
if (isServerSideInterface) {
@@ -1051,7 +1171,7 @@
rootElement.appendChild(createDOMElementforDatabinders(doc,true));
//attach a list of faults
- rootElement.appendChild(getUniqueListofFaults(doc));
+ rootElement.appendChild(getUniqueListofFaultsofMep(doc,mep));
doc.appendChild(rootElement);
@@ -1452,6 +1572,9 @@
}
addAttribute(doc, "callbackname", serviceName + CALL_BACK_HANDLER_SUFFIX,
rootElement);
+ //add backwordcompatibility attribute
+ addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
+ rootElement);
if (isSkeletonInterface) {
if (this.codeGenConfiguration.isBackwordCompatibilityMode()){
addAttribute(doc, "skeletonInterfaceName", makeJavaClassName(axisService.getPortTypeName()) + SKELETON_INTERFACE_SUFFIX_BACK,
@@ -1492,6 +1615,10 @@
addAttribute(doc, "callbackname", serviceName + CALL_BACK_HANDLER_SUFFIX,
rootElement);
+ //add backwordcompatibility attribute
+ addAttribute(doc, "isbackcompatible", String.valueOf(codeGenConfiguration.isBackwordCompatibilityMode()),
+ rootElement);
+
fillSyncAttributes(doc, rootElement);
loadOperations(doc, rootElement, null);
@@ -1499,6 +1626,9 @@
rootElement.appendChild(getUniqueListofFaults(doc));
doc.appendChild(rootElement);
+ //////////////////////////////////////////////////////////
+// System.out.println(DOM2Writer.nodeToString(rootElement));
+ ////////////////////////////////////////////////////////////
return doc;
}
@@ -1819,29 +1949,29 @@
Element inputElt = doc.createElement("input");
String MEP = operation.getMessageExchangePattern();
- /*
- * Setting the input message policy as an attribute of the input element.
- */
- AxisMessage inputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (inputMessage != null) {
- PolicyInclude policyInclude = inputMessage.getPolicyInclude();
- Policy policy = policyInclude.getPolicy();
+ if (WSDLUtil.isInputPresentForMEP(MEP)) {
- if (policy != null) {
- policy = (Policy) policy.normalize(policyInclude.getPolicyRegistry(), false);
- try {
- String policyString = PolicyUtil.policyComponentToString(policy);
- policyString = PolicyUtil.getSafeString(policyString);
- addAttribute(doc, "policy", policyString, inputElt);
+ /*
+ * Setting the input message policy as an attribute of the input element.
+ */
+ AxisMessage inputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if (inputMessage != null) {
+ PolicyInclude policyInclude = inputMessage.getPolicyInclude();
+ Policy policy = policyInclude.getPolicy();
- } catch (Exception e) {
- throw new RuntimeException(e);
+ if (policy != null) {
+ policy = (Policy) policy.normalize(policyInclude.getPolicyRegistry(), false);
+ try {
+ String policyString = PolicyUtil.policyComponentToString(policy);
+ policyString = PolicyUtil.getSafeString(policyString);
+ addAttribute(doc, "policy", policyString, inputElt);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
}
- }
-
- if (WSDLUtil.isInputPresentForMEP(MEP)) {
Element[] param = getInputParamElement(doc, operation);
for (int i = 0; i < param.length; i++) {
inputElt.appendChild(param[i]);
@@ -2016,17 +2146,21 @@
paramElementList.add(mainParameter);
+ //if the unwrapping or backWordCompatibility flag is on then we have to
+ //put the element complex type if it exits
+ if (this.codeGenConfiguration.isBackwordCompatibilityMode() ||
+ !this.codeGenConfiguration.isParametersWrapped()){
+ if (inputMessage.getParameter(Constants.COMPLEX_TYPE) != null){
+ Parameter parameter = inputMessage.getParameter(Constants.COMPLEX_TYPE);
+ addAttribute(doc,"complextype",(String)parameter.getValue(),mainParameter);
+ }
+ }
+
// this message has been unwrapped - find the correct references of the
// the message by looking at the unwrapped details object and attach the
// needed parameters inside main parameter element
if (inputMessage.getParameter(Constants.UNWRAPPED_KEY) != null) {
- // we put the complex type only if unWrapped key present
- if (inputMessage.getParameter(Constants.COMPLEX_TYPE) != null){
- Parameter parameter = inputMessage.getParameter(Constants.COMPLEX_TYPE);
- addAttribute(doc,"complextype",(String)parameter.getValue(),mainParameter);
- }
-
//we have this unwrapped earlier. get the info holder
//and then look at the parameters
Parameter detailsParameter =
@@ -2190,6 +2324,16 @@
// add this as a body parameter
addAttribute(doc, "location", "body", paramElement);
addAttribute(doc, "opname", operation.getName().getLocalPart(), paramElement);
+
+ //if the unwrapping or backWordCompatibility flag is on then we have to
+ //put the element complex type if it exits
+ if (this.codeGenConfiguration.isBackwordCompatibilityMode() ||
+ !this.codeGenConfiguration.isParametersWrapped()){
+ if (outputMessage.getParameter(Constants.COMPLEX_TYPE) != null){
+ Parameter parameter = outputMessage.getParameter(Constants.COMPLEX_TYPE);
+ addAttribute(doc,"complextype",(String)parameter.getValue(),paramElement);
+ }
+ }
return paramElement;
}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Mon Nov 20 01:54:58 2006
@@ -119,7 +119,7 @@
XmlSchemaElement schemaElement = message.getSchemaElement();
XmlSchemaType schemaType = schemaElement.getSchemaType();
- String complexType = handleAllCasesOfComplexTypes(schemaType, message, partNameList);
+ handleAllCasesOfComplexTypes(schemaType, message, partNameList);
try {
//set in the axis message that the unwrapping was success
@@ -137,8 +137,6 @@
message.addParameter(
getParameter(Constants.UNWRAPPED_DETAILS,
infoHolder));
- // store the complex type name for this message
- message.addParameter(getParameter(Constants.COMPLEX_TYPE, complexType));
} catch (AxisFault axisFault) {
throw new CodeGenerationException(axisFault);
@@ -146,20 +144,13 @@
}
- private String handleAllCasesOfComplexTypes(XmlSchemaType schemaType, AxisMessage message, List partNameList) throws CodeGenerationException {
+ private void handleAllCasesOfComplexTypes(XmlSchemaType schemaType, AxisMessage message, List partNameList) throws CodeGenerationException {
// if a complex type name exits for a element then
// we keep that complex type to support unwrapping
String complexType = "";
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
- if ((cmplxType.getName() != null) && (cmplxType.getName().length() != 0)) {
- if ((cmplxType.getQName() != null) && (cmplxType.getQName().getNamespaceURI() != null) && (cmplxType.getQName().getNamespaceURI().length() != 0))
- {
- complexType = URLProcessor.makePackageName(cmplxType.getQName().getNamespaceURI()) + ".";
- }
- complexType += cmplxType.getName();
- }
if (cmplxType.getContentModel() == null) {
if (cmplxType.getParticle() != null){
processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList);
@@ -175,7 +166,6 @@
throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
"unknown", "complexType"));
}
- return complexType;
}
private void processComplexContentModel(XmlSchemaComplexType cmplxType, AxisMessage message, List partNameList) throws CodeGenerationException {
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java Mon Nov 20 01:54:58 2006
@@ -90,7 +90,16 @@
if (counter == UPPER_PARAM_LIMIT) {
counter = 0;
}
- return PARAMETER_NAME_SUFFIX + counter++;
+ if ((qname != null) && (qname.getLocalPart().length() != 0)) {
+ String paramName = qname.getLocalPart();
+ //make the first letter lower case - java coding convention
+ if (paramName.length() > 1){
+ paramName = paramName.substring(0,1).toLowerCase() + paramName.substring(1);
+ }
+ return paramName + counter++;
+ } else {
+ return PARAMETER_NAME_SUFFIX + counter++;
+ }
}
/**
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/CallbackHandlerTemplate.xsl Mon Nov 20 01:54:58 2006
@@ -45,8 +45,8 @@
}
<xsl:for-each select="method">
- <xsl:variable name="outParamType"><xsl:value-of select="output/param/@type"/></xsl:variable>
- <xsl:variable name="outParamName"><xsl:value-of select="output/param/@name"/></xsl:variable>
+ <xsl:variable name="outParamType" select="output/param/@type"></xsl:variable>
+ <xsl:variable name="outParamName" select="output/param/@name"></xsl:variable>
<xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
<xsl:choose>
<!-- Code generation for in-out only. Need to consider the other meps also
@@ -57,7 +57,7 @@
*
*/
public void receiveResult<xsl:value-of select="@name"/>(
- <xsl:if test="$outParamType!=''"><xsl:value-of select="$outParamType"/><xsl:text> </xsl:text><xsl:value-of select="$outParamName"/></xsl:if>) {
+ <xsl:if test="string-length(normalize-space($outParamType)) > 0"><xsl:value-of select="$outParamType"/><xsl:text> </xsl:text><xsl:value-of select="$outParamName"/></xsl:if>) {
}
/**
@@ -78,4 +78,4 @@
}
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- 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 Mon Nov 20 01:54:58 2006
@@ -19,6 +19,7 @@
<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="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+ <xsl:variable name="isbackcompatible" select="@isbackcompatible"/>
/**
* <xsl:value-of select="@name"/>.java
*
@@ -173,7 +174,8 @@
<xsl:variable name="usedbimpl"><xsl:value-of select="@usdbimpl"/></xsl:variable>
<xsl:if test="$usedbimpl!='true'">
- <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"/></xsl:variable>
+ <xsl:variable name="outputcomplextype"><xsl:value-of select="output/param/@complextype"/></xsl:variable>
<xsl:variable name="style"><xsl:value-of select="@style"></xsl:value-of></xsl:variable>
<xsl:variable name="soapAction"><xsl:value-of select="@soapaction"></xsl:value-of></xsl:variable>
<xsl:variable name="mep"><xsl:value-of select="@mep"/></xsl:variable>
@@ -193,33 +195,67 @@
* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
</xsl:text></xsl:for-each>
*/
- public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
- <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
- <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
<xsl:choose>
- <xsl:when test="$inputcount=1">
- <!-- Even when the parameters are 1 we have to see whether we have the
- wrapped parameters -->
- <xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
+ <!-- if -b flag is on then we have to unwarp the request and response messages. -->
+ <xsl:when test="$isbackcompatible = 'true'">
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when>
+ <xsl:when test="string-length(normalize-space($outputcomplextype)) > 0"><xsl:value-of select="$outputcomplextype"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+
+ <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
<xsl:choose>
- <xsl:when test="$inputWrappedCount > 0">
- <xsl:for-each select="input/param[@location='body' and @type!='']/param">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
- </xsl:for-each>
+ <xsl:when test="$inputcount=1">
+ <xsl:variable name="inputComplexType" select="input/param[@location='body' and @type!='']/@complextype"/>
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($inputComplexType)) > 0">
+ <xsl:value-of select="$inputComplexType"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
- </xsl:otherwise>
+ <xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
</xsl:choose>
+
+ <xsl:if test="$inputcount=1 and input/param[not(@location='body') and @type!='']">,</xsl:if>
+ <xsl:for-each select="input/param[not(@location='body') and @type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>)
</xsl:when>
- <xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
+ <xsl:otherwise>
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+
+ <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
+ <xsl:choose>
+ <xsl:when test="$inputcount=1">
+ <!-- Even when the parameters are 1 we have to see whether we have the
+ wrapped parameters -->
+ <xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
+ <xsl:choose>
+ <xsl:when test="$inputWrappedCount > 0">
+ <xsl:for-each select="input/param[@location='body' and @type!='']/param">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$inputcount=1 and input/param[not(@location='body') and @type!='']">,</xsl:if>
+ <xsl:for-each select="input/param[not(@location='body') and @type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>)
+ </xsl:otherwise>
</xsl:choose>
- <xsl:if test="$inputcount=1 and input/param[not(@location='body') and @type!='']">,</xsl:if>
- <xsl:for-each select="input/param[not(@location='body') and @type!='']">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
- </xsl:for-each>)
throws java.rmi.RemoteException
<!--add the faults-->
<xsl:for-each select="fault/param[@type!='']">
@@ -248,11 +284,22 @@
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
+ <!-- unwrapping takes place only if the back word compatiblity is off. if -b on
+ then we do not unwrapp and only remove the top element -->
<xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
<xsl:variable name="inputElementType" select="input/param[@location='body' and @type!='']/@type"></xsl:variable>
+ <xsl:variable name="inputElementComplexType" select="input/param[@location='body' and @type!='']/@complextype"></xsl:variable>
+ <xsl:variable name="opName" select="input/param[@location='body' and @type!='']/@opname"></xsl:variable>
<xsl:choose>
- <xsl:when test="$inputWrappedCount > 0">
+ <xsl:when test="(($isbackcompatible='true') and (string-length(normalize-space($inputElementComplexType)) > 0))">
+ <!-- there are no unwrapped parameters - go ahead and use the normal wrapped codegen-->
+ env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
+ wrap<xsl:value-of select="$opName"/>(<xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>),
+ optimizeContent(new javax.xml.namespace.QName("<xsl:value-of select="$method-ns"/>",
+ "<xsl:value-of select="$method-name"/>")));
+ </xsl:when>
+ <xsl:when test="($inputWrappedCount > 0) and not($isbackcompatible='true')">
<xsl:value-of select="$inputElementType"/><xsl:text> </xsl:text>dummyWrappedType = null;
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
<xsl:for-each select="input/param[@location='body' and @type!='']/param">
@@ -333,7 +380,15 @@
<xsl:value-of select="$outputtype"/>.class,
getEnvelopeNamespaces(_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
- return (<xsl:value-of select="$outputtype"/>)object;
+ <xsl:choose>
+ <xsl:when test="($isbackcompatible='true') and (string-length(normalize-space($outputcomplextype)) > 0)">
+ return get<xsl:value-of select="@name"/>((<xsl:value-of select="$outputtype"/>)object);
+ </xsl:when>
+ <xsl:otherwise>
+ return (<xsl:value-of select="$outputtype"/>)object;
+ </xsl:otherwise>
+ </xsl:choose>
+
</xsl:when>
<xsl:otherwise>
//Unknown style detected !! No code is generated
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl?view=diff&rev=477125&r1=477124&r2=477125
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl Mon Nov 20 01:54:58 2006
@@ -15,6 +15,7 @@
<xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
<xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
<xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+ <xsl:variable name="isbackcompatible" select="@isbackcompatible"/>
/**
* <xsl:value-of select="@name"/>.java
@@ -33,6 +34,7 @@
<!-- Code for in-out mep -->
<xsl:if test="@mep='12'">
<xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+ <xsl:variable name="outputcomplextype"><xsl:value-of select="output/param/@complextype"></xsl:value-of></xsl:variable>
<!-- start of the sync block -->
<xsl:if test="$isSync='1'">
@@ -43,34 +45,69 @@
* @param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
</xsl:text></xsl:for-each>
*/
- public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
- <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
- <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
- <xsl:choose>
- <xsl:when test="$inputcount=1">
- <!-- Even when the parameters are 1 we have to see whether we have the
- wrapped parameters -->
- <xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
+ <xsl:choose>
+ <xsl:when test="$isbackcompatible='true'">
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when>
+ <xsl:when test="string-length(normalize-space($outputcomplextype)) > 0"><xsl:value-of select="$outputcomplextype"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+
+ <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
<xsl:choose>
- <xsl:when test="$inputWrappedCount > 0">
- <xsl:for-each select="input/param[@location='body' and @type!='']/param">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
- </xsl:for-each>
+ <xsl:when test="$inputcount=1">
+ <xsl:variable name="inputComplexType" select="input/param[@location='body' and @type!='']/@complextype"/>
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($inputComplexType)) > 0">
+ <xsl:value-of select="$inputComplexType"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
+ </xsl:choose>
+
+ <xsl:if test="$inputcount=1 and input/param[not(@location='body') and @type!='']">,</xsl:if>
+ <xsl:for-each select="input/param[not(@location='body') and @type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>)
+ throws java.rmi.RemoteException
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
- </xsl:otherwise>
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise>
+ <xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+
+ <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
+ <xsl:choose>
+ <xsl:when test="$inputcount=1">
+ <!-- Even when the parameters are 1 we have to see whether we have the
+ wrapped parameters -->
+ <xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
+ <xsl:choose>
+ <xsl:when test="$inputWrappedCount > 0">
+ <xsl:for-each select="input/param[@location='body' and @type!='']/param">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/><xsl:text> </xsl:text><xsl:value-of select="input/param[@location='body' and @type!='']/@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
</xsl:choose>
- </xsl:when>
- <xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
- </xsl:choose>
-
- <xsl:if test="$inputcount=1 and input/param[not(@location='body') and @type!='']">,</xsl:if>
- <xsl:for-each select="input/param[not(@location='body') and @type!='']">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
- </xsl:for-each>)
- throws java.rmi.RemoteException
+
+ <xsl:if test="$inputcount=1 and input/param[not(@location='body') and @type!='']">,</xsl:if>
+ <xsl:for-each select="input/param[not(@location='body') and @type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>)
+ throws java.rmi.RemoteException
+ </xsl:otherwise>
+ </xsl:choose>
+
<!--add the faults-->
<xsl:for-each select="fault/param[@type!='']">
,<xsl:value-of select="@name"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org