You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/05/15 06:06:42 UTC
svn commit: r170193 - in
/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl: ./
codegen/ codegen/emitter/ template/csharp/ template/java/
Author: ajith
Date: Sat May 14 21:06:40 2005
New Revision: 170193
URL: http://svn.apache.org/viewcvs?rev=170193&view=rev
Log:
made few changes
1.Added the sync/Async selection capability
2.Added the async call back generation
3.Updates the commandline options parser
4.Added and completed the IKVM based C# code generation
Added:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/BeanTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/CallbackHandlerTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceImplementationTemplate.xsl
Modified:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/BeanTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/CallbackHandlerTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java Sat May 14 21:06:40 2005
@@ -19,9 +19,13 @@
}
private static void printUsage(){
- System.out.println("Usage WSDL2Java -URI <Location of WSDL> ");
- System.out.println("-o <output Location> ");
- System.out.println("-x ");
+ System.out.println("Usage WSDL2Java -URI <Location of WSDL> :WSDL file location ");
+ System.out.println("-o <output Location> : output file location ");
+ System.out.println("-x : Switch to advanced mode. Default is off");
+ System.out.println("-a : Generate async style code only. Default if off");
+ System.out.println("-s : Generate sync style code only. Default if off. takes precedence over -a");
+ System.out.println("-p <package name> : set custom package name");
+ System.out.println("-l <language> : valid languages are java and csharp. Default is java");
System.exit(0);
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java Sat May 14 21:06:40 2005
@@ -19,6 +19,7 @@
import org.apache.wsdl.WSDLDescription;
import java.io.File;
+import java.util.Map;
/**
* @author chathura@opensource.lk
@@ -31,6 +32,9 @@
private File outputLocation;
private int outputLanguage = XSLTConstants.LanguageTypes.JAVA;
private boolean advancedCodeGenEnabled=false;
+ private boolean asyncOn=true;
+ private boolean syncOn=true;
+ private String packageName=XSLTConstants.DEFAULT_PACKAGE_NAME;
/**
* @param wom
@@ -38,17 +42,43 @@
*/
public CodeGenConfiguration(WSDLDescription wom,
CommandLineOptionParser parser) {
- this.wom = wom;
+ this.wom = wom;
this.parser = parser;
- String outputLocation = ((CommandLineOption) parser.getAllOptions().get(
- OUTPUT_LOCATION_OPTION)).getOptionValue();
- advancedCodeGenEnabled = (parser.getAllOptions().get(ADVANCED_CODEGEN_OPTION)!=null);
- this.outputLocation = new File(outputLocation);
+ Map optionMap = parser.getAllOptions();
+
+ String outputLocation = ((CommandLineOption)optionMap.get(OUTPUT_LOCATION_OPTION)).getOptionValue();
+ this.outputLocation = new File(outputLocation);
+
+ advancedCodeGenEnabled = (optionMap.get(ADVANCED_CODEGEN_OPTION)!=null);
+ boolean asyncFlagPresent = (optionMap.get(CODEGEN_ASYNC_ONLY_OPTION)!=null);
+ boolean syncFlagPresent = (optionMap.get(CODEGEN_SYNC_ONLY_OPTION)!=null);
+ if (asyncFlagPresent) {this.asyncOn=true;this.syncOn=false;}
+ if (syncFlagPresent) {this.asyncOn=false;this.syncOn=true;}
+
+ CommandLineOption packageOption = (CommandLineOption)optionMap.get(PACKAGE_OPTION);
+ if(packageOption!=null) {this.packageName = packageOption.getOptionValue();}
+
+ CommandLineOption langOption = (CommandLineOption)optionMap.get(STUB_LANGUAGE_OPTION);
+ if (langOption!=null){
+ loadLanguge(langOption.getOptionValue());
+ }
}
- /**
+ private void loadLanguge(String langName) {
+ if (LanguageNames.JAVA.equalsIgnoreCase(langName)){
+ this.outputLanguage = XSLTConstants.LanguageTypes.JAVA;
+ }else if (LanguageNames.C_SHARP.equalsIgnoreCase(langName)){
+ this.outputLanguage = XSLTConstants.LanguageTypes.C_SHARP;
+ }else if (LanguageNames.C_PLUS_PLUS.equalsIgnoreCase(langName)){
+ this.outputLanguage = XSLTConstants.LanguageTypes.C_PLUS_PLUS;
+ }else if (LanguageNames.VB_DOT_NET.equalsIgnoreCase(langName)){
+ this.outputLanguage = XSLTConstants.LanguageTypes.VB_DOT_NET;
+ }
+ }
+
+ /**
* @return Returns the parser.
*/
public CommandLineOptionParser getParser() {
@@ -76,5 +106,18 @@
public boolean isAdvancedCodeGenEnabled() {
return advancedCodeGenEnabled;
+ }
+
+ public boolean isAsyncOn() {
+ return asyncOn;
+ }
+
+
+ public boolean isSyncOn() {
+ return syncOn;
+ }
+
+ public String getPackageName() {
+ return packageName;
}
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java Sat May 14 21:06:40 2005
@@ -84,6 +84,7 @@
case XSLTConstants.LanguageTypes.C_SHARP:
clientEmitter = new CSharpEmitter(this.configuration);
+ break;
case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
case XSLTConstants.LanguageTypes.VB_DOT_NET:
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java Sat May 14 21:06:40 2005
@@ -1,18 +1,18 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2001-2004 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.apache.axis.wsdl.codegen;
@@ -24,69 +24,72 @@
*/
public class CommandLineOption implements CommandLineOptionConstants {
- private String type;
-
- private ArrayList optionValues;
-
- private boolean invalid = false;
-
- public CommandLineOption(String type, String[] values){
- this.type = type;
- ArrayList arrayList = new ArrayList(values.length);
- for(int i =0; i< values.length; i++){
- arrayList.add(values[i]);
- }
- }
-
- /**
- * @param type
- * @param optionValues
- */
- public CommandLineOption(String type, ArrayList values) {
-
- if (("-" + WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(type)) {
- this.type = WSDL_LOCATION_URI_OPTION;
- } else if (("-" + OUTPUT_LOCATION_OPTION).equalsIgnoreCase(type)) {
- this.type = OUTPUT_LOCATION_OPTION;
- }else if (("-" + ADVANCED_CODEGEN_OPTION).equalsIgnoreCase(type)) {
- this.type = ADVANCED_CODEGEN_OPTION;
- } else {
- this.invalid = true;
- }
-
- if (null != values) {
-
- this.optionValues = values ;
- }
- }
-
- /**
- * @return Returns the type.
- * @see <code>CommandLineOptionConstans</code>
- */
- public String getType() {
- return type;
- }
-
- /**
- * @return Returns the optionValues.
- */
- public String getOptionValue() {
- return (String)optionValues.get(0);
- }
-
- /**
- * @return Returns the invalid.
- */
- public boolean isInvalid() {
- return invalid;
- }
-
-
- /**
- * @return Returns the optionValues.
- */
- public ArrayList getOptionValues() {
- return optionValues;
- }
+ private String type;
+ private ArrayList optionValues;
+ private boolean invalid = false;
+
+ public CommandLineOption(String type, String[] values){
+ this.type = type;
+ ArrayList arrayList = new ArrayList(values.length);
+ for(int i =0; i< values.length; i++){
+ arrayList.add(values[i]);
+ }
+ }
+
+ /**
+ * @param type
+ */
+ public CommandLineOption(String type, ArrayList values) {
+ if (type.startsWith("-")) type = type.replaceFirst("-","");
+ type = type.toLowerCase();
+ this.type = type;
+ this.validate(type);
+
+ if (null != values) {
+ this.optionValues = values ;
+ }
+ }
+
+ /**
+ * @return Returns the type.
+ * @see <code>CommandLineOptionConstans</code>
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * @return Returns the optionValues.
+ */
+ public String getOptionValue() {
+ if (optionValues!=null)
+ return (String)optionValues.get(0);
+ else
+ return null;
+ }
+
+ /**
+ * @return Returns the invalid.
+ */
+ public boolean isInvalid() {
+ return invalid;
+ }
+
+
+ /**
+ * @return Returns the optionValues.
+ */
+ public ArrayList getOptionValues() {
+ return optionValues;
+ }
+
+ private void validate(String optionType){
+ invalid = !((WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(optionType) ||
+ (OUTPUT_LOCATION_OPTION).equalsIgnoreCase(optionType) ||
+ (ADVANCED_CODEGEN_OPTION).equalsIgnoreCase(optionType) ||
+ (CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
+ (CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
+ (PACKAGE_OPTION).equalsIgnoreCase(optionType)||
+ (STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType));
+ }
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java Sat May 14 21:06:40 2005
@@ -27,6 +27,18 @@
public static final String WSDL_LOCATION_URI_OPTION = "uri";
public static final String OUTPUT_LOCATION_OPTION = "o";
public static final String ADVANCED_CODEGEN_OPTION = "x";
+ public static final String CODEGEN_ASYNC_ONLY_OPTION = "a";
+ public static final String CODEGEN_SYNC_ONLY_OPTION = "s";
+ public static final String PACKAGE_OPTION = "p";
+ public static final String STUB_LANGUAGE_OPTION = "l";
public static final String INVALID_OPTION= "INVALID_OPTION";
+
+ public interface LanguageNames{
+ public static final String JAVA="java";
+ public static final String C_SHARP="cs";
+ public static final String VB_DOT_NET="vb";
+ public static final String C_PLUS_PLUS="cpp";
+
+ }
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java Sat May 14 21:06:40 2005
@@ -18,6 +18,8 @@
* Constants for the XSLT related items
*/
public interface XSLTConstants {
+ String DEFAULT_PACKAGE_NAME = "codegen";
+
/**
* Language constants
*/
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java Sat May 14 21:06:40 2005
@@ -3,6 +3,7 @@
import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis.wsdl.databinding.CsharpTypeMapper;
import org.apache.axis.wsdl.databinding.TypeMapper;
+import org.apache.axis.wsdl.databinding.DefaultTypeMapper;
import org.apache.crimson.tree.XmlDocument;
import org.apache.wsdl.WSDLBinding;
import org.apache.wsdl.WSDLInterface;
@@ -34,7 +35,8 @@
public CSharpEmitter(CodeGenConfiguration configuration) {
this.configuration = configuration;
- this.mapper = new CsharpTypeMapper();
+// this.mapper = new CsharpTypeMapper();
+ this.mapper = new DefaultTypeMapper();
}
@@ -44,69 +46,5 @@
}
-
- /**
- * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterface(org.apache.wsdl.WSDLBinding)
- * @param binding
- * @return
- */
- protected XmlDocument createDOMDocuementForInterface(WSDLBinding binding){
- WSDLInterface boundInterface = binding.getBoundInterface();
-
- XmlDocument doc = new XmlDocument();
- Element rootElement = doc.createElement("interface");
-
- Attr packageAttribute = doc.createAttribute("package");
- packageAttribute.setValue("something"); //todo set this
- rootElement.setAttributeNode(packageAttribute);
-
- Attr nameAttribute = doc.createAttribute("name");
- nameAttribute.setValue(boundInterface.getName().getLocalPart());
- rootElement.setAttributeNode(nameAttribute);
-
- Collection col = boundInterface.getOperations().values();
-
- Element methodElement = null;
- Attr methodNameAttr = null;
- WSDLOperation operation = null;
-
- for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-
- operation = (WSDLOperation) iterator.next();
-
- methodElement = doc.createElement("method");
- methodNameAttr = doc.createAttribute("name");
- methodNameAttr.setValue(operation.getName().getLocalPart());
- methodElement.setAttributeNode(methodNameAttr);
-
- methodElement.appendChild(getInputElement(doc,operation));
- methodElement.appendChild(getOutputElement(doc,operation));
-
- rootElement.appendChild(methodElement);
-
- }
- doc.appendChild(rootElement);
- return doc;
-
- }
-
- /**
- * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterfaceImplementation(org.apache.wsdl.WSDLBinding)
- * @param binding
- * @return
- */
- protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
- return null;
- }
-
- /**
- *
- * @param binding
- * @return
- */
- protected XmlDocument createDOMDocumentForCallbackHandler(WSDLBinding binding) {
- return null;
- }
-
-
+
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java Sat May 14 21:06:40 2005
@@ -4,16 +4,6 @@
import org.apache.axis.wsdl.codegen.CodeGenerationException;
import org.apache.axis.wsdl.databinding.JavaTypeMapper;
import org.apache.axis.wsdl.databinding.TypeMapper;
-import org.apache.crimson.tree.XmlDocument;
-import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLInterface;
-import org.apache.wsdl.WSDLOperation;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Iterator;
/*
* Copyright 2004,2005 The Apache Software Foundation.
@@ -57,138 +47,12 @@
public void emitStub() throws CodeGenerationException {
//todo need to out the type mapper code here
- //it can be the
-
super.emitStub();
}
-
- protected XmlDocument createDOMDocumentForCallbackHandler(WSDLBinding binding){
- WSDLInterface boundInterface = binding.getBoundInterface();
- XmlDocument doc = new XmlDocument();
- Element rootElement = doc.createElement("class");
-
- Attr packageAttrebute = doc.createAttribute("package");
- packageAttrebute.setValue("something"); //todo set this
- rootElement.setAttributeNode(packageAttrebute);
-
- Attr nameAttribute = doc.createAttribute("name");
- nameAttribute.setValue(boundInterface.getName().getLocalPart()+ "CallbackHandler");
- rootElement.setAttributeNode(nameAttribute);
-
- Attr nameSpaceAttribute = doc.createAttribute("namespace");
- nameSpaceAttribute.setValue(boundInterface.getName().getNamespaceURI());
- rootElement.setAttributeNode(nameSpaceAttribute);
- //TODO JAXRPC mapping support should be considered
- this.loadOperations(boundInterface, doc, rootElement, "on", "Complete");
-
- doc.appendChild(rootElement);
-
- try {
- doc.write(System.out);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return doc;
- }
-
- /**
- * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterface(org.apache.wsdl.WSDLBinding)
- * @param binding
- * @return
- */
- protected XmlDocument createDOMDocuementForInterface(WSDLBinding binding){
- WSDLInterface boundInterface = binding.getBoundInterface();
-
- XmlDocument doc = new XmlDocument();
- Element rootElement = doc.createElement("interface");
-
- Attr packageAttribute = doc.createAttribute("package");
- packageAttribute.setValue("something"); //todo set this
- rootElement.setAttributeNode(packageAttribute);
-
- Attr nameAttribute = doc.createAttribute("name");
- nameAttribute.setValue(boundInterface.getName().getLocalPart());
- rootElement.setAttributeNode(nameAttribute);
-
- loadOperations(boundInterface, doc, rootElement);
-
- doc.appendChild(rootElement);
-
- return doc;
-
- }
-
- private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement){
- loadOperations(boundInterface, doc, rootElement, null, null);
- }
-
- private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement, String operationPrefix, String operationPostfix) {
- Collection col = boundInterface.getOperations().values();
-
- Element methodElement = null;
- Attr methodNameAttr = null;
- Attr methodURIAttr = null;
- WSDLOperation operation = null;
-
- for (Iterator iterator = col.iterator(); iterator.hasNext();) {
-
- operation = (WSDLOperation) iterator.next();
- methodElement = doc.createElement("method");
- methodNameAttr = doc.createAttribute("name");
- methodNameAttr.setValue(operationPrefix + operation.getName().getLocalPart() + operationPostfix);
- methodElement.setAttributeNode(methodNameAttr);
- methodURIAttr = doc.createAttribute("namepace");
- methodURIAttr.setValue(operation.getName().getNamespaceURI());
- methodElement.setAttributeNode(methodURIAttr);
- methodElement.appendChild(getInputElement(doc,operation));
- methodElement.appendChild(getOutputElement(doc,operation));
-
- rootElement.appendChild(methodElement);
-
- }
- }
- /**
- * @see org.apache.axis.wsdl.codegen.emitter.MultiLanguageClientEmitter#createDOMDocuementForInterfaceImplementation(org.apache.wsdl.WSDLBinding)
- * @param binding
- * @return
- */
- protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
- WSDLInterface boundInterface = binding.getBoundInterface();
-
- XmlDocument doc = new XmlDocument();
- Element rootElement = doc.createElement("class");
-
- Attr packageAttribute = doc.createAttribute("package");
- packageAttribute.setValue("something"); //todo set this
- rootElement.setAttributeNode(packageAttribute);
-
- Attr nameAttribute = doc.createAttribute("name");
- nameAttribute.setValue(boundInterface.getName().getLocalPart()+"Stub");
- rootElement.setAttributeNode(nameAttribute);
-
- Attr nameServiceAttribute = doc.createAttribute("servicename");
- nameServiceAttribute.setValue(boundInterface.getName().getLocalPart());
- rootElement.setAttributeNode(nameServiceAttribute);
-
- Attr nameSpaceAttribute = doc.createAttribute("namespace");
- nameSpaceAttribute.setValue(boundInterface.getName().getNamespaceURI());
- rootElement.setAttributeNode(nameSpaceAttribute);
-
- Attr InterfaceNameAttribute = doc.createAttribute("interfaceName");
- InterfaceNameAttribute.setValue(boundInterface.getName().getLocalPart());
- rootElement.setAttributeNode(InterfaceNameAttribute);
-
- loadOperations(boundInterface, doc, rootElement);
- doc.appendChild(rootElement);
-
- return doc;
-
- }
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Sat May 14 21:06:40 2005
@@ -9,6 +9,7 @@
import org.apache.wsdl.WSDLBinding;
import org.apache.wsdl.WSDLOperation;
import org.apache.wsdl.WSDLTypes;
+import org.apache.wsdl.WSDLInterface;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
@@ -54,6 +55,8 @@
public abstract class MultiLanguageClientEmitter implements Emitter{
+ private static final String CALL_BACK_HANDLER_SUFFIX = "CallbackHandler";
+ private static final String STUB_SUFFIX = "Stub";
protected InputStream xsltStream = null;
protected CodeGenConfiguration configuration;
@@ -91,7 +94,6 @@
//write the call back handlers
writeCallBackHandlers(axisBinding);
} catch (Exception e) {
- // e.printStackTrace();
throw new CodeGenerationException(e);
}
}
@@ -100,13 +102,15 @@
*
*/
protected void writeCallBackHandlers(WSDLBinding binding) throws Exception{
- XmlDocument interfaceModel = createDOMDocumentForCallbackHandler(binding);
- CallbackHandlerWriter writer =
- new CallbackHandlerWriter(this.configuration.getOutputLocation(),
- this.configuration.getOutputLanguage()
- );
- writeClass(interfaceModel,writer);
-
+
+ if (configuration.isAsyncOn()){
+ XmlDocument interfaceModel = createDOMDocumentForCallbackHandler(binding);
+ CallbackHandlerWriter callbackWriter =
+ new CallbackHandlerWriter(this.configuration.getOutputLocation(),
+ this.configuration.getOutputLanguage()
+ );
+ writeClass(interfaceModel,callbackWriter);
+ }
}
/**
@@ -183,27 +187,28 @@
throw new UnsupportedOperationException("Not supported yet");
}
- /**
- * Creates the DOM tree for the interface creation
+ /**
+ * Generating the callbacks
* @param binding
* @return
*/
- protected abstract XmlDocument createDOMDocuementForInterface(WSDLBinding binding);
+ protected XmlDocument createDOMDocumentForCallbackHandler(WSDLBinding binding){
+ WSDLInterface boundInterface = binding.getBoundInterface();
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("callback");
+ addAttribute(doc,"package",configuration.getPackageName(),rootElement);
+ addAttribute(doc,"name",boundInterface.getName().getLocalPart()+CALL_BACK_HANDLER_SUFFIX,rootElement);
+ addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
+
+ //TODO JAXRPC mapping support should be considered
+ this.loadOperations(boundInterface, doc, rootElement);
+ //this.loadOperations(boundInterface, doc, rootElement, "on", "Complete");
- /**
- * Creates the DOM tree for implementations
- * @param binding
- * @return
- */
- protected abstract XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding);
+ doc.appendChild(rootElement);
+ return doc;
+ }
/**
- * Generating the callbacks
- * @param operation
- * @return
- */
- protected abstract XmlDocument createDOMDocumentForCallbackHandler(WSDLBinding binding);
- /**
* Finds the input element for the xml document
* @param doc
* @param operation
@@ -213,13 +218,11 @@
Element inputElt = doc.createElement("input");
//todo this should be multiple
Element param = doc.createElement("param");
- Attr paramNameAttr = doc.createAttribute("name");
- paramNameAttr.setValue(this.mapper.getParameterName(operation.getInputMessage().getElement()));
- param.setAttributeNode(paramNameAttr);
- Attr paramTypeAttr = doc.createAttribute("type");
+ addAttribute(doc,"name",this.mapper.getParameterName(operation.getInputMessage().getElement()),param);
+
Class typeMapping = this.mapper.getTypeMapping(operation.getInputMessage().getElement());
- paramTypeAttr.setValue(typeMapping==null?"":typeMapping.getName());
- param.setAttributeNode(paramTypeAttr);
+ String typeMappingStr =typeMapping==null?"":typeMapping.getName();
+ addAttribute(doc,"type",typeMappingStr,param);
inputElt.appendChild(param);
@@ -235,14 +238,11 @@
protected Element getOutputElement(XmlDocument doc,WSDLOperation operation){
Element outputElt = doc.createElement("output");
Element param = doc.createElement("param");
- Attr paramNameAttr = doc.createAttribute("name");
- paramNameAttr.setValue(this.mapper.getParameterName(operation.getOutputMessage().getElement()));
- param.setAttributeNode(paramNameAttr);
- Attr paramTypeAttr = doc.createAttribute("type");
- Class typeMapping = this.mapper.getTypeMapping(operation.getOutputMessage().getElement());
- paramTypeAttr.setValue(typeMapping==null?"":typeMapping.getName());
- param.setAttributeNode(paramTypeAttr);
+ addAttribute(doc,"name",this.mapper.getParameterName(operation.getOutputMessage().getElement()),param);
+ Class typeMapping = this.mapper.getTypeMapping(operation.getOutputMessage().getElement());
+ String typeMappingStr=typeMapping==null?"":typeMapping.getName();
+ addAttribute(doc,"type",typeMappingStr,param);
outputElt.appendChild(param);
return outputElt;
@@ -254,6 +254,82 @@
*/
protected XmlDocument createDOMDocuementForBean(){
return null;
+ }
+
+ /**
+ * Creates the DOM tree for the interface creation
+ * @param binding
+ * @return
+ */
+ protected XmlDocument createDOMDocuementForInterface(WSDLBinding binding){
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("interface");
+ addAttribute(doc,"package",configuration.getPackageName(),rootElement);
+ addAttribute(doc,"name",boundInterface.getName().getLocalPart(),rootElement);
+ fillSyncAttributes(doc, rootElement);
+ loadOperations(boundInterface, doc, rootElement);
+ doc.appendChild(rootElement);
+
+ return doc;
+
+ }
+
+ private void fillSyncAttributes(XmlDocument doc, Element rootElement) {
+ addAttribute(doc,"isAsync",this.configuration.isAsyncOn()?"1":"0",rootElement);
+ addAttribute(doc,"isSync",this.configuration.isSyncOn()?"1":"0",rootElement);
+ }
+
+ private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement){
+ loadOperations(boundInterface, doc, rootElement, null, null);
+ }
+
+ private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement, String operationPrefix, String operationPostfix) {
+ Collection col = boundInterface.getOperations().values();
+ Element methodElement = null;
+ WSDLOperation operation = null;
+
+ for (Iterator iterator = col.iterator(); iterator.hasNext();) {
+ operation = (WSDLOperation) iterator.next();
+ methodElement = doc.createElement("method");
+ addAttribute(doc,"name",operation.getName().getLocalPart(),methodElement);
+ addAttribute(doc,"namepace",operation.getName().getNamespaceURI(),methodElement);
+ methodElement.appendChild(getInputElement(doc,operation));
+ methodElement.appendChild(getOutputElement(doc,operation));
+ rootElement.appendChild(methodElement);
+ }
+ }
+
+ /**
+ * Creates the DOM tree for implementations
+ * @param binding
+ * @return
+ */
+ protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
+ WSDLInterface boundInterface = binding.getBoundInterface();
+
+ XmlDocument doc = new XmlDocument();
+ Element rootElement = doc.createElement("class");
+ addAttribute(doc,"package",configuration.getPackageName(),rootElement);
+ addAttribute(doc,"name",boundInterface.getName().getLocalPart()+STUB_SUFFIX,rootElement);
+ addAttribute(doc,"servicename",boundInterface.getName().getLocalPart(),rootElement);
+ addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
+ addAttribute(doc,"interfaceName",boundInterface.getName().getLocalPart(),rootElement);
+ addAttribute(doc,"callbackname",boundInterface.getName().getLocalPart() + CALL_BACK_HANDLER_SUFFIX,rootElement);
+ fillSyncAttributes(doc, rootElement);
+ loadOperations(boundInterface, doc, rootElement);
+ doc.appendChild(rootElement);
+
+ return doc;
+
+ }
+
+ protected void addAttribute(XmlDocument document,String AttribName, String attribValue, Element element){
+ Attr attribute = document.createAttribute(AttribName);
+ attribute.setValue(attribValue);
+ element.setAttributeNode(attribute);
+
}
}
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/BeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/BeanTemplate.xsl?rev=170193&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/BeanTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/BeanTemplate.xsl Sat May 14 21:06:40 2005
@@ -0,0 +1,45 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+ <xsl:template match="/bean">
+ namespace <xsl:value-of select="@package"/>
+ {
+
+ /// <summary>
+ /// Auto generated bean class by the Axis code generator
+ /// This is meant to be used with the IKVM converted Axis libraries
+ /// </summary>
+
+ public class <xsl:value-of select="@name"/> {
+
+
+ <xsl:for-each select="property">
+ <xsl:variable name="propertyType"><xsl:value-of select="@type"></xsl:value-of></xsl:variable>
+ <xsl:variable name="propertyName"><xsl:value-of select="@name"></xsl:value-of></xsl:variable>
+
+ /// <summary>
+ /// field for <xsl:value-of select="$propertyName"/>
+ ///</summary>
+ private <xsl:value-of select="$propertyType"/> local<xsl:value-of select="$propertyName"/>;
+
+ /// <summary>
+ /// Auto generated getter method
+ ///</summary>
+ /// <returns><xsl:value-of select="$propertyType"/></returns>
+ ///
+ public <xsl:value-of select="$propertyType"/><xsl:text> </xsl:text>get<xsl:value-of select="$propertyName"/>(){
+ return local<xsl:value-of select="$propertyName"/>;
+ }
+
+ /// <summary>
+ /// Auto generated setter method
+ ///</summary>
+ ///<param name="param{$propertyName}"> </param>
+ ///
+ public void set<xsl:value-of select="$propertyName"/>(<xsl:value-of select="$propertyType"/> param<xsl:value-of select="$propertyName"/>){
+ this.local<xsl:value-of select="$propertyName"/>=param<xsl:value-of select="$propertyName"/>;
+ }
+ </xsl:for-each>
+ }
+ }
+ </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/CallbackHandlerTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/CallbackHandlerTemplate.xsl?rev=170193&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/CallbackHandlerTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/CallbackHandlerTemplate.xsl Sat May 14 21:06:40 2005
@@ -0,0 +1,42 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+ <xsl:template match="/callback">
+ namespace <xsl:value-of select="@package"/>
+ {
+ ///<summary>
+ /// Auto generated C# Callback class by the Axis code generator
+ /// This is meant to be used with the IKVM converted Axis libraries
+ /// </summary>
+
+ public class <xsl:value-of select="@name"/>
+ {
+
+
+ <xsl:for-each select="method">
+
+ /// <summary>
+ /// Auto generated Axis2 call back method
+ ///</summary>
+ ///
+ public void receiveResult<xsl:value-of select="@name"/>(org.apache.axis.clientapi.AsyncResult result)
+ {
+ //Fill here with the code to handle the response
+
+ }
+
+ ///<summary>
+ /// Auto generated Axis2 Error handler
+ /// </summary>
+ ///
+ public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e)
+ {
+ //Fill here with the code to handle the exception
+
+ }
+ </xsl:for-each>
+
+
+ }
+ }
+ </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceImplementationTemplate.xsl?rev=170193&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceImplementationTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceImplementationTemplate.xsl Sat May 14 21:06:40 2005
@@ -0,0 +1,106 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+ <xsl:template match="/class">
+ <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
+ <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ namespace <xsl:value-of select="$package"/>{
+
+ /// <summary>
+ /// Auto generated C# implementation by the Axis code generator
+ /// This is meant to be used with the IKVM converted Axis libraries
+ ///</summary>
+
+ public class <xsl:value-of select="@name"/> :org.apache.axis.clientapi.Stub,<xsl:value-of select="$interfaceName"/>{
+
+ private static org.apache.axis.description.AxisGlobal _axisGlobal = null;
+ private static org.apache.axis.engine.AxisSystemImpl _axisSystem = null;
+ private static org.apache.axis.context.SystemContext _systemContext = null;
+ private static org.apache.axis.description.AxisService _service = null;
+ private static org.apache.axis.description.AxisOperation[] _operations = new org.apache.axis.description.AxisOperation[<xsl:value-of select="count(method)"/>];
+
+ ///<summary>
+ /// static constructor
+ ///< /summary >
+ static <xsl:value-of select="@name"/>(){
+ _axisGlobal = new org.apache.axis.description.AxisGlobal();
+ _axisSystem = new org.apache.axis.engine.AxisSystemImpl(_axisGlobal);
+ _systemContext = new org.apache.axis.context.SystemContext(_axisSystem);
+ _service = new org.apache.axis.description.AxisService();
+ _service.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@servicename"/>"));
+ org.apache.axis.description.AxisOperation __operation;
+
+ <xsl:for-each select="method">
+ __operation = new org.apache.axis.description.AxisOperation();
+ __operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
+ // more things are supposed to come here
+ _operations[<xsl:value-of select="position()-1"/>]=__operation;
+ </xsl:for-each>
+ }
+ <xsl:for-each select="method">
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+ <xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+ <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+
+ <xsl:if test="$isSync='1'">
+ /// <summary>
+ /// Auto generated method signature
+ ///</summary>
+ ///<xsl:if test="$inputtype!=''"><param name="$inputparam"></param></xsl:if>
+ ///
+ public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>)
+ {
+
+ org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
+ org.apache.axis.context.MessageContext _messageContext = getMessageContext();
+ <xsl:if test="$outputtype=''">
+ _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+ return null;
+ </xsl:if>
+ <xsl:if test="$outputtype!=''">
+ Object obj = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+ return (<xsl:value-of select="$outputtype"/>)obj;
+ </xsl:if>
+ <!-- this needs to be changed -->
+ }
+ </xsl:if>
+ <xsl:if test="$isAsync='1'">
+ ///<summary>
+ ///Auto generated method signature
+ ///</summary>
+ ///<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
+ ///
+ public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>)
+ {
+ // we know its call because we have the mep at the time of the stub generation.
+ org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
+ org.apache.axis.context.MessageContext _messageContext = getMessageContext();
+ _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext, new CallBack<xsl:value-of select="generate-id()"/>());
+ <!-- this needs to be changed -->
+ }
+
+ ///<summary>
+ /// C# does not support anoynmous inner classes
+ ///</summary>
+ private class CallBack<xsl:value-of select="generate-id()"/>:org.apache.axis.clientapi.CallBack
+ {
+ public void onComplete(org.apache.axis.clientapi.AsyncResult result)
+ {
+ new <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>().receiveResult<xsl:value-of select="@name"/>(result);
+ }
+ public void reportError(java.lang.Exception e)
+ {
+ new <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>().receiveError<xsl:value-of select="@name"/>(e);
+ }
+
+
+
+ }
+ </xsl:if>
+ </xsl:for-each>
+ }
+ }
+ </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceTemplate.xsl?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/csharp/InterfaceTemplate.xsl Sat May 14 21:06:40 2005
@@ -1,16 +1,41 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/interface">
- namespace <xsl:value-of select="@package"/>;
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ namespace <xsl:value-of select="@package"/>
+ {
- //
- // Auto generated C# interface by the Axis code generator
- //
+ /// <summary>
+ /// Auto generated C# interface by the Axis code generator
+ /// This is meant to be used with the IKVM converted Axis libraries
+ /// </summary>
+
+ public interface <xsl:value-of select="@name"></xsl:value-of>
+ {
- public interface <xsl:value-of select="@name"></xsl:value-of> {
<xsl:for-each select="method">
- <xsl:value-of select="output/param/@type"></xsl:value-of><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of>(<xsl:value-of select="input/param/@type"></xsl:value-of><xsl:text> </xsl:text><xsl:value-of select="output/param/@name"></xsl:value-of>);
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+ <xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+ <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+ <xsl:if test="$isSync='1'">
+ /// <summary>
+ /// Auto generated interface method
+ /// </summary>
+ public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>);
+ </xsl:if>
+
+ <xsl:if test="$isAsync='1'">
+ ///<summary>
+ ///Auto generated interface method
+ ///</summary>
+ ///<xsl:if test="$inputtype!=''"><param name="<xsl:value-of select="$inputparam"/>"/></xsl:if>
+ ///
+ public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) ;
+ </xsl:if>
+
</xsl:for-each>
}
+ }
</xsl:template>
</xsl:stylesheet>
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/BeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/BeanTemplate.xsl?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/BeanTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/BeanTemplate.xsl Sat May 14 21:06:40 2005
@@ -16,7 +16,7 @@
/**
* field for <xsl:value-of select="$propertyName"/>
*/
- private <xsl:value-of select="$propertyType"/> local<xsl:value-of select="$propertyName"/>
+ private <xsl:value-of select="$propertyType"/> local<xsl:value-of select="$propertyName"/>;
/**
* Auto generated getter method
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/CallbackHandlerTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/CallbackHandlerTemplate.xsl?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/CallbackHandlerTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/CallbackHandlerTemplate.xsl Sat May 14 21:06:40 2005
@@ -1,27 +1,32 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
- <xsl:template match="/class">
+ <xsl:template match="/callback">
package <xsl:value-of select="@package"/>;
/**
- * Auto generated bean class by the Axis code generator
+ * Auto generated Callback class by the Axis code generator
*/
- public class <xsl:value-of select="@name"/> implements org.apache.axis.clientapi.Callback{
+ public class <xsl:value-of select="@name"/>{
- <xsl:for-each select="method">
- <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
-
- <xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
- <xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
- /**
- * Axis2 generated method signature
- *<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
+ <xsl:for-each select="method">
+ /**
+ * auto generated Axis2 call back method
+ *
*/
- public void <xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException {
- //TODO Complete the implementation
+ public void receiveResult<xsl:value-of select="@name"/>(org.apache.axis.clientapi.AsyncResult result) {
+ //Fill here with the code to handle the response
+ }
+
+ /**
+ * auto generated Axis2 Error handler
+ *
+ */
+ public void receiveError<xsl:value-of select="@name"/>(java.lang.Exception e) {
+ //Fill here with the code to handle the exception
+
}
</xsl:for-each>
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl Sat May 14 21:06:40 2005
@@ -3,6 +3,9 @@
<xsl:template match="/class">
<xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
<xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
package <xsl:value-of select="$package"/>;
/*
@@ -10,24 +13,26 @@
*/
public class <xsl:value-of select="@name"></xsl:value-of> extends org.apache.axis.clientapi.Stub implements <xsl:value-of select="$interfaceName"/>{
+ private static org.apache.axis.description.AxisGlobal _axisGlobal = null;
+ private static org.apache.axis.engine.AxisSystemImpl _axisSystem = null;
+ private static org.apache.axis.context.SystemContext _systemContext = null;
+ private static org.apache.axis.description.AxisService _service = null;
+ private static org.apache.axis.description.AxisOperation[] _operations = new org.apache.axis.description.AxisOperation[<xsl:value-of select="count(method)"/>];
+
static{
_axisGlobal = new org.apache.axis.description.AxisGlobal();
_axisSystem = new org.apache.axis.engine.AxisSystemImpl(_axisGlobal);
_systemContext = new org.apache.axis.context.SystemContext(_axisSystem);
_service = new org.apache.axis.description.AxisService();
-
_service.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@servicename"/>"));
-
- org.apache.axis.description.AxisOperation __operation;
+ org.apache.axis.description.AxisOperation __operation;
<xsl:for-each select="method">
__operation = new org.apache.axis.description.AxisOperation();
__operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
// more things are supposed to come here
-
_operations[<xsl:value-of select="position()-1"/>]=__operation;
-
</xsl:for-each>
}
<xsl:for-each select="method">
@@ -35,21 +40,51 @@
<xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
<xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
- /**
+ <xsl:if test="$isSync='1'">
+ /**
* Auto generated method signature
* @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#<xsl:value-of select="@name"/>
*<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
*/
- public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException;
- <xsl:if test="$outputtype=''">return null;</xsl:if>
+ public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException{
+
+ org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
+ org.apache.axis.context.MessageContext _messageContext = getMessageContext();
+ <xsl:if test="$outputtype=''">
+ _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+ return null;
+ </xsl:if>
<xsl:if test="$outputtype!=''">
- // we know its call because we have the mep at the time of the stub generation.
- Call _call = new Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
- MessageContext _messageContext = getMessageContext();
- Object obj = _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
- return (<xsl:value-of select="$outputtype"/>)obj;</xsl:if>
+ Object obj = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
+ return (<xsl:value-of select="$outputtype"/>)obj;
+ </xsl:if>
+ <!-- this needs to be changed -->
+ }
+ </xsl:if>
+ <xsl:if test="$isAsync='1'">
+ /**
+ * Auto generated method signature
+ * @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#start<xsl:value-of select="@name"/>
+ *<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
+ */
+ public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException{
+ // we know its call because we have the mep at the time of the stub generation.
+ org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
+ org.apache.axis.context.MessageContext _messageContext = getMessageContext();
+ _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext, new org.apache.axis.clientapi.CallBack(){
+ public void onComplete(org.apache.axis.clientapi.AsyncResult result){
+ new <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>().receiveResult<xsl:value-of select="@name"/>(result);
+ }
+ public void reportError(java.lang.Exception e){
+ new <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>().receiveError<xsl:value-of select="@name"/>(e);
+ }
+
+ }
+ );
+
<!-- this needs to be changed -->
}
+ </xsl:if>
</xsl:for-each>
}
</xsl:template>
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl?rev=170193&r1=170192&r2=170193&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl Sat May 14 21:06:40 2005
@@ -1,6 +1,9 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/interface">
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+
package <xsl:value-of select="@package"/>;
/*
@@ -13,12 +16,20 @@
<xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
<xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
-
+ <xsl:if test="$isSync='1'">
/**
* Auto generated method signature
*<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
*/
- public <xsl:value-of select="$outputtype"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException;
+ public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException;
+ </xsl:if>
+ <xsl:if test="$isAsync='1'">
+ /**
+ * Auto generated method signature
+ *<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
+ */
+ public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException;
+ </xsl:if>
</xsl:for-each>
}
</xsl:template>