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 am...@apache.org on 2007/02/22 08:04:31 UTC
svn commit: r510425 - in
/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl:
codegen/emitter/ codegen/extension/ template/java/
Author: amilas
Date: Wed Feb 21 23:04:30 2007
New Revision: 510425
URL: http://svn.apache.org/viewvc?view=rev&rev=510425
Log:
Added the unwrapping support.
Modified:
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/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
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=510425&r1=510424&r2=510425
==============================================================================
--- 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 Wed Feb 21 23:04:30 2007
@@ -1764,6 +1764,10 @@
rootElement.appendChild(getUniqueListofFaults(doc));
doc.appendChild(rootElement);
+
+ //////////////////////////////////////////////////////////
+// System.out.println(DOM2Writer.nodeToString(rootElement));
+ ////////////////////////////////////////////////////////////
return doc;
}
@@ -1940,8 +1944,8 @@
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR",
- "\"" + property + "\""));
+ "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR",
+ "\"" + property + "\""));
}
String mep = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WSOAP_MEP,
@@ -1951,31 +1955,31 @@
if (WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.ENABLE_REST",
- "true"));
+ "org.apache.axis2.Constants.Configuration.ENABLE_REST",
+ "true"));
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
- "\"" +
- org.apache.axis2.Constants.Configuration
- .HTTP_METHOD_GET +
- "\""));
+ "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
+ "\"" +
+ org.apache.axis2.Constants.Configuration
+ .HTTP_METHOD_GET +
+ "\""));
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.CONTENT_TYPE",
- "\"" +
- org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM +
- "\""));
+ "org.apache.axis2.Constants.Configuration.CONTENT_TYPE",
+ "\"" +
+ org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM +
+ "\""));
} else if (bindingType != null && bindingType.equals(WSDL2Constants.URI_WSDL2_HTTP)) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.ENABLE_REST",
- "true"));
+ "org.apache.axis2.Constants.Configuration.ENABLE_REST",
+ "true"));
property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_METHOD,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
- "\"" + property + "\""));
+ "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
+ "\"" + property + "\""));
}
// If there is no WHTTP_METHOD defined then we better compute the default value which is get if the operation
@@ -1985,18 +1989,18 @@
if (safe != null) {
if (((Boolean) safe.getValue()).booleanValue()) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
- "\"" +
- org.apache.axis2.Constants.Configuration
- .HTTP_METHOD_GET +
- "\""));
+ "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
+ "\"" +
+ org.apache.axis2.Constants.Configuration
+ .HTTP_METHOD_GET +
+ "\""));
} else {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
- "\"" +
- org.apache.axis2.Constants.Configuration
- .HTTP_METHOD_POST +
- "\""));
+ "org.apache.axis2.Constants.Configuration.HTTP_METHOD",
+ "\"" +
+ org.apache.axis2.Constants.Configuration
+ .HTTP_METHOD_POST +
+ "\""));
}
}
}
@@ -2006,17 +2010,17 @@
axisOperation.getName());
if (value != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED",
- "\"" + value.booleanValue() +
- "\""));
+ "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED",
+ "\"" + value.booleanValue() +
+ "\""));
}
property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_CODE,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_CODE",
- "\"" + property + "\""));
+ "org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_CODE",
+ "\"" + property + "\""));
}
property = (String) getBindingPropertyFromOperation(
@@ -2024,8 +2028,8 @@
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.Constants.Configuration.CONTENT_TYPE",
- "\"" + property + "\""));
+ "org.apache.axis2.Constants.Configuration.CONTENT_TYPE",
+ "\"" + property + "\""));
}
}
@@ -2049,8 +2053,8 @@
if (!"".equals(transferCoding)) {
if ("gzip".equals(transferCoding) || "compress".equals(transferCoding)) {
methodElement.appendChild(generateOptionParamComponent(doc,
- "org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST",
- "true"));
+ "org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST",
+ "true"));
}
}
}
@@ -2336,16 +2340,16 @@
List parameterElementList = getParameterElementList(doc, headerParameterQNameList,
WSDLConstants.SOAP_HEADER);
parameterElementList.addAll(getParameterElementListForHttpHeader(doc,
- (ArrayList) getBindingPropertyFromMessage(
- WSDL2Constants.ATTR_WHTTP_HEADER,
- operation.getName(),
- WSDLConstants.WSDL_MESSAGE_DIRECTION_IN),
- WSDLConstants.HTTP_HEADER));
+ (ArrayList) getBindingPropertyFromMessage(
+ WSDL2Constants.ATTR_WHTTP_HEADER,
+ operation.getName(),
+ WSDLConstants.WSDL_MESSAGE_DIRECTION_IN),
+ WSDLConstants.HTTP_HEADER));
parameterElementList.addAll(getParameterElementListForSOAPModules(doc,
- (ArrayList) getBindingPropertyFromMessage(
- WSDL2Constants.ATTR_WSOAP_MODULE,
- operation.getName(),
- WSDLConstants.WSDL_MESSAGE_DIRECTION_IN)));
+ (ArrayList) getBindingPropertyFromMessage(
+ WSDL2Constants.ATTR_WSOAP_MODULE,
+ operation.getName(),
+ WSDLConstants.WSDL_MESSAGE_DIRECTION_IN)));
for (int i = 0; i < parameterElementList.size(); i++) {
inputElt.appendChild((Element) parameterElementList.get(i));
@@ -2553,10 +2557,8 @@
for (int i = 0; i < partsList.size(); i++) {
QName qName = (QName) partsList.get(i);
mainParameter.appendChild(generateParamComponent(doc,
- this.mapper.getParameterName(
- qName),
- this.mapper.getTypeMappingName(
- qName),
+ this.mapper.getParameterName(qName),
+ this.mapper.getTypeMappingName(qName),
operation.getName(),
qName,
qName.getLocalPart(),
@@ -2565,8 +2567,6 @@
);
}
- // apart from the parts list we need to get the wrapping classname
- // as well
}
@@ -2736,6 +2736,38 @@
Parameter parameter = outputMessage.getParameter(Constants.COMPLEX_TYPE);
addAttribute(doc, "complextype", (String) parameter.getValue(), paramElement);
}
+ }
+
+ // 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 (outputMessage.getParameter(Constants.UNWRAPPED_KEY) != null) {
+
+ //we have this unwrapped earlier. get the info holder
+ //and then look at the parameters
+ Parameter detailsParameter =
+ outputMessage.getParameter(Constants.UNWRAPPED_DETAILS);
+ MessagePartInformationHolder infoHolder =
+ (MessagePartInformationHolder) detailsParameter.getValue();
+ List partsList = infoHolder.getPartsList();
+
+ //populate the parts list - this list is needed to generate multiple
+ //parameters in the signatures
+ // in out put params we only intersted if there is only one parameter
+ // otherwise we can not unwrap it.
+ if (partsList.size() == 1){
+ QName qName = (QName) partsList.get(0);
+ paramElement.appendChild(generateParamComponent(doc,
+ this.mapper.getParameterName(qName),
+ this.mapper.getTypeMappingName(qName),
+ operation.getName(),
+ qName,
+ qName.getLocalPart(),
+ (this.mapper.getTypeMappingStatus(qName) != null),
+ Constants.ARRAY_TYPE.equals(this.mapper.getTypeMappingStatus(qName)))
+ );
+ }
+
}
QName paramQName = outputMessage.getElementQName();
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=510425&r1=510424&r2=510425
==============================================================================
--- 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 Wed Feb 21 23:04:30 2007
@@ -84,8 +84,13 @@
AxisOperation op = (AxisOperation) operations.next();
if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
- walkSchema(op.getMessage(
- WSDLConstants.MESSAGE_LABEL_IN_VALUE));
+ walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE),
+ WSDLConstants.INPUT_PART_QNAME_SUFFIX);
+ }
+ // get the out put parameter details as well to unwrap the responses
+ if (WSDLUtil.isOutputPresentForMEP(op.getMessageExchangePattern())){
+ walkSchema(op.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE),
+ WSDLConstants.OUTPUT_PART_QNAME_SUFFIX);
}
}
@@ -106,7 +111,7 @@
* < /element >
*/
- public void walkSchema(AxisMessage message)
+ public void walkSchema(AxisMessage message, String qnameSuffix)
throws CodeGenerationException {
//nothing to unwrap
if (message.getSchemaElement() == null) {
@@ -119,7 +124,7 @@
XmlSchemaElement schemaElement = message.getSchemaElement();
XmlSchemaType schemaType = schemaElement.getSchemaType();
- handleAllCasesOfComplexTypes(schemaType, message, partNameList);
+ handleAllCasesOfComplexTypes(schemaType, message, partNameList, qnameSuffix);
try {
//set in the axis message that the unwrapping was success
@@ -144,7 +149,10 @@
}
- private void handleAllCasesOfComplexTypes(XmlSchemaType schemaType, AxisMessage message, List partNameList) throws CodeGenerationException {
+ private void handleAllCasesOfComplexTypes(XmlSchemaType schemaType,
+ AxisMessage message,
+ List partNameList,
+ String qnameSuffix) throws CodeGenerationException {
// if a complex type name exits for a element then
// we keep that complex type to support unwrapping
@@ -153,11 +161,11 @@
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
if (cmplxType.getContentModel() == null) {
if (cmplxType.getParticle() != null){
- processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList);
+ processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList, qnameSuffix);
}
} else {
// now lets handle case with extensions
- processComplexContentModel(cmplxType, message, partNameList);
+ processComplexContentModel(cmplxType, message, partNameList, qnameSuffix);
}
@@ -168,7 +176,10 @@
}
}
- private void processComplexContentModel(XmlSchemaComplexType cmplxType, AxisMessage message, List partNameList) throws CodeGenerationException {
+ private void processComplexContentModel(XmlSchemaComplexType cmplxType,
+ AxisMessage message,
+ List partNameList,
+ String qnameSuffix) throws CodeGenerationException {
XmlSchemaContentModel contentModel = cmplxType.getContentModel();
if (contentModel instanceof XmlSchemaComplexContent) {
XmlSchemaComplexContent xmlSchemaComplexContent = (XmlSchemaComplexContent) contentModel;
@@ -178,7 +189,7 @@
// process particles inside this extension, if any
if (schemaExtension.getParticle() != null){
- processXMLSchemaSequence(schemaExtension.getParticle(), message, partNameList);
+ processXMLSchemaSequence(schemaExtension.getParticle(), message, partNameList, qnameSuffix);
}
// now we need to get the schema of the extension type from the parent schema. For that let's first retrieve
@@ -199,12 +210,15 @@
XmlSchemaType extensionSchemaType = parentSchema.getTypeByName(schemaExtension.getBaseTypeName());
- handleAllCasesOfComplexTypes(extensionSchemaType, message, partNameList);
+ handleAllCasesOfComplexTypes(extensionSchemaType, message, partNameList, qnameSuffix);
}
}
}
- private void processXMLSchemaSequence(XmlSchemaParticle schemaParticle, AxisMessage message, List partNameList) throws CodeGenerationException {
+ private void processXMLSchemaSequence(XmlSchemaParticle schemaParticle,
+ AxisMessage message,
+ List partNameList,
+ String qnameSuffix) throws CodeGenerationException {
if (schemaParticle instanceof XmlSchemaSequence) {
// get the name of the operation name and namespace,
// part name and hang them somewhere ? The ideal place
@@ -240,7 +254,7 @@
partNameList.add(
WSDLUtil.getPartQName(opName.getLocalPart(),
- WSDLConstants.INPUT_PART_QNAME_SUFFIX,
+ qnameSuffix,
partName));
// if the particle contains anything other than
@@ -256,7 +270,7 @@
partNameList.add(
WSDLUtil.getPartQName(opName.getLocalPart(),
- WSDLConstants.INPUT_PART_QNAME_SUFFIX,
+ qnameSuffix,
Constants.ANY_ELEMENT_FIELD_NAME));
} else {
throw new CodeGenerationException(CodegenMessages.getMessage("extension.unsupportedSchemaFormat",
@@ -291,7 +305,6 @@
Parameter myParameter = new Parameter();
myParameter.setName(key);
myParameter.setValue(value);
-
return myParameter;
}
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=510425&r1=510424&r2=510425
==============================================================================
--- 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 Wed Feb 21 23:04:30 2007
@@ -1,81 +1,93 @@
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="text"/>
- <xsl:template match="/callback">
- /**
- * <xsl:value-of select="@name"/>.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis2 version: #axisVersion# #today#
- */
- package <xsl:value-of select="@package"/>;
-
- /**
- * <xsl:value-of select="@name"/> Callback class, Users can extend this class and implement
- * their own receiveResult and receiveError methods.
- */
- public abstract class <xsl:value-of select="@name"/>{
-
-
-
- protected Object clientData;
-
- /**
- * User can pass in any object that needs to be accessed once the NonBlocking
- * Web service call is finished and appropriate method of this CallBack is called.
- * @param clientData Object mechanism by which the user can pass in user data
- * that will be avilable at the time this callback is called.
- */
- public <xsl:value-of select="@name"/>(Object clientData){
- this.clientData = clientData;
- }
-
- /**
- * Please use this constructor if you don't want to set any clientData
- */
- public <xsl:value-of select="@name"/>(){
- this.clientData = null;
- }
-
- /**
- * Get the client data
- */
-
- public Object getClientData() {
- return clientData;
- }
-
- <xsl:for-each select="method">
- <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
- They should be parts of this xsl:choose loop -->
- <xsl:when test="$mep='12'">
- /**
- * auto generated Axis2 call back method for <xsl:value-of select="@name"/> method
- *
- */
- public void receiveResult<xsl:value-of select="@name"/>(
- <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>) {
- }
-
- /**
- * auto generated Axis2 Error handler
- *
- */
- public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e) {
- }
- </xsl:when>
- <xsl:otherwise>
- // No methods generated for meps other than in-out
- </xsl:otherwise>
- </xsl:choose>
-
-
- </xsl:for-each>
-
-
- }
- </xsl:template>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+ <xsl:template match="/callback">
+ /**
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+ package <xsl:value-of select="@package"/>;
+
+ /**
+ * <xsl:value-of select="@name"/> Callback class, Users can extend this class and implement
+ * their own receiveResult and receiveError methods.
+ */
+ public abstract class <xsl:value-of select="@name"/>{
+
+
+
+ protected Object clientData;
+
+ /**
+ * User can pass in any object that needs to be accessed once the NonBlocking
+ * Web service call is finished and appropriate method of this CallBack is called.
+ * @param clientData Object mechanism by which the user can pass in user data
+ * that will be avilable at the time this callback is called.
+ */
+ public <xsl:value-of select="@name"/>(Object clientData){
+ this.clientData = clientData;
+ }
+
+ /**
+ * Please use this constructor if you don't want to set any clientData
+ */
+ public <xsl:value-of select="@name"/>(){
+ this.clientData = null;
+ }
+
+ /**
+ * Get the client data
+ */
+
+ public Object getClientData() {
+ return clientData;
+ }
+
+ <xsl:for-each select="method">
+ <xsl:variable name="outParamType" select="output/param[@location='body']/@type"></xsl:variable>
+ <xsl:variable name="outParamName" select="output/param/@name"></xsl:variable>
+ <xsl:variable name="outParamComplexType" select="output/param[@location='body']/@complextype"></xsl:variable>
+ <xsl:variable name="outParamCount" select="count(output/param[@location='body']/param)"></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
+ They should be parts of this xsl:choose loop -->
+ <xsl:when test="$mep='12'">
+ /**
+ * auto generated Axis2 call back method for <xsl:value-of select="@name"/> method
+ *
+ */
+ public void receiveResult<xsl:value-of select="@name"/>(
+ <xsl:choose>
+ <xsl:when test="$outParamCount=1">
+ <xsl:value-of select="output/param[@location='body']/param/@type"/><xsl:text> </xsl:text>result
+ </xsl:when>
+ <xsl:when test="string-length(normalize-space($outParamComplexType)) > 0">
+ <xsl:value-of select="$outParamComplexType"/><xsl:text> </xsl:text>result
+ </xsl:when>
+ <xsl:when test="string-length(normalize-space($outParamType)) > 0">
+ <xsl:value-of select="$outParamType"/><xsl:text> </xsl:text>result
+ </xsl:when>
+ </xsl:choose>) {
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ *
+ */
+ public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e) {
+ }
+ </xsl:when>
+ <xsl:otherwise>
+ // No methods generated for meps other than in-out
+ </xsl:otherwise>
+ </xsl:choose>
+
+
+ </xsl:for-each>
+
+
+ }
+ </xsl:template>
</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=510425&r1=510424&r2=510425
==============================================================================
--- 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 Wed Feb 21 23:04:30 2007
@@ -174,13 +174,16 @@
<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:variable>
- <xsl:variable name="outputcomplextype"><xsl:value-of select="output/param/@complextype"/></xsl:variable>
- <xsl:variable name="outputopname"><xsl:value-of select="output/param/@opname"/></xsl:variable>
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param[@location='body']/@type"/></xsl:variable>
+ <xsl:variable name="outputcomplextype"><xsl:value-of select="output/param[@location='body']/@complextype"/></xsl:variable>
+ <xsl:variable name="outputopname"><xsl:value-of select="output/param[@location='body']/@opname"/></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>
-
+ <xsl:variable name="outputparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"/></xsl:variable>
+ <xsl:variable name="outputparamshorttype"><xsl:value-of select="output/param[@location='body']/@shorttype"/></xsl:variable>
+ <xsl:variable name="outputparampartname"><xsl:value-of select="output/param[@location='body']/param/@partname"/></xsl:variable>
+
<!-- MTOM -->
<xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
<xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
@@ -227,7 +230,12 @@
</xsl:for-each>)
</xsl:when>
<xsl:otherwise>
- public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ public <xsl:choose>
+ <xsl:when test="$outputtype=''">void</xsl:when>
+ <xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></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!=''])"/>
@@ -297,7 +305,6 @@
<xsl:choose>
<!-- style being doclit or rpc does not matter -->
<xsl:when test="$style='rpc' or $style='document'">
- //Style is Doc.
<xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
<xsl:choose>
<xsl:when test="$inputcount=1">
@@ -426,7 +433,12 @@
getEnvelopeNamespaces(_returnEnv));
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
<xsl:choose>
- <xsl:when test="($isbackcompatible='true') and (string-length(normalize-space($outputcomplextype)) > 0)">
+ <xsl:when test="$outputparamcount=1">
+ return get<xsl:value-of select="$outputparamshorttype"/><xsl:value-of
+ select="$outputparampartname"/>((<xsl:value-of select="$outputtype"/>)object);
+ </xsl:when>
+ <!-- this covers both back compatibility and normal unwrapping -->
+ <xsl:when test="(string-length(normalize-space($outputcomplextype)) > 0)">
return get<xsl:value-of select="$outputopname"/>((<xsl:value-of select="$outputtype"/>)object);
</xsl:when>
<xsl:otherwise>
@@ -670,7 +682,22 @@
<xsl:value-of select="$outputtype"/>.class,
getEnvelopeNamespaces(result.getResponseEnvelope())
);
- callback.receiveResult<xsl:value-of select="@name"/>((<xsl:value-of select="$outputtype"/>) object);
+ callback.receiveResult<xsl:value-of select="@name"/>(
+ <xsl:choose>
+ <xsl:when test="$outputtype=''">
+ );
+ </xsl:when>
+ <xsl:when test="$outputparamcount=1">
+ (<xsl:value-of select="output/param[@location='body']/param/@type"/>)object);
+ </xsl:when>
+ <xsl:when test="string-length(normalize-space($outputcomplextype)) > 0">
+ (<xsl:value-of select="$outputcomplextype"/>)object);
+ </xsl:when>
+ <xsl:otherwise>
+ (<xsl:value-of select="$outputtype"/>)object);
+ </xsl:otherwise>
+ </xsl:choose>
+
}
public void onError(java.lang.Exception e) {
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=510425&r1=510424&r2=510425
==============================================================================
--- 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 Wed Feb 21 23:04:30 2007
@@ -33,8 +33,9 @@
<xsl:for-each select="method">
<!-- 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>
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param[@location='body']/@type"></xsl:value-of></xsl:variable>
+ <xsl:variable name="outputcomplextype"><xsl:value-of select="output/param[@location='body']/@complextype"></xsl:value-of></xsl:variable>
+ <xsl:variable name="outputparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"></xsl:value-of></xsl:variable>
<!-- start of the sync block -->
<xsl:if test="$isSync='1'">
@@ -76,8 +77,13 @@
throws java.rmi.RemoteException
</xsl:when>
<xsl:otherwise>
- public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise>
- <xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ public <xsl:choose>
+ <xsl:when test="$outputtype=''">void</xsl:when>
+ <xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></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!=''])"/>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?view=diff&rev=510425&r1=510424&r2=510425
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Wed Feb 21 23:04:30 2007
@@ -64,9 +64,12 @@
<xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
<xsl:variable name="style"><xsl:value-of select="@style"/></xsl:variable>
- <xsl:variable name="returntype" select="output/param/@type"/>
- <xsl:variable name="returnvariable" select="output/param/@name"/>
- <xsl:variable name="returncomplextype"><xsl:value-of select="output/param/@complextype"/></xsl:variable>
+ <xsl:variable name="returntype" select="output/param[@location='body']/@type"/>
+ <xsl:variable name="returnvariable" select="output/param[@location='body']/@name"/>
+ <xsl:variable name="returncomplextype"><xsl:value-of select="output/param[@location='body']/@complextype"/></xsl:variable>
+ <xsl:variable name="returnparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"/></xsl:variable>
+ <xsl:variable name="returnshorttype"><xsl:value-of select="output/param[@location='body']/@shorttype"/></xsl:variable>
+ <xsl:variable name="returnpartname"><xsl:value-of select="output/param[@location='body']/param/@partname"/></xsl:variable>
<xsl:if test="string-length(normalize-space($returntype)) > 0">
<xsl:value-of select="$returntype"/>
@@ -126,6 +129,7 @@
</xsl:choose>
</xsl:when>
<xsl:otherwise>
+
<xsl:choose>
<xsl:when test="$inputcount=1">
<xsl:value-of select="$inputtype"/> wrappedParam =
@@ -135,35 +139,59 @@
getEnvelopeNamespaces(msgContext.getEnvelope()));
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
+ <xsl:if test="string-length(normalize-space($returntype)) > 0"><xsl:value-of select="$returnvariable"/> =
+ <!-- set the response wrappers if unwrapping on -->
+ <xsl:choose>
+ <xsl:when test="$returnparamcount=1">
+ wrap<xsl:value-of select="$returnshorttype"/><xsl:value-of
+ select="$returnpartname"/>(
+ </xsl:when>
+ <xsl:when test="string-length(normalize-space($returncomplextype)) > 0">
+ wrap<xsl:value-of select="$operationName"/>(
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
<xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
<xsl:choose>
- <xsl:when test="$inputWrappedCount > 0">
+ <xsl:when test="($inputWrappedCount > 0)">
<!-- generate the references. the getters need to be
generated by the databinding-->
- <!--<xsl:for-each select="input/param[@location='body' and @type!='']/param">-->
- <!--<xsl:value-of select="@type"/> param<xsl:value-of select="position()"/>-->
- <!--= get<xsl:value-of select="@partname"/>(wrappedParam);-->
- <!--</xsl:for-each>-->
-
- <xsl:if test="string-length(normalize-space($returntype)) > 0"><xsl:value-of select="$returnvariable"/> =</xsl:if>
- skel.<xsl:value-of select="@name"/>(
- <xsl:for-each select="input/param[@location='body' and @type!='']/param">
- <xsl:if test="position() > 1">,</xsl:if>
- get<xsl:value-of select="@partname"/>(wrappedParam)
- </xsl:for-each>
-
- );
+ <!-- wrap it if it in unwarping mode -->
+ skel.<xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param[@location='body' and @type!='']/param">
+ <xsl:if test="position() > 1">,</xsl:if>
+ get<xsl:value-of select="@partname"/>(wrappedParam)
+ </xsl:for-each>)
</xsl:when>
<xsl:otherwise>
- <xsl:if test="string-length(normalize-space($returntype)) > 0"><xsl:value-of select="$returnvariable"/> =</xsl:if>
- skel.<xsl:value-of select="@name"/>(wrappedParam) ;
+ skel.<xsl:value-of select="@name"/>(wrappedParam)
</xsl:otherwise>
</xsl:choose>
+ <xsl:if test="string-length(normalize-space($returntype)) > 0">
+ <xsl:if test="($returnparamcount=1) or (string-length(normalize-space($returncomplextype)) > 0)">
+ )
+ </xsl:if>
+ </xsl:if>;
</xsl:when>
<xsl:otherwise>
- <xsl:if test="string-length(normalize-space($returntype)) > 0"><xsl:value-of select="$returnvariable"/> =</xsl:if>
- skel.<xsl:value-of select="@name"/>();
+ <xsl:if test="string-length(normalize-space($returntype)) > 0"><xsl:value-of select="$returnvariable"/> =
+ <xsl:choose>
+ <xsl:when test="$returnparamcount=1">
+ wrap<xsl:value-of select="$returnshorttype"/><xsl:value-of
+ select="$returnpartname"/>(
+ </xsl:when>
+ <xsl:when test="string-length(normalize-space($returncomplextype)) > 0">
+ wrap<xsl:value-of select="$operationName"/>(
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ skel.<xsl:value-of select="@name"/>()
+ <xsl:if test="string-length(normalize-space($returntype)) > 0">
+ <xsl:if test="($returnparamcount=1) or (string-length(normalize-space($returncomplextype)) > 0)">
+ )
+ </xsl:if>
+ </xsl:if>;
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl?view=diff&rev=510425&r1=510424&r2=510425
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl Wed Feb 21 23:04:30 2007
@@ -17,6 +17,7 @@
<xsl:variable name="count"><xsl:value-of select="count(output/param)"/></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="outputparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"/></xsl:variable>
<!-- regardless of the sync or async status, the generated method signature would be just a usual
java method -->
/**
@@ -49,7 +50,12 @@
)
</xsl:when>
<xsl:otherwise>
- public <xsl:if test="$count=0 or $outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ public <xsl:choose>
+ <xsl:when test="$count=0 or $outputtype=''">void</xsl:when>
+ <xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></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>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl?view=diff&rev=510425&r1=510424&r2=510425
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl Wed Feb 21 23:04:30 2007
@@ -18,6 +18,7 @@
<xsl:variable name="count"><xsl:value-of select="count(output/param)"/></xsl:variable>
<xsl:variable name="outputtype" select="output/param/@type"/>
<xsl:variable name="outputcomplextype"><xsl:value-of select="output/param/@complextype"/></xsl:variable>
+ <xsl:variable name="outputparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"/></xsl:variable>
<!-- regardless of the sync or async status, the generated method signature would be just a usual
java method -->
/**
@@ -54,7 +55,13 @@
)
</xsl:when>
<xsl:otherwise>
- public <xsl:if test="$count=0 or $outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+
+ public <xsl:choose>
+ <xsl:when test="$count=0 or $outputtype=''">void</xsl:when>
+ <xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></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>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org